PDA

View Full Version : How to construct a QTransform?



lni
24th June 2011, 10:35
Hi,

I have 3 known points, which are mapped to another 3 known points.
p1 -> p1'
p2 -> p2'
p3 -> p3'

From those 6 points, how can I construct a QTransform?

Thanks!

wysota
24th June 2011, 11:05
Are we talking 2D or 3D? And is the mapping linear or not?

lni
24th June 2011, 12:01
Are we talking 2D or 3D? And is the mapping linear or not?

It is for 2D linear mapping, but perhaps 3D may be needed later...

wysota
24th June 2011, 16:20
Then you need to solve the following equation:
ax + by + c = 0

Substituting x and y with coordinates of your three points to calculate a, b and c and then place them in the matrix. Of course x and y correspond to p1.x and p1'.x and not p1.x and p1.y. You need a similar equation for p1.y and p2.y

http://en.wikipedia.org/wiki/System_of_linear_equations
http://en.wikipedia.org/wiki/Gaussian_elimination