问题描述
我有两个Shapes,每个都被定义为单个SVG路径。我想要找出形状A是否是形状B的仿射变换,并计算/找到仿射变换矩阵。
我目前的方法计算关闭曲线和曲线点之间的连续角度,以查找它们是否为变形形状。这适用于翻译,缩放,旋转操作。但是对剪切形状不起作用。
任何适当的数学方法都可以使用吗?
$ b
A * P = P'
| x1 x2 x3 | | x1'x2'x3'|
A * | y1 y2 y3 | = | y1'y2'y3'|
| 1 1 1 | | 1 1 1 |
要计算A,需要将两个正数乘以P矩阵的逆。 b
$ b A * P * P = P'* P
A * E = P'* P
A = P'* P
然后检查相同的A适用于其他三元组的点(如果可能的话,用于随机子集或所有点)
有来评估整个点云的仿射变换,但它们更加复杂。
I have two Shapes, each defined as a single SVG Path. I want to find if Shape A is an Affine Transform of Shape B and also compute/find the Affine transform matrix.My current approach computes the consecutive Angles between off curve and on curve points to find if they are transformed shapes. This works for translate,scale,rotate operations. But does not work for sheared Shapes.
Any proper mathematical approaches are available?
You can find matrix of affine transform between any triplet of non-collinear points P1,P2,P3 and their translated twins P1',P2',P3'
A * P = P'
|x1 x2 x3| |x1' x2' x3'|
A *|y1 y2 y3| = |y1' y2' y3'|
|1 1 1 | |1 1 1 |
To calculate A, it is needed to multiply both sudes by inverse of P matrix
A * P * P = P' * P
A * E = P' * P
A = P' * P
Then check that the same A works for other triplets of points (for random subset or for all points, if possible)
There are sophisticated methods to evaluate affine transform for the whole point cloud, but they are more complex.
这篇关于查找两个形状(SVG路径)之间的仿射变换矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!