How can I make sure that a line and spline join smoothly (C2 continuity)?

200 Views Asked by At

I have a sequence of geometric items that I need to join smoothly to create a smooth path. When points are far enough apart, they will be joined by a straight line. When they are too close together, the number of close points are joined by an interpolating cubic B-spline. How can I design the Bspline so that the joining point between a straight line and Bspline is C2 continous? I will be using the algorithm A9.2 SolveTridiagonal from The NURBS Book to generate the cubic interpolating spline. This algorithm depends on setting the first derivatives at the endpoints. I could easily set the first derivatives at the endpoints to have equal directions as the straight lines, but is this enough to guarantee what I want? Or do I need a specific magnitude for these derivatives?