PDA

View Full Version : questions about Matrix using glm



DragonForce99
06-13-2014, 01:25 AM
hi guys! :) about matrix i have two question :dejection:
1- What is determent exactly

2- i know thi equation s if i have parent and child nodes

child's new transform = parent's transform * child's transform

but what if i have Parent's Transform and Child's New transform
how to calculat child's transform (old transform)

thank you :D

DarioCiao!
07-02-2014, 04:00 AM
hi guys! :) about matrix i have two question :dejection:
1- What is determent exactly

2- i know thi equation s if i have parent and child nodes

child's new transform = parent's transform * child's transform

but what if i have Parent's Transform and Child's New transform
how to calculat child's transform (old transform)

thank you :D

this is basic linear algebra:
if
A = B*C

then you must isolate C by pre-multypling by inverse of B
B' * A = B'*B*C
B'*A = C

to find inverse of B you must be sure that determinant is not 0. But if you know that B is a transform matrix (so Scale, Rotation and Translation only combined togheter) and you know that Scale component is different from 0 (all 3 values must be different from 0) you know determinant is different by 0 too and you can compute the inverse (many libraries that do matrix inversion)

Anyway, if you know in advance the 3 components of B

B = Translate*Rotate(Degrees,Axis)*Scale

You can easily compute the inverse without strange math

B' = (1/Scale)*Rotate(-Degrees,Axis)*(-Translate)

and finally

C = B'*A

note that if some Scale Component is 0 somewhere you can't find C because inverse of B does not exist, but that does not mean there not exist a matrix that satisfy the equation, just you can't find it easily

(Proof: assume B has a scale by (1,1,0) to flatten a 3d object and you know C
A = B *C

then you forget about C but you have A, you know that C exist because you used it before, but since B has a scale component that is 0 then you can't find C again)

what is determinat:
an "artifact", you better check some math site to learn about it, the determinant is very usefull, if greater than 0 a matrix is right-handed, if lesser than 0 a matrix is left-handed, if = 0 a matrix is not invertible