# Thread: How to construct a QTransform?

1. lni
Join Date
Dec 2006
Posts
426
Thanks
8
Thanked 18 Times in 17 Posts
Qt products
Platforms

## How to construct a QTransform?

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!

2. ## Re: How to construct a QTransform?

Are we talking 2D or 3D? And is the mapping linear or not?

3. lni
Join Date
Dec 2006
Posts
426
Thanks
8
Thanked 18 Times in 17 Posts
Qt products
Platforms

## Re: How to construct a QTransform?

Originally Posted by wysota
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...

4. ## Re: How to construct a QTransform?

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
Last edited by wysota; 24th June 2011 at 16:35.

5. ## The following user says thank you to wysota for this useful post:

lni (25th June 2011)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.