4
\$\begingroup\$

I tried to make a circuit by starting at point A, with waypoints B and C and final target at A again, and infinite repeats. What happens is that the path from A to B, B to C is smoothed, but path C to A ends with a "sharp" edge

Sharp edge

Is there any way to make it totally smooth?

Smooth edge

\$\endgroup\$
  • 1
    \$\begingroup\$ How do you smooth B and C? Can you smooth A like B or C, just set C as start point and B as last point? Sorry, I don't know your smooth method, I can't answer it. \$\endgroup\$ – Alex Chi Apr 1 '14 at 23:52
1
\$\begingroup\$

When dealing with splines, how your interpolation works at a point is determined by the continuity of the spline at that location.

This will vary depending on the type of spline you are using but at the very least you want your incoming and outgoing tangents to have the same direction at point A.

If you make sure the tangents are also the same length at that point, then you will also have constant velocity through point A as well as a smooth direction.

Assuming you can't change the tangents manually (catmul-rom splines for example that work entirely from the positions of the points) then if you replace A with a set of points so that you have two points at the start and two points at the end all lying on the same line, then your tangents between the final point and A will have the same tangent.

Note: A and F are at the exact same position as each other. B and E lie on the same line through A/F and are some small distance apart - exaggerated in the image for effect, the distance in reality can be quite small)

C1 Continuity

\$\endgroup\$
0
\$\begingroup\$

As long as your smoothing function only relies on 3 points (this, next and prev) you can just ensure that your loop has more than 3 points for it to work seamlessly for a loop.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.