4
$\begingroup$

I need to write an OpenGL program to generate and display a piecewise quadratic Bézier curve that interpolates each set of data points:

$$(0.1, 0), (0, 0), (0, 5), (0.25, 5), (0.25, 0), (5, 0), (5, 5), (10, 5), (10, 0), (9.5, 0)$$

The curve should have continuous tangent directions, the tangent direction at each data point being a convex combination of the two adjacent chord directions.

I am not good at math, can anyone give me some suggestions about what formula I can use to calculate control point for Bézier curve if I have a starting point and an ending point.

Thanks in advance

  • 1
    Does "continuous tangent directions" mean G1 continuity (the tangents on both sides of the interpolated control points are colinear) or C1 continuity (the derivative is continuous)? And what other constraints do you have? E.g. are you trying to minimise some property?2011-05-31
  • 0
    Hi Peter, these are all constraints I have. I asked my teacher about tangent early this morning, and he replied "you can assume that the tangent is the same as that of a circle that interpolates the first (last) three points". I really have no idea about G1 and C1. But the curve should like http://i.stack.imgur.com/ckA9M.png , where black points are my data points and quadratic control points (red) and the curve (blue).Thanks for replying2011-05-31
  • 0
    This was cross-posted at http://gamedev.stackexchange.com/questions/12972/find-control-point-on-piecewise-quadratic-bezier-curve.2011-11-13

4 Answers 4