Hi there folks,
Firstly thank You. You do a great job in these forums.
Problem ilustrated
http://www.flashprojects.sk/4others/bezier_2nd_cp.swf
Where will this be used
There is this animation, where there is an object drawn using AS2.0 API on the stage, mainly using bezier curves [curveTo() method].
Now when user drags certain parts of the application, this object starts inflating like a baloon - in this case it means that the borders of the object, which look initially like lines (straight; but are bezier curves with 3 control points) start to change the position of their second control point (that’s the one which the curve “approximates” or “almost touches (but never touches)” - see point [COLOR=Red]C[/COLOR] in the ilustration).
Back to the ilustration
Since [COLOR=Green]we know[/COLOR] only the position of the point [COLOR=Green]A [/COLOR]and [COLOR=Green]B[/COLOR], and position of [COLOR=Red]C** will change**[/COLOR] according to the [COLOR=Green]h[/COLOR] parameter (which we also know - see the drawing), we need to get the equation to count the coordinates of the point C.
That’s what You can help with.
Ah and actually… here is the whipped cream of the cake we are looking for:
http://www.actionscript.org/resources/articles/172/1/Understanding-curves-and-control-point-placement/Page1.html
[COLOR=Gray]in short:
1. Find the slope at the beginning and end points of the curve, using geometry or calculus
2. From the slopes, determine the equations of the tangent curves
3. Determine the intersection of the tangent curves in a single coordinate (x or y)
4. Use the equation of one of the tangents to find the location of the control point in the other coordinate[/COLOR]
But if You deliver the cookie whole, You’ll help the huge stone from my heart to fall…
thanks for Your time i expect somebody just has the body of the drawCurve function ready, and makes a copy+paste here