Expand description
Insert spline anchors by de Casteljau subdivision without changing the curve.
Sketch splines are chained cubic Béziers with 3n + 1 point IDs and anchors
at indices 0, 3, 6, … . Splitting P0 P1 P2 P3 at parameter t gives:
A = lerp(P0,P1,t) B = lerp(P1,P2,t) C = lerp(P2,P3,t)
D = lerp(A,B,t) E = lerp(B,C,t) S = lerp(D,E,t)The resulting polygon P0, A, D, S, E, C, P3 preserves the 3n + 1 invariant.
P0 and P3 keep their IDs; P1 and P2 are reused for A and C so their
constraints survive. Their endpoint tangent directions are unchanged. Only
D, S, and E receive new IDs.
The new anchor and its handles are collinear (S = lerp(D,E,t)), satisfying
the solver’s implicit G1 join constraint before the next solve.
Structs§
- Inserted
Anchor - The ids
insert_anchorminted: the new on-curveanchorand the two off-curve handles flanking it (beforeprecedes it in the polygon,afterfollows it). The caller decides what to hang on them — the tool draws each anchor’s handle guides.
Functions§
- insert_
anchor - Insert an anchor into the spline under the plane click
(u, v), orNonewhen the click should mean something else. Shape-preserving: the curve through the grown control polygon is the curve that was there before. - is_
spline_ type - Whether
geom_typenames a spline. Mirrors the kernel solver’sis_spline_geometry_type:"bezier"is what the tools author,"spline"is the accepted alias. Defined here rather than imported because the sketch module is deliberately kernel-free.