When you drag a line in a parametric sketch, you're not just moving geometry — you're asking a solver to find a new arrangement of every point, line and arc that still satisfies every constraint you've placed. Coincidence, tangency, perpendicularity, dimensions: each one is an equation, and the sketch is only valid when all of them hold at once.
Sketches are equation systems
A modest sketch — say, a mounting plate with slots and filleted corners — easily produces a few hundred unknowns. Every point contributes two, every arc adds a radius, and every constraint removes degrees of freedom. The solver's job is to find values for all unknowns simultaneously, many times per second while you drag.
Zenve3D uses a Newton-based numerical solver over the constraint graph. The interesting engineering isn't the math itself — it's everything around it: partitioning, caching, and failure handling.
// each constraint contributes residual equations
coincident(p1, p2) → p1.x − p2.x = 0, p1.y − p2.y = 0
distance(p1, p2, d) → |p1 − p2|² − d² = 0
tangent(line, arc) → dist(line, arc.center) − arc.r = 0
Partitioning: solve small, not big
The single biggest performance win is never solving the whole sketch. Constraints naturally cluster into islands — groups of geometry that reference each other but nothing outside the group. Before every solve, the graph is partitioned into these islands, and only the islands touched by your drag are re-solved. On typical sketches this cuts the system size by 10–50×.
Failing gracefully
Numerical solvers fail. The user adds a contradictory dimension, or drags geometry into a configuration with no valid solution. What matters is what happens next: Zenve3D keeps the last valid state, highlights the conflicting constraints, and never lets the sketch snap into a corrupted arrangement. A failed solve should feel like resistance, not breakage.
A failed solve should feel like resistance, not breakage.
What's next
The current solver handles the constraint types most mechanical sketches need. On the roadmap: symmetry chains across mirrored geometry, and a diagnostic mode that explains why a sketch is over-constrained instead of just flagging it. Both are being built in public.
