Reputation: 3165
I have a set of points and i want to draw a curve which should be approximated to original curve.
Let say ,in hawk-eye system(used in cricket) i have a set ofco-ordinates of ball during the entire flight of ball , now how can i draw such a curve going through ball's space co-ordinates and looks appromixately to original curve
one method i thought its to get a large number of points such that every two point
is very close to each other and then draw a straight light between them
Upvotes: 3
Views: 1536
Reputation: 22366
I highly recommend Catmull-Rom splines for this purpose, they are based on Hermite curves. Rather than using 2 points and 2 tangents, it uses the four adjacent data points to interpolate making it better suited/simpler for motion path upsampling.
Upvotes: 2
Reputation: 25543
Curves are almost always rendered in four steps:
Approximate or interpolate a set of points using a curve or spline algorithm. Choices may include:
Convert whichever representation you chose to a Bézier Curve: this can be achieved by a simple matrix transformation from other curve types.
Repeatedly subdivide the Bézier curve: the control points tend to approximate the curve.
Draw the control points of the subdivided curve, joined by a straight line.
If you go straight for the Bézier curve, which is probably the easiest, then there are some very simple and elegant methods of subdividing it.
Upvotes: 5