Discussion:
CoordSyst matrix
Fabio Varesano
2011-02-20 11:11:28 UTC
Permalink
Hi everybody,

does anyone knows what's inside _matrix of CoordSyst?
Looking trough the various sources, I'm not able to find any
documentation of that.

It's a 19 elements matrix.. so it shouldn't be a rotation matrix (3x3)
nor a homogeneous matrix (4x4).

What is that?


Thanks,

Fabio
Greg Ewing
2011-02-20 20:43:38 UTC
Permalink
Post by Fabio Varesano
does anyone knows what's inside _matrix of CoordSyst?
It's a 19 elements matrix.
It's a while since I delved into it, but as far as I
remember it's a standard 4x4 transformation matrix plus
three precomputed scale factors.
--
Greg
deavid
2011-02-21 10:58:35 UTC
Permalink
It contains, AFAIK:

* A coordinate System (expressed with 3 3D vectors ): (CXx, CXy,CXz),(CYx,
CYy,CYz),(CZx, CZy,CZz)
* A relative position (origin of the coordinate System) : Ox, Oy, Oz
* 4 extra numbers that may have sense for textures and cameras: W1,W2,W3,W4

This is the matrix:
- CXx, CXy, CXz, W1
- CYx, CYy, CYz, W2
- CZx, CZy, CZz, W3
- Ox,Oy,Oz, W4

The identity matrix is a matrix that doesn't change the parent:

1,0,0,0
0,1,0,0
0,0,1,0
0,0,0,1

It is a coordinate System which:
- X vector is 1,0,0 (Same as parent)
- Y vector is 0,1,0 (Same as parent)
- Z vector is 0,0,1 (Same as parent)
- Origin is in 0,0,0 (Same as parent)

I don't know much about transformation matrix, but i hope this answers your
question.
Fabio Varesano
2011-02-21 11:11:15 UTC
Permalink
Post by deavid
- CXx, CXy, CXz, W1
- CYx, CYy, CYz, W2
- CZx, CZy, CZz, W3
- Ox,Oy,Oz, W4
Thank you, but this is a 4x4=16 matrix.. while it's defined as a 19
elements matrix.

I think I understood how it works.. I did that by looking at the code
in matrix_from_quaternion() in matrix.c and comparing it to
http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm

So it seems that Grag has it right. It's a 4x4 matrix transformation
matrix ordered rows first, column later so that m[0] to m[3] is the
first column.

m[16] to m[18] are instead those scale factors which I'm not sure
about what they do.

Anyone can confirm?

Thanks,

Fabio Varesano
Pierre-Yves David
2011-02-21 11:18:54 UTC
Permalink
Post by Fabio Varesano
Post by deavid
- CXx, CXy, CXz, W1
- CYx, CYy, CYz, W2
- CZx, CZy, CZz, W3
- Ox,Oy,Oz, W4
Thank you, but this is a 4x4=16 matrix.. while it's defined as a 19
elements matrix.
I think I understood how it works.. I did that by looking at the code
in matrix_from_quaternion() in matrix.c and comparing it to
http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm
So it seems that Grag has it right. It's a 4x4 matrix transformation
matrix ordered rows first, column later so that m[0] to m[3] is the
first column.
m[16] to m[18] are instead those scale factors which I'm not sure
about what they do.
They are used to use the same model/geom for stuff of different size.
Post by Fabio Varesano
Anyone can confirm?
I do.
--
Pierre-Yves
Fabio Varesano
2011-02-21 11:26:38 UTC
Permalink
Post by Pierre-Yves David
Post by Fabio Varesano
m[16] to m[18] are instead those scale factors which I'm not sure
about what they do.
They are used to use the same model/geom for stuff of different size.
Ahh.. ok. Like in the bsp-game_skel.py on the tutorial.
Post by Pierre-Yves David
Post by Fabio Varesano
Anyone can confirm?
I do.
Thank you.


Fabio

Loading...