cdCanvasArc
| Definition: |
include pGUI.e
cdCanvasArc(cdCanvas canvas, atom xc, yc, w, h, angle1, angle2) --or-- cdCanvasSector(cdCanvas canvas, atom xc, yc, w, h, angle1, angle2) --or-- cdCanvasChord(cdCanvas canvas, atom xc, yc, w, h, angle1, angle2) |
|||
| Description: |
cdCanvasArc draws the arc of an ellipse aligned with the axis, using the current foreground color and line width and style. cdCanvasSector fills the arc, according to the current interior style, in the shape of a pie. cdCanvasChord fills the arc, according to the current interior style, with the start and end points of the arc connected. |
|||
| pwa/p2js: | Supported, but not the world coordinate versions. | |||
| Comments: |
The coordinate (xc,yc) defines the center of the ellipse. Dimensions w and h define the elliptic axes X and Y, respectively.
Angles angle1 and angle2 are in degrees and oriented counter-clockwise, ie East/3:00 is 0 (or 360), North/12:00 is 90, West/9:00 is 180 and South/6:00 is 270. They define the arc start and end, but they are not the angle relative to the center, except when w==h and the ellipse is reduced to a circle. The arc starts at the point (xc+(w/2)*cos(angle1), yc+(h/2)*sin(angle1)) and ends at (xc+(w/2)*cos(angle2), yc+(h/2)*sin(angle2)). A complete ellipse can be drawn using 0 and 360 as the angles. If angle2 is less than angle1 it will be increased by 360 until it is greater than angle1. The angles are specified so if the size of the ellipse (w x h) is changed, its shape is preserved. So the angles relative to the center are dependent from the ellipse size. The actual angle can be obtained using rangle = atan2((h/2)*sin(angle), (w/2)*cos(angle)). To specify the angle in radians, you can use the definition CD_RAD2DEG to multiply the value in radians before passing the angle to CD. When the interior style CD_HOLLOW is defined, cdCanvasSector behaves like cdCanvasArc plus two lines connecting to the center, and cdCanvasChord behaves like cdCanvasArc plus a line connecting the arc start and end points. When translating to Phix, the C functions cdfCanvasArc(), cdfCanvasSector(), and cdfCanvasChord() should simply have the 'f' deleted. wdCanvasArc(), wdCanvasSector(), and wdCanvasChord() are identical, except the parameters are in world coordinates. |
|||
| Parameters: |
|
|||
|
|
cdCanvasCircle(cdCanvas canvas, atom x, y, r, boolean filled=false) is just a simple convenience wrapper to cdCanvasArc(canvas, x, y, r, r, 0, 360) when filled is false, or cdCanvasSector(<ditto>) when filled is true. | |||
| See Also: |
Several of the attributes documented in cdCanvasLine() also apply to cdCanvasArc. Several of the attributes documented in cdCanvasBox() also apply to cdCanvasSector/Chord. |


