| 27/11/05 ~ 17:56 -0800 :
| Seth Willits,
| " Re: "Curves" control "
On Nov 26, 2005, at 7:59 AM, FreeFL wrote:
Hello!
Is there a way to retrieve the coordinates of
running point on a CurveShape object ?
I mean getting the y = ?(x) corresponding to the curve...
y = FX(x)
Yeah, if the curveshape is the parabolic function you put in the beginning.
But if it is a curveshape whose points are
dragged wherever... (example project to be posted
soon)
I found one answer for the Bezier curves on the
web (i dumped the url, sorry) and cleaned it a
bit.
It sounds like this (© Janis Joplin) :
dim mu,ax,ay,bx,by,cx,cy,p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y,px,py as double
dim k,maxk as integer
//end points of curve are p0 and p3, control points are p1 and p2
cx = 3 * (p1x - p0x)
cy = 3 * (p1y - p0y)
bx = 3 * (p2x -2*p1x+ p0x)
by = 3 * (p2y -2*p1y + p0y)
ax = p3x + 3*p1x - 3*p2x - p0x
ay = p3y + 3*p1y - 3*p2y - p0y
for k = maxk downto 0
mu = (k/maxk)
px = ax * mu * mu * mu + bx * mu * mu + cx * mu + p0x
Map(px) = = ay * mu * mu * mu + by * mu * mu + cy * mu + p0y
next
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|