7 Replies Latest reply on Jul 6, 2006 8:04 AM by kglad

# Multi point curve with drawing api

Hi

Is it possible to draw a curve with multiple interpolation points, similar to a spline with the drawing api. Any suggestions would be helpfull.
• ###### 1. Multi point curve with drawing api
Don't believe this is possible in MX, have to wait to get home to see for F8.

Work Around:
Use two curves and a bit of maths.
or
You may be able to find a spline class/extention on the web which will do this for you, google it.
• ###### 2. Re: Multi point curve with drawing api
yes, it is possible since flash 6. however, if you want a smooth curve you must calculate a control point (there are infinitely many that would yield a smooth bezier curve) for each pair (other than the first two which can have almost any control point) of adjacent points on your curve.

• ###### 3. Re: Multi point curve with drawing api
Hello,

This was a pain for me to figure out so I have attached the class I have created to dynamically generate circles.
• ###### 4. Re: Multi point curve with drawing api
The formula to find the control point that kglad were talking about.

// xa, ya : the point you want to draw through
// x0, y0 and x2, y2 are the end points of the curve
x1 = xa * 2 - (x0+x2) / 2;
y1 = ya * 2 - (y0+y2) / 2;
moveTo(x0, y0);
curveTo(x1, y1, x2, y2);

Romu
• ###### 5. Re: Multi point curve with drawing api
rq, that's the solution to a different problem.
• ###### 6. Re: Multi point curve with drawing api
Great thanks, This was a little harder than I first estimated.