A bezier curve would be one way to go about it.

Flash's curveTo method uses a quadtratic curve though,
so using a cubic curve won't give you an accurate
curve.

If you know that the two endpoints of the curve are
always going to have an equal x or y value, the you
can just use the quadratic formula, and get the right
Y value.

If the endpoints are arbitrary, it's a bit more
complicated. Bezier curves take a number from 0 to 1
and give you a point along the curve. Plugging 0 into
the formula gives you the first endpoint, 1 gets you
the last, and anything else gives you something in
between.

This means you're going to have to figure out where
along the curve your MC is closest to, which involves
some vector math.

If you want, I can draw out the way I'd approach it.


--- leolea <[EMAIL PROTECTED]> wrote:

> 
> Hi, thanks for your reply!
> 
> My curve isn't exactly a circle. Here's what my
> animated curve would look
> like: 
>
http://pages.videotron.com/poubou/flash/cannes01.html
> 
> 
> The curve is drawn using the drawing API:
> example:
>  mc.moveTo(0,0);
>  mc.curveTo(400,900,0,800);
> 
> So, I know the 3 bezier points that define my curve:
> startpoint = 0,0
> middlepoint = 400,900
> endpoint = 800,0
> 
> With those values in hand, how can I apply them to
> your function:
> > f(x) = A*x + x^2
> 
> 
> Do I make any sense?
> 
> 
> 
> 
> On 4/25/07 3:50 PM, "Jobe Makar"
> <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > Your typical funciton looks something like this in
> math books:
> > 
> > f(x) = A*x + x^2 //just an example
> > 
> > Where f(x) is essentially 'y'. So, you just need
> the equation that defines
> > your curve. The curve in your jpg appears to be a
> circle.
> > 
> > y = sqrt(x^2 + r^2) //where r is the radius
> > 
> > That actually yields + or - and you just pick what
> fits your situation best.
> > So, you pump in an x and get you 2 y's. Pick the
> best y and use it.
> 
> 
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the
> archive:
>
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to