Create the buffers of a spine of count points and the in-place compiler
of its curve, tangent and rotation-minimizing frames.
update builds the centripetal Catmull-Rom spline through the points
(Yuksel, Schaefer and Keyser 2011, Computer-Aided Design 43(7):747-755),
continued straight beyond its ends through phantom points reflected from
the second and second-last points. Each segment is stored in its cubic
Hermite form, its end derivatives the spline's knot tangents
(P_k - P_k-1) / d_k-1 - (P_k+1 - P_k-1) / (d_k-1 + d_k) + (P_k+1 - P_k) / d_k
over the centripetal spacings d scaled by the segment's spacing, so
positions and tangents are closed forms. A declared end tangent replaces
the first or last derivative's direction and keeps its length. Within a
segment the parameter runs linearly from its start point's chord-length
share to its end point's. With frames, update then transports the first
axis, normal made perpendicular to the first tangent, by the double
reflection method of Wang, Juttler, Zheng and Liu (2008, ACM Trans. Graph.
27(1):2), 64 steps per segment, each reflecting across the bisector plane
of the step's chord and then across the plane mapping the reflected tangent
onto the next; a frame between two table entries reflects once more from
the entry below.
Error when count is below two; and from update when a point, the normal or an end tangent is not finite, two consecutive points coincide, the path reverses at a point, the normal is parallel to the first tangent, or the tangent vanishes somewhere on the path.
Create the buffers of a spine of
countpoints and the in-place compiler of its curve, tangent and rotation-minimizing frames.updatebuilds the centripetal Catmull-Rom spline through the points (Yuksel, Schaefer and Keyser 2011, Computer-Aided Design 43(7):747-755), continued straight beyond its ends through phantom points reflected from the second and second-last points. Each segment is stored in its cubic Hermite form, its end derivatives the spline's knot tangents(P_k - P_k-1) / d_k-1 - (P_k+1 - P_k-1) / (d_k-1 + d_k) + (P_k+1 - P_k) / d_kover the centripetal spacingsdscaled by the segment's spacing, so positions and tangents are closed forms. A declared end tangent replaces the first or last derivative's direction and keeps its length. Within a segment the parameter runs linearly from its start point's chord-length share to its end point's. With frames,updatethen transports the first axis,normalmade perpendicular to the first tangent, by the double reflection method of Wang, Juttler, Zheng and Liu (2008, ACM Trans. Graph. 27(1):2), 64 steps per segment, each reflecting across the bisector plane of the step's chord and then across the plane mapping the reflected tangent onto the next; a frame between two table entries reflects once more from the entry below.