|
KiCad PCB EDA Suite
|
This is a relatively straight-forward implementation of the ITEM_REALIGNER_BASE that should handle most practical cases. More...
#include <item_realignment.h>
Public Member Functions | |
| std::optional< TRANSFORM > | GetTransform (const std::vector< VECTOR2I > &aPtsA, const std::vector< VECTOR2I > &aPtsB) const override |
| Compute the best fit transform to align the two sets of points. | |
This is a relatively straight-forward implementation of the ITEM_REALIGNER_BASE that should handle most practical cases.
Basically, it computes a baseline between two matching points. This gives the approximate rotation, which is then snapped to a multiple of 90 degrees. After rotation, the translation is computed by a best fit between the two sets of points.
By constraining the baseline rotation to 90 degree increments, this avoids various ways the result gets numerically strange. For example if one baseline pad is adjusted by a small amount, even if the footprint isn't rotated, the baseline may shift by a small angle. This doesn't mean we should rotate the footprint.
Definition at line 79 of file item_realignment.h.
|
overridevirtual |
Compute the best fit transform to align the two sets of points.
The point lists have to be the same length.
| aPtsA | The "old" points |
| aPtsB | The "new" points |
Implements ITEM_REALIGNER_BASE.
Definition at line 45 of file item_realignment.cpp.
References epsilon, VECTOR2< T >::EuclideanNorm(), RotatePoint(), and Snap90Degrees().
Referenced by ComputeFootprintShift().