emiel
Administrator
Belgium
327 Posts 
Posted  07/21/2005 : 12:47:46

Method DrawArc
Action:
This method draws an arc of a circle or ellipse, depending the value of it's aspect, by using radians for start and end points of the arc.
Syntax:
DrawArc ( vXpos As variant, vYpos As Variant, vRad As Variant, sStart As Single, sEnd as Single, sAspect as Single) As String
Parameter Description
vXpos Start horizontal coordinate
vYpos Start vertical coordinate
vRad Radius
sStart Startpoint in radians
sEnd Endpoint in radians
sAspect Angle of arc Segment Remarks:
To define the radials the following is necessary to know:
A circle does have 2*PI radians, which is equal to 360°, so
1° = 2 PI / 360
and
0.25*PI = 45° 0.50*PI = 90° 0.75*PI = 135° 1*PI = 180°
Note: 0° and 360° are located on the middle rightside of the circle
When sStart = 0.25 PI the arc's starting point is 45° When SEnd = 2 PI the arc's ending point is 360° When drawn there is a circle part which is missing the arc from 0° to 45°
Exception on the rule : if sStart = sEnd then a circle is drawn when sAspect = 1 or 1.
If sAspect = 2 then a arc of an ellipse will be drawn, of which horizontal radius is half of vRad, when s Aspect = 3 then that radius is 1/3 of vRad etc...
If sAspect contains negative values an ellipse will be drawn, of which vertical radius enlarge.
Example:
Const PI = 3.14159265
preview.DrawArc 1000, 1000, 567, 0.25 * PI, 2 * PI, 1 ' 45° to 360°
preview.DrawArc 1000, 3000, 567, 0.5 * PI, 2 * PI, 1 ' 90° to 360
preview.DrawArc 1000, 5000, 567, 1 * PI, 2 * PI, 1 ' 180° to 360°
preview.DrawArc 1000, 7000, 567, 1.5 * PI, 2 * PI, 1 ' 270° to 360° to draw a sector of 45° :
Const PI = 3.14159265
preview.DrawArc 1000, 1000, 567, 0, 0.25 * PI, 1
preview.DrawLine 1000, 1000, 1567, 1000 ' from the center to sStart
sAngle = 0.25 * PI / (2 * PI / 360) ' calculation to ° to be exact
lYpos = 567 * Sin(sAngle * PI / 180) ' some arithmatic to get the Ypos
lXpos = 567 * Cos(sAngle * PI / 180) ' some arithmatic to get the Xpos
preview.DrawLine 1000, 1000, 1000 + lXpos, 1000  lYpos ' from center to sEnd See also:
DrawLine > http://www.ppreview.net/forum/topic.asp?TOPIC_ID=321 DrawCircle > http://www.ppreview.net/forum/topic.asp?TOPIC_ID=354 DrawEllips > http://www.ppreview.net/forum/topic.asp?TOPIC_ID=353
Come and visit : www.immoassist.com www.ppreview.net www.vbdiamond.com www.d2dsources.com www.mandix.com

Edited by  emiel on 08/09/2005 09:26:12 

