Re: coordinate transformation
- From: Joshua Cranmer <Pidgeot18@xxxxxxxxx>
- Date: Sat, 15 Sep 2007 15:39:39 -0400
Chris W wrote:
I need to do a simple 2D x,y coordinate transformation. I need to do three transformations and the result needs to be in x,y not polar. Two are trivial, translate the coordinates in x and y, and scale them. There will be a different scale factor for x and y. I can very easily do these with out any matrix calculations. The final translation is rotation. If I remember right, a translation matrix can be built, and I can do all three transformations using a single matrix operation. I can do the rotation with out the matrix calculations too. That is slightly more difficult, and I would prefer to do it using matrix calculations, as that seems like the more elegant solution.
The coordinates are vectors with three elements, <x*k,y*k,k>.
Translation:
[[1 0 dx]
[0 1 dy]
[0 0 1]]
Rotation (about the origin):
[[cos(t) -sin(t) 0]
[sin(t) cos(t) 0]
[ 0 0 1]]
Scaling:
[[dx 0 0]
[0 dy 0]
[0 0 1]] (x' = x*dx, y' = y*dy)
Successive operations can be applied by continually left-multiplying the current transformation matrix with the next one, e.g.:
translate, rotate, scale (in that order):
b = M_s * M_r * M_t * a
where
b is the final coordinate vector
M_s is the scaling matrix
M_r is the rotation matrix
M_t is the translation matrix
a is the original coordinate vector
.
- References:
- coordinate transformation
- From: Chris W
- coordinate transformation
- Prev by Date: Re: coordinate transformation
- Next by Date: Re: A sum of series
- Previous by thread: Re: coordinate transformation
- Next by thread: Re: coordinate transformation
- Index(es):
Relevant Pages
|
Loading