A deep dive into building a CAD constraint solver using Haskell. The post walks through representing equations with automatic differentiation, implementing gradient descent with backtracking line search, and combining multiple constraints via sum-of-squares cost functions. The solver handles overconstrained systems by iteratively dropping unsatisfied constraints. Interactive visualizations are powered by Haskell compiled to JavaScript via Haste and rendered with D3.js.
Table of contents
MotivationRepresenting equationsGradient descentSolving systems of equationsConstraint solvingAbout the visualizationsSort: