Login  Register

Re: Confusion about any changes to the Transform3d Matrix4f or Matrifx4D.

Posted by philjord on Aug 18, 2017; 2:32am
URL: https://forum.jogamp.org/Confusion-about-any-changes-to-the-Transform3d-Matrix4f-or-Matrifx4D-tp4038140p4038152.html

no problem

Code:
Matrix4f m = new Matrix4f();
         
Transform3D t = new Transform3D();
t.setTranslation(new Vector3f(0,10,0));
t.get(m);
System.out.println("translated matrix = \n" + m);
   
Transform3D t2 = new Transform3D();
t2.setRotation(new AxisAngle4f(new Vector3f(1,0,0), (float)Math.PI));    
t2.get(m);
System.out.println("rotated matrix = \n" + m);
   
t2.mul(t);        
t2.get(m);
System.out.println("multiplied together = \n" + m);

Gives output:
translated matrix =
1.0, 0.0, 0.0, 0.0
0.0, 1.0, 0.0, 10.0
0.0, 0.0, 1.0, 0.0
0.0, 0.0, 0.0, 1.0

rotated matrix =
1.0, 0.0, 0.0, 0.0
0.0, -1.0, 8.742278E-8, 0.0
0.0, -8.742278E-8, -1.0, 0.0
0.0, 0.0, 0.0, 1.0

multiplied together =
1.0, 0.0, 0.0, 0.0
0.0, -1.0, 8.742278E-8, -10.0
0.0, -8.742278E-8, -1.0, -8.742278E-7
0.0, 0.0, 0.0, 1.0


3x3 rotation matrix is upper left of the 4x4 matrix.