Expand description
Typed sketch JSON shared with the 2D constraint solver.
Documents contain points, geometries, constraints, and optional diagnostics. Flattened serde fields preserve unmodeled geometry and constraint data across load/save, including solver bookkeeping.
Structs§
- Sketch
Constraint - A sketch constraint. The solver mutates constraints with a large amount of
bookkeeping (
status,error,previousPointValues,_previousSolveValue, the_distance*slide state, …) that must persist between solves EXACTLY, so the whole object is kept as a transparent map rather than a lossy typed struct. Typed accessors (ctype,points) read the fields this slice needs. - Sketch
Diagnostics - The solver’s read-only constraint diagnostics: degrees of freedom, over/under
status, and per-point / per-geometry mobility (movable vs locked) derived from
the constraint-Jacobian null space. Keys in the mobility maps are
id_keystrings. - Sketch
Doc - The editable sketch document — a typed mirror of the solver’s
{points, geometries, constraints}. Unknown top-level keys (e.g. the solved output’sdiagnostics) are ignored on load;crate::sketch::solvepulls diagnostics out intoSketchDiagnosticsseparately. - Sketch
Geometry - A sketch geometry:
line = [p0,p1],circle = [center,radiusPoint],arc = [center,start,end](CCW start→end),ellipse = [center,majEnd,minEnd],bezier = [p0,p1,p2,p3,…](every 3 ids a new cubic span). Point semantics are the ground truth from the sketch feature’s edge builder. - Sketch
Point - A sketch point: a solved 2D coordinate in the plane’s
(u, v)frame, plus the three role flags the solver tracks. Emitted by the solver as exactly these six fields (solvers/sketch_solver.rssolve output).
Functions§
- id_key
- Shared solver key for sketch entity and mobility-map lookups. Canonical sketch entity key. Numeric IDs normalize integral floats and signed zero; string IDs are preserved. Other JSON values use their JSON spelling.