I actually made a little mistake in the code

mc._x = bezierQuadratic(0.5, point1.x, point2.x, point3.x);
mc._y = bezierQuadratic(0.5, point1.y, point2.y, point3.y);


function  bezierQuadratic(t, a, b, c) {
        return (1-t)*(1-t)*a+2*(1-t)*t*b+t*t*c;
}

BLITZ | Patrick Matte - 310-551-0200 x214

-----Original Message-----
From: Patrick Matte | BLITZ 
Sent: Wednesday, April 25, 2007 4:04 PM
To: 'flashcoders@chattyfig.figleaf.com'
Subject: RE: [Flashcoders] Curves question for math gurus


A quadratic curve is made of 3 points.
The first point is beginning of the curve, the second point creates the
curve between the first and last point.

This will place mc exactly on the middle of the curve

mc._x = bezierQuadratic(0.5, point1.x, point2.x, point3.x);
mc._y = bezierQuadratic(0.5, point1.x, point2.x, point3.x);


function  bezierQuadratic(t, a, b, c) {
        return (1-t)*(1-t)*a+2*(1-t)*t*b+t*t*c;
}

t being a number between 0 and 1, 0 is the location of the first point,
0.5 is the middle of the curve, 1 is the last point.


BLITZ | Patrick Matte - 310-551-0200 x214

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of leolea
Sent: Wednesday, April 25, 2007 12:34 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Curves question for math gurus

Hi,

I have a dynamically drawn curve. It's a simple curve, with 2 end
points,
and its yfactor will vary.

I'm trying to figure out a way to have objects "snap" to this curved
line. I
would distribute them over the _x axis, and I need a formula to get
their _y
position on the curved line.

Here is a visual explanation:
http://pages.videotron.com/poubou/flash/curve.jpg

Now, I guess this requires trigonometry... And I really am a newb when
it
comes to trig... 

Any help would be appreciated !




_______________________________________________
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
_______________________________________________
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