Re: Affine and Transposed Matrices
From: Michel Walsh (vanderghast_at_VirusAreFunnierThanSpam)
Date: 10/22/04
- Next message: iloseall: "How to use fixed function pipeline in effect file (.fx)??"
- Previous message: Peter Racz: "Re: Animationset"
- In reply to: Jacky Luk: "Affine and Transposed Matrices"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 22 Oct 2004 09:03:40 -0400
Hi,
When there are too much information, it is like there is none.
A matrix is a tableau of numbers. Being said that, it is like if I tell
you a number is represented by bit, in a computer. You don't need to
understand how the bits are disposed, internally, in a floating point number
to ask for a multiplication.
An affine matrix can represent, among other things, a translation, a
reflection, a rotation, a scaling, a shearing. The matrix is the
"representation", and what is really important is the operation to be
performed. A little bit as you have to make the difference between + and *,
and when using one instead of the other, the goal is to use the "methods"
that will perform the desired "operation". If that method returns a matrix
of a whatever is internal working and, in an OOP environment, technically,
that can be "hidden". DirectX allows you to move an object with method
regrouped under the "library" Matrix. As example, Matrix.Translation( x, y,
z) will have, for effect, to eventually move (translation) an object.
Matrix.RotationX, and so on, are other "operators".
To move a mesh object, or an object stored in a vertex buffer, but where
this object is "centered" at (0, 0, 0), and you want to move its center at
(x1, y1, z1), you "speak" to DirectX with a "language" that looks like (C#)
:
device.Transform.World = Matrix.Translation( x1, y1, z1);
If, further, after the translation, you need to rotate it by 10 degree,
around the Y axis, the language to use is like:
float angle =(float)Math.Sin( 10.0*Math.PI /180.0);
device.Transform.World = Matrix.Translation( x1, y1, z1) *
Matrix.RotationY( angle );
( the argument of the Sin( ) must be in radians, not in degree ).
If you had just used the Matrix.RotationY, you would have got only this, a
rotation. Since we want a translation and THEN a rotation, the "way" to "say
it" to DirectX is through a multiplication.
Like 3 to the power of 2 is not the same as 2 to the power of 3, a times b
is not the same as b times a, for "matrixes". It is important to get the
ordering right. In A * B * C, read it as A is performed first, then B, then
C. If you just use translations, that is not a real problem, but the
difference in the order may become visible if you mix the translations with
rotations, scaling, etc.
Do you really need to know the IEEE format of floats to use multiplication?
It may help, it is not a wrong thing to know the IEEE format, but I doubt it
is essential.
Hoping it may help,
Vanderghast, Access MVP
"Jacky Luk" <jl@knight.com> wrote in message
news:OtvyuYntEHA.444@TK2MSFTNGP10.phx.gbl...
>I am sure this is the most suitable group to post, But as i found no
> mathematics groups elsewhere, i hope this one won't be too much annoying.
>
> I am looking for the definitions of affine matrices and transposed
> matrices, what do they mean? What are their applications in Direct3D?
> Could
> someone raise some examples?
> Thanks
> Jack
>
>
- Next message: iloseall: "How to use fixed function pipeline in effect file (.fx)??"
- Previous message: Peter Racz: "Re: Animationset"
- In reply to: Jacky Luk: "Affine and Transposed Matrices"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|