"Chris M. Thomasson" wrote in message
news:kgrag9$hb1$1...@speranza.aioe.org...
"Roger Bagula" wrote in message
news:87d4638f-32ee-40e2...@googlegroups.com...
> > Chris M. Thomasson
> > And just how do we run this code?
> > What program can i download to run it
> > and on what operating system?
> You can download a free actionscript 3 compiler; IMHO, here is a damn good
> one:
>
http://www.flashdevelop.org
> Create a new flash as3 project...
> Cut and paste the code...
> Compile and run.
> It _should_ be as simple as that.
[....]
Actually, you need to set the background color of the project (e.g., main
stage/canvas)
to black wrt the posted code as is because it paints with white, which will
not show up
to good on a white background!
Ouch.
Also, I limited the drawing up to a certain point. Basically, if the
distance between the
intersection points of two circles is less than 1, then the algorithm will
stop iterating,
and finally stop rendering altogether.
Here is code that paint's using black, so you can use it out of the box with
FlashDevelop
that happens to have a default background color of white:
_____________________________________________________________
package
{
import flash.display.Sprite;
import flash.events.Event;
/**
* ...
* @author Chris M. Thomasson
*/
public class Main extends Sprite
{
private var mcr1:Number = 3;
private var mcr2:Number = 3;
private var mcrbail:Number = 1.341;
public function
prv_draw(i:uint, cmp1:Array, cmp2:Array):void {
if (i > 22 || ! cmp1 || ! cmp2) return;
var c:Number = cmp1[2] + cmp2[2];
c = (c * 314) * (c * 628) + 0xFF0000;
this.graphics.lineStyle(.277 / (i / 22),
0x000000, .1);
prv_circle_draw(cmp1, 0);
var isect1:Array = prv_circle_isect(cmp1, cmp2, 0, 3);
if (isect1)
{
prv_draw(i + 1, isect1, cmp1);
prv_draw(i + 1, isect1, cmp2);
prv_draw(i + 1, cmp1, isect1);
prv_draw(i + 1, cmp2, isect1);
}
}
public function
Main():void {
// render test
//mcr1 = mcrbail;
//prv_cdraw_render();
addEventListener(Event.ENTER_FRAME, prv_cdraw_render);
}
public function
prv_cdraw_render(e5:Event = null):void {
this.graphics.clear();
var circles:Array = [
267, 266, 188,
488, 300, 222];
this.graphics.lineStyle(1, 0xFFFFFF, .1);
this.graphics.drawCircle(circles[0], circles[1], circles[2]);
this.graphics.drawCircle(circles[3], circles[4], circles[5]);
prv_draw(0, circles, circles);
mcr1 -= .007;
mcr2 += .17;
if (mcr1 < mcrbail) // mcr bailout
{
// render bailout
removeEventListener(Event.ENTER_FRAME, prv_cdraw_render);
if (h < 1)
{
// bailout
return null;
}
var rx:Number = -dy * (h / d);
var ry:Number = dx * (h / d);
var p1x:Number = x2 + -h * (circles2[ci2 + 1] - circles[ci1 +
1]) / d;
var p1y:Number = y2 + h * (circles2[ci2 + 0] - circles[ci1 + 0])
/ d;
var p2x:Number = p1x - ((p1x - x2) * 2);
var p2y:Number = p1y - ((p1y - y2) * 2);
var hr:Number = h / mcr1;
if (hr < 1)
{
// bailout;
return null;