从3点生成的AffineTransform [英] Generate AffineTransform from 3 points

查看:355
本文介绍了从3点生成的AffineTransform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于3点(x和y坐标)的坐标系统,并在坐标系B 3的对应点,我怎么能得到的AffineTransform会从A转换到B

Given 3 points (x and y coordinates) in coordinate system A, and 3 corresponding points in coordinate system B, how can I derive an AffineTransform that will convert from A to B.

我的问题是类似<一个href=\"http://stackoverflow.com/questions/14015456/create-transform-to-map-from-one-rectangle-to-another\">Create变换映射从一个矩形到另一个,但问题只有2个点优惠 - ?即,它假定没有转动

My question is similar to Create transform to map from one rectangle to another?, except that question only deals with 2 points - i.e., it assumes there is no rotation.

推荐答案

假设你的变换形式

x' = px + qy + r
y' = sx + ty + u

和写你的六个点为(A1X,A1Y),(A2X,A2Y),(A3X,A3y),(B1X,B1y),(B2X,B2Y),(B3X,B3y) 。防爆pressing这种以矩阵形式给出了

and write your six points as (A1x, A1y), (A2x, A2y), (A3x, A3y), (B1x, B1y), (B2x, B2y), (B3x, B3y). Expressing this in matrix form gives

/               \       /           \   /               \
| B1x  B2x  B3x |       | p   q   r |   | A1x  A2x  A3x |
|               |   =   |           |   |               |
| B1y  B2y  B3y |       | s   t   u |   | A1y  A2y  A3y |
\               /       \           /   |               |
                                        |  1    1    1  |
                                        \               /

现在找到在右侧的3×3矩阵的逆。你会在网上找到大量的算法告诉你如何做到这一点。还有一个在的http://www.econ.umn.edu/undergrad/math/An%20Algorithm%20for%20Finding%20the%20Inverse.pdf,例如。

Now find the inverse of the 3x3 matrix on the right. You'll find plenty of algorithms online telling you how to do this. There's one at http://www.econ.umn.edu/undergrad/math/An%20Algorithm%20for%20Finding%20the%20Inverse.pdf, for example.

后乘等式两边以上,要获得 P,Q,R,S,T,U,V 。

Post-multiply both sides of the equation above by the inverse of the 3x3 matrix, to get the values of p, q, r, s, t, u, v.

这篇关于从3点生成的AffineTransform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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