Fit Anything

A Demo of Levenberg-Marquardt Algorithm at Solving Non-Linear Least Squares
for an Affine Transformation Matrix
Template Draw below to fit... Transformation Matrix

The local optimizer is supplemented by a regularization term, a bound, and a multi-start strategy, for it to behave.
For simpler problems, the following simpler solution can be used to find global optima in one shot:

Fit Some Things

A Demo of Solving Linear Least Squares for an Affine Transformation Matrix
on Outlines Isotropically Resampled in PCA frame
Template Draw below to fit... Transformation Matrix
These demos are powered by a pure JavaScript implementation from scratch.
Lingdong Huang 2025