Posts Tagged “Curves”

After writing a function to test intersections of a line to a polygon, another problem came up where I needed
to test an intersection of a line to a curve. I'm sure there is a library someone has wrote that could do this but there is some fun in figuring out puzzles.
There was a recent comment about curves and intersections so I decided to go ahead an post what I attempted.
I feel using a loop is expensive, but it's all I can think of doing for this, similar to the lineIntersectPoly function.

Read the rest of this entry »

Comments 3 Comments »

You ever wanted an Object to move along the path of a curve?...a curve drawn with the ActionScript drawing API.

The curves drawn using the API are quadratic. Using the following expressions, you can plot an "x" or "y" value on a curve at a time between 0 - 1. You could even plot a "z" value for 3D if you wanted.

  1. var x:Number=Math.pow(1-time,2)*startvalueX+2*(1-time)*time*controlX+Math.pow(time,2)*endvalueX;
  2. var y:Number=Math.pow(1-time,2)*startvalueY+2*(1-time)*time*controlY+Math.pow(time,2)*endvalueY;

Read the rest of this entry »

Comments 5 Comments »

Thanks for visiting