I’m making a map program and I’ve got rough contours with contour tracking and now I want to smooth these contours with Bezier.
I don’t know how to make the end point smooth. You know, I have to blend the start and the end to have same tangent. I found several algorithm and none of them dealt this problem.
I know this could be solved with differential but I’m not into that thing. So I hope some one could give me the crucial part an apparent code demonstration.
I’m making a map program and I’ve got rough contours with contour tracking and
Share
I don’t understand you application, but I will answer on how to match two bezier curves:
If you have two bezier curves with control points (A1,A2,..,AN-1,AN) and (B1,B2,..,BN-1,BN) and want to match the end of A with the start of B, first you have to make sure that AN=B1 (e.g by setting both to (AN+B1)/2).
To make it tangential continuous AN-1,(AN/B1),B2 have to be on a line.
The direction of the line can be found by averaging the directions of the last segment of A and the first segment of B: d = ((AN – AN-1) + (B2 – AN))/2.
In 2D:
Reposition AN-1 and B2 by finding the intersection of line(AN,d) with the lines (AN-2,AN-1) and (B2,B3) respectively.
For 3D you might need to intersect the line with a plane that is constructed from (B2,B3) and a third point found by computing the cross product of (B2-B3) and d.