user745739
user745739

Reputation: 21

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 out 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 : )

Upvotes: 2

Views: 3706

Answers (2)

Alan Rynne
Alan Rynne

Reputation: 77

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.

Upvotes: 0

John Alexiou
John Alexiou

Reputation: 29274

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.

enter image description here

Upvotes: 3

Related Questions