comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » rot and poly_2d question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
rot and poly_2d question [message #91651] Mon, 10 August 2015 09:52
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
Hi,
I've been using rot() since ages and I would like to understand the use of this function a bit more.
Rot uses poly_2d to rotate images. To do that, the 2 times 4 coefficients of the equations are calculated:

x' = P0 + P1*x + P2*y + P3*x*y
y' = Q0 + Q1*x + Q2*y + Q3*x*y

In the case of rot(), the coefficients are quite complicated. I have expressed them using LaTex here: http://idl.marchetto.de/rot-transformation-coeffiecients/

I now come to the question... how were these coefficients calculated in the first place? I would have expected them to be something like this:

x' = translationX + M*cos(theta)*x - M*sin(theta)*y + 0*x*y
y' = translationY + M*sin(theta)*x + M*cos(theta)*y + 0*x*y

[I omitted here the magnification for simplicity]

Can someone who understands the math explain me why the two are different?

Seeing it from another point of view, given an affine transformation matrix as a result of translation+scaling+rot matrix (T*S*R):
| M*cos(theta) -M*sin(theta) 0 |
| M*sin(theta) M*cos(theta) 0 |
| tr_x tr_y 1 |

where tr_x and tr_y are:

tr_x = tx M cos(theta) + ty M sin(theta)
tr_y = -tx M sin(theta) + ty M cos(theta)

(the matrix is also shown in the link)

How can I relate the above matrix to the equations for x' and y'?

Since an explanation is tooooo long, I would really be happy if you could point me to some good resource (internet or book) to grasp these things a bit better.

Thanks,
Helder

PS: I know of polywarp, but that is rather to determine coefficients when these cannot be calculated (here they should be pretty simple/straight forward).
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: write more efficient for loop
Next Topic: Calling C++ inside IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:14:45 PDT 2025

Total time taken to generate the page: 0.00390 seconds