Finding control points for bezier curve
Hi stackoverflow's users !
First i want to say its my first post and i've been diging straight up gold from this site and i love it and everyone o开发者_JAVA百科ut there smart enough to give out solutions.
So basically am writing a game and i have bezier curve that controls where an actor moves. Am using only 3 points (start, control1, end) and everything is fine.
Now i want to create a bezier curve that passes through a certain point (r1) at t = 0.5 . The problem being that i have my start point, my end point and my point (r1) at t=0.5, and i need to find the control point.
Sorry if i explained it badly i hope everyone can understand.
Thank you for any replies : )
Look into the documentation of Asymptote
(here) which has a geometrical interpretation of the a spline. For the mid point (t=-.5) the point lies in the point m_5 below. If you are using one control point them c_0 and c_1 are coincident simplifying the math. If at (t=0.5) your y values is y_c
and the beginning and ending values are respectively z_0
and z_1
then the control point is at
c = (8*y_c-z_0-z_1)/6
Do the same for the x
values.
Check out the question I asked a couple of days ago: Given f(x) linear function, how to obtain a Quadratic Bezier control point. I think it's exactly what you need.
精彩评论