1 Reply Latest reply on Jun 6, 2006 4:52 AM by Newsgroup_User

# A tricky one - trig / action script

I'm using AS to try and draw a sector of a circle.
say i start from co-ords (0,0)
i lineTo(0,50)
then i want to start a curve that will end up at (x,y) - depending on the angle of the sector
then lineTo(0,0) to complete the sector

This is probably more of a trig question than AS how can i calculate the points for the controlX and controlY properties of the curveTo function. I'm not sure how AS handles the control points and what relative distance they have to be from the anchor points to make the curve section of the sector appear as part of a complete circle rather than having a funny bulge in the circle. Ideally i want this to work for any angle of the sector, always starting from (0,0) with same radius (50) but with different starting point for curve . I can work out the anchor points for the curveTo but i can't figure out how to calculate the control points.
Anyway i hope someone can help me!
• ###### 1. Re: A tricky one - trig / action script
I'd draw the circle/arc using regular drawing techniques instead of trying
to use control points. If you're resolution is fine enough you won't be able
to tell anyway. Here's an arc function for ya:

angStart:Number, angEnd:Number):Void {
var rs = angStart / 57.29578;
var re = angEnd / 57.29578;
mc.lineStyle(0, 0x000000);
mc.moveTo(x, y);
for (var t = rs; t < re; t += .01) {