.mulInverse() , .mul()question??

8 replies [Last post]
alex_j3d_2006
Offline
Joined: 2006-03-11

hi all,

I am trying to learn what mulInverse() and mul() methods do. Can any one tell me what the below code is doing??

newT3d.set(new Vector3d(-1.0, 0.0, 35));
t3dRot.rotY(-AngleOne);

shipT.lookAt(eye, center, up);

shipTRGp.setTransform(shipT);

FT3d.set(shipT);

FT3d.mulInverse(newT3d);

FT3d.mul(t3dRot);

FT3d.mul(newT3d);
FT3dTGp.setTransform(FT3d);

i am new to j3d any kind of tips/suggestions will be extremely helpful.
thank you
alex

alex_j3d_2006
Offline
Joined: 2006-03-11

thank you for the info.

i wanted to know what happenes with mulInverse method below.
FT3d.mulInverse(newT3d);

does it change the values of
newT3d.set(new Vector3d(-1.0, 0.0, 35));

to the opposite i.e x coordinate from -1.0 to 1.0
and z coordinate from 35 to -35???

messengers
Offline
Joined: 2004-04-18

>does it change the values of newT3d.set(new Vector3d(-1.0, 0.0, 35));
Correct.
The result should be -
1.0, 0.0, 0.0, 1.0
0.0, 1.0, 0.0, 0.0
0.0, 0.0, 1.0, -35.0
0.0, 0.0, 0.0, 1.0

regards

alex_j3d_2006
Offline
Joined: 2006-03-11

Hi,
thank you for the illustration, it was extremely helpful.

i wanted to know what happens with mul methods below.
For example if â€“AngleOne = 1.57 angle in radians
What is happening to FT3d.mul(t3dRot) & FT3d.mul(newT3d).

Coding:
newT3d.set(new Vector3d(-1.0, 0.0, 35));

t3dRot.rotY(-AngleOne);

shipT.lookAt(eye, center, up);

shipTRGp.setTransform(shipT);

FT3d.set(shipT);

FT3d.mulInverse(newT3d);

FT3d.mul(t3dRot);

FT3d.mul(newT3d);
FT3dTGp.setTransform(FT3d);

FT3d.mulInverse(newT3d);

messengers
Offline
Joined: 2004-04-18

This code appears to translate somewhere, rotate around a point and then translate elsewhere. It doesn`t seem to be doing anything tricky or implementing any specific algorithm that I recognise. Perhaps it will help if you reframe your question?

Learning matrix methods might look complicated, but you can pay attention to what specific translation / rotation/ scale/ reflection you want to implement to assist you to focus on the problem. For example, the order in which you multiply matrices are important. You will find a google search will throw up many tutes and examples of the strategies available to 3D programmers...

regards

alex_j3d_2006
Offline
Joined: 2006-03-11

Hi,

Thank you for the information, it has been extremely helpful.

I am reframing my previous question. Can you tell me what the code below is doing with mul() method?

Point3d eye = new Point3d(20.0, 30.0, 60.0);
Point3d center = new Point3d(0.0, 0.0, 0.0);
Vector3d up = new Vector3d(0.0, 1.0, 0.0);

ViewpointT3D.lookAt(eye, center, up);//transform3d for viewpoint
SquareT3D.setIdentity();//transform 3d for square shape
SquareT3D.mul(ViewpointT3D);
squareTG.setTransform(SquareT3D);

regards
alex

messengers
Offline
Joined: 2004-04-18

>Can you tell me what the code below is doing with mul() method?

SquareT3D is set to the value of lookAtT.

regards

alex_j3d_2006
Offline
Joined: 2006-03-11

Hi,

Thank you for the help.

I wanted to know what happens with setTransform(SquareT3D).

Is this moving the shape relative to the values of SquareT3D.

regards

messengers
Offline
Joined: 2004-04-18

>Can any one tell me what the below code is doing??

Matrix multiplication. See
http://www.gamedev.net/reference/articles/article877.asp

regards