查找两个形状(SVG路径)之间的仿射变换矩阵 [英] Find Affine transformation matrix between two Shapes(SVG Paths)

查看:182
本文介绍了查找两个形状(SVG路径)之间的仿射变换矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Shapes,每个都被定义为单个SVG路径。我想要找出形状A是否是形状B的仿射变换,并计算/找到仿射变换矩阵。
我目前的方法计算关闭曲线和曲线点之间的连续角度,以查找它们是否为变形形状。这适用于翻译,缩放,旋转操作。但是对剪切形状不起作用。



任何适当的数学方法都可以使用吗?

解决方案你可以找到任意三元组的非共线点P1,P2,P3和它们的翻译双胞胎P1',P2',P3'

$ 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 <-1> = P'* P <-1>



A * E = P'* P <-1>

A = P'* P <-1>

然后检查相同的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-1 = P' * P-1

A * E = P' * P-1

A = P' * P-1

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路径)之间的仿射变换矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆