This discussion is archived
3 Replies Latest reply: Jan 31, 2013 5:40 PM by 851442 RSS

Bizzare java3D Matrix situation check

851442 Newbie
Currently Being Moderated
/*
As I understand, column with 0 at the bottom defines the above column
is an axis vector

The digits in the right most column represent the streches, or the same, result,
except the lower right hand cell, which I believe has to be the same as the rest
of the lowest row.

Correct?
*/

Matrix4d initial = new Matrix4d(1,0,0,1, 0,1,0,1, 0,0,1,1, 0,0,0,0);

Matrix4d result = new Matrix4d();

System.out.println("Initial targest Matrix:");

System.out.println(initial);

System.out.println();

Transform3D transform = new Transform3D(initial);

Double degrees = new Double(45);

Double radians = new Double(degrees*Math.PI/180);

System.out.println("Angle: " + degrees + " degrees");

AxisAngle4d axisAngleRotate = new AxisAngle4d(1,1,1,radians); //must be equivalent to the Matrix contents.

System.out.println(axisAngleRotate);

System.out.println();

transform.setRotation(axisAngleRotate);
     
transform.get(result);

System.out.println("Forward Rotation results:");
     
System.out.println(result);
          
System.out.println();
     
     //-------------------------------------------------------------------

/*
     
     It only setRotation() only overwrites the matrix with the updates
     trigonometry values for the rotation matrix. It thus becomes the multipler
     itself.
     
*/

Edited by: Zachary1234 on Jan 30, 2013 5:50 PM
  • 1. Re: Bizzare java3D Matrix situation check
    DrClap Expert
    Currently Being Moderated
    Perhaps you could start by explaining

    (1) What you think that program does

    (2) What the program actually does

    (3) How the result differs from your expectation
  • 2. Re: Bizzare java3D Matrix situation check
    851442 Newbie
    Currently Being Moderated
    The initial matrix is a 4x4 matrix, which contains a 3x3 matrix to the upper left, being the unit vectors in the positive direction on the cartesin 3D plane.
    Under each vector is the digit 0, denoting vectors. I have left the result column, the final 4th column, as straight zero's, which should denote no transformation of the enclosed vector.

    setRotation only OVERWRITES the matrix with the trigonometry for the rotation matrix. It doesn't take the previous matrix as functional values.

    My code actually works as expected.

    Is there anyone out there who can give me the full details about the formatted meaning of the Matrix4d which initialises Transform3D?

    Edited by: Zachary1234 on Jan 30, 2013 5:41 PM
  • 3. Re: Bizzare java3D Matrix situation check
    851442 Newbie
    Currently Being Moderated
    The answer lies in the nature of what a Rotation Matrix is, and what it never is.

    by going Matrix4d.setRotation(AxisAngle),

    You are altering your initial matrix, being a list of vectors, and putting in their place a correct set of multiplers.
    the result matrix, when multipled by a co dimensional vector, will rotate that later vector's components
    by each value correctly to effect the right angular rotation.

    However, the secondary matrix is by no means a vector, just the correct multipler value arrangement.

    You cannot act to go setRotation(AxisAngle) again, you can only operate on the original Matrix, list of vectors.

    So all is well in this little subspace, in fact, of javaland.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points