Thanks Fumio - I already had an 8-segment circle-drawing function, I was
looking for a 4-segment. It turned out to be pretty trivial - not accurate,
but close enough for what I needed. So my problem is solved.

Thanks anyway!

Cheers,
  Ian

On 2/3/06, Fumio Nonaka <[EMAIL PROTECTED]> wrote:
>
> function xDrawCircle(target_mc:MovieClip, nX:Number, nY:Number,
> nR:Number, nSegments:Number):Void {
>         if (nSegments == undefined) {
>                 nSegments = 8;
>         }
>         var nAngle:Number = 2*Math.PI/nSegments;
>         target_mc.moveTo(nX+nR, nY);
>         for (var i = 1; i<=nSegments; ++i) {
>                 var nTheta:Number = i*nAngle;
>                 var nAnchorX:Number = nR*Math.cos(nTheta);
>                 var nAnchorY:Number = nR*Math.sin(nTheta);
>                 var nControlX:Number =
> nAnchorX+nR*Math.tan(nAngle/2)*Math.cos(nTheta-Math.PI/2);
>                 var nControlY:Number =
> nAnchorY+nR*Math.tan(nAngle/2)*Math.sin(nTheta-Math.PI/2);
>                 target_mc.curveTo(nControlX+nX, nControlY+nY, nAnchorX+nX,
> nAnchorY+nY);
>         }
> }
> // Test
> var _mc:MovieClip = this.createEmptyMovieClip("target_mc", 1);
> _mc.beginFill(0x00FFFF);
> _mc.lineStyle(2, 0x0000FF);
> xDrawCircle(_mc, Stage.width/2, Stage.height/2, 100, 8);
> _mc.endFill();
> _____
> Ian Thomas wrote:
> >   Thanks for that - I've come up with an approximation based on very
> similar
> > code. Not ideal, but it's close enough for the purpose I needed it for.
> That
> > combined with a quick hash table to make sure I'm not plotting circles
> near
> > other circles has given me the performance I need.
>
> Good luck,
>
> Fumio Nonaka
> mailto:[EMAIL PROTECTED]
> http://www.FumioNonaka.com/
> My books<http://www.FumioNonaka.com/Books/index.html>
> Flash community<http://F-site.org/>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to