Skip to main content

Module solve

Module solve 

Source
Expand description

Solving a sketch: every constraint contributes residuals that are zero exactly when it holds, and crate::bfgs::minimize drives the sum of their squares to zero.

Variables. Each class of coincident points (see Sketch::point_classes) is one (x, y) pair — coincidence is not a residual at all, it removes two degrees of freedom by construction. Each arc adds its half sweep, each circle its radius.

Units. Every residual is a length: dimensionless ones (angles, parallelism) are multiplied by the sketch’s characteristic size, so no constraint kind dominates the objective just by its choice of units, and the convergence test is a single relative length.

Floating point variables, interval-scalar residuals. A sketch is design intent, not a geometric claim: the solved positions are the designer’s free choice, entering the kernel as exact inputs through crate::profile. So [bfgs::minimize] itself still walks plain f64 variables and its tolerances only decide when to stop iterating — but each residual along the way is computed as a Dual<ScalInF64>, so the sin/sqrt/PI a geometric formula can’t help but need are honestly enclosed rather than quietly rounded away. A residual that becomes genuinely undecidable (a division or square root at the edge of its domain) is treated as “this point is infeasible” — the same outcome a plain f64 computing inf/nan there would already have produced.

Structs§

SolveReport
The outcome of a solve.