Groups | Blog | Home
all groups > flash actionscript > may 2005 >

flash actionscript : quadratic curves


Jeckyl
5/3/2005 12:00:00 AM
its fairly easy to convert quadratic into cubic (every quadratic is also
cubic) .. going the other way is quite tricky (you need several quadratics
to approximate a cubic).

from the SWF SDF docs:

[quoted text, click to view]
Converting between Quadratic and Cubic Bezier curves.

Simply replace the single off-curve control point of the Quadratic Bezier
curve with two new off-curve control points for the Cubic Bezier curve.
Place each new off-curve control point along the line between one of the
on-curve anchor points and the original off-curve control point. The new
off-curve control points should be 2/3 of the way from the on-curve anchor
point to the original off-curve control point.
[quoted text, click to view]
--
Jeckyl

Jeckyl
5/3/2005 12:00:00 AM
So ...

if your end points are x1,y1 and x2,y2, and your control point is xc,yc,
then for your cubic, the first control point will be

(2*xc+x1)/3,(2*yc+y1)/3

and second will be

(2*xc+x2)/3,(2*yc+y2)/3
--
Jeckyl

hosey
5/3/2005 3:36:22 PM
In brief: I wrote a flash program so I can draw a curved line.
the end result is a quadratic curve with three points. I need to create
a jpeg based on those 3 points using c# .net. But c# doesnt have
quadratic. it uses cubic belzier. Any ideas?

Thanks
hosey


hosey
5/3/2005 3:48:02 PM
Wow, fast response. I guess I will have to wrap my head around that. I
knew it had to be easy but couldnt find the info.
Thanks
Hosey

[quoted text, click to view]
hosey
5/3/2005 4:14:45 PM
Well, that saved me allot of brain farting. Wish I would have posted
Friday.

Thanks
hosey

[quoted text, click to view]
AddThis Social Bookmark Button