Re: coordinate transformation



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
.



Relevant Pages

  • Re: Locating An Image At Arbitrary Scales, Translations, and Rotations
    ... at an arbitrary scale, translation, and rotation. ... If your object really is just a rectangle, it's easy enough to find its ...
    (sci.image.processing)
  • How does RegisterAnimationOutput work?
    ... public void Direct3D.AnimationController.RegisterAnimationOutput(string name, Matrix matrix, Vector3 scale, Quaternion rotation, Vector3 translation); ... Quaternion rotation = Quaternion.Identity; ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: linearly parameterised template
    ... > translation, rotation and scale. ... highly accurate, anti-aliased bitmap transformation work. ...
    (sci.image.processing)
  • Re: transformation matrix decomposition
    ... I understand how I can compose transformation matrixes ... (translation, rotation, scale) ... Translation and shearing can be described by each single vectors. ...
    (comp.graphics.api.opengl)
  • Re: coordinate transformation
    ... three transformations and the result needs to be in x,y not polar. ... If I remember right, a translation matrix can be built, and I ... do the rotation with out the matrix calculations too. ...
    (sci.math)

Loading