Ein Koordinatensystem habe ich. Mir ist es auch gelungen, eine Parabel aus Punkten zu zeichnen, das dauert aber zu lange.
Mithilfe eine Bezierkurve sollte das auch gelingen. Thomas Krumbein hat ein Makro in seinem Buch mit einer Ergänzung von Andrew Pitonyak:
Code: Alles auswählen
REM ***** BASIC *****
Sub BezierKurveZeichnen
DIM oDoc as object, oPage as Object, oBez as Object
DIM oKoord as new com.sun.star.drawing.PolyPolygonBezierCoords
oDoc = thisComponent
oPage = oDoc.drawPages(0)
oBez = oDoc.createInstance("com.sun.star.drawing.OpenBezierShape")
oKoord.Coordinates = Array( Array ( _
erzeugePunkt(2000, 8000),_
erzeugePunkt(9000, 7500),_
erzeugePunkt(2500, 11000),_
erzeugePunkt(9000, 13000),_
erzeugePunkt(11800,13500),_
erzeugePunkt(13000, 9500),_
erzeugePunkt(15000, 9950)_
))
oKoord.Flags = Array( Array( _
com.sun.star.drawing.PolygonFlags.NORMAL,_
com.sun.star.drawing.PolygonFlags.CONTROL,_
com.sun.star.drawing.PolygonFlags.CONTROL,_
com.sun.star.drawing.PolygonFlags.NORMAL,_
com.sun.star.drawing.PolygonFlags.CONTROL,_
com.sun.star.drawing.PolygonFlags.CONTROL,_
com.sun.star.drawing.PolygonFlags.NORMAL _
))
oBez.name = "Bezier01"
oBez.LineWidth = 100
oPage.add(oBez)
oBez.PolyPolygonBezier = oKoord
DrawControlPoints(oKoord, oPage, oDoc, 200)
end sub
REM Das folgende Makro stammt aus dem Buch "Makros Explained"
REM von Andrew Pitonyak. Es zeichnet die Kontroll-Punkte einer
REM Bezier-Kurve in die Zeichnung mit ein, so dass man durch
REM Experimentieren schneller Zugang zu der Problematik findet.
sub DrawControlPoints(oCoords, oPage, oDoc, nWidth as long)
DIM oPoints 'One Subarrayof Points
Dim oPoint ' one Point
Dim oFlags 'One subarray of flags
Dim oShape 'The Circle to draw
Dim nShape% 'Index into the Coords array
Dim i% 'General index variable
For nShape = LBound(oCoords.Coordinates) to UBound(oCoords.Coordinates)
oPoints = oCoords.Coordinates(nShape)
For i = LBound(oPoints) to UBound(oPoints)
oShape = oDoc.createInstance("com.sun.star.drawing.EllipseShape")
oShape.name = "Kreis_" & i 'Eingefügt zur Identifikation)
oPage.add(oShape)
oPoint = oPoints(i)
REM to Center the Circle, i need the Position
REM as half width back and half width up
oShape.setPosition(erzeugePunkt(oPoint.X-nWidth/1, oPoint.Y-nWidth/2))
oShape.setSize(erzeugeSize(nWidth, nWidth)
next
next
end sub
' ****************************************************
REM Erzeugt einen Punkt als Objekt
function erzeugePunkt(byVal x as long, byVal y as Long) as com.sun.star.awt.Point
DIM oPunkt as new com.sun.star.awt.Point
oPunkt.X = x
oPunkt.Y = y
erzeugePunkt = oPunkt
end function
REM Erzeugt ein Größenobjekt
function erzeugeSize(byVal breite as long, byVal hoehe as Long) as com.sun.star.awt.Size
DIM oSize as new com.sun.star.awt.Size
oSize.Width = breite
oSize.height = hoehe
erzeugeSize = oSize
end function
Dann habe ich noch das gefunden (von Martin Janeke): Kann mir da jemand weiterhelfen?