Matrices, Transforms, and JME3

A transform is a location and rotation. Its used because in a hierarchical system both influence another.

@jagwire said: @pspeed this is fantastic! With your permission, I'd like to use this in development of some instructional materials for co-workers. I'd also encourage this be saved/published in the JME3 mathematics documentation...even if just for background information.

Yeah, that’s fine.

@jagwire said: To continue the discussion one step further, we have this transform matrix, and JME3 spatials have a Transform object including a vector3f for translation, a quaternion for rotation, and a vector3f for scale.

How do we convert from one to the other?

Is there a utility class to interpret a transform matrix into a Transform object and vice-versa?

http://hub.jmonkeyengine.org/javadoc/com/jme3/math/Matrix4f.html#setTransform(com.jme3.math.Vector3f,%20com.jme3.math.Vector3f,%20com.jme3.math.Matrix3f)

Going the other direction (from Matrix4f to Transform) is a little trickier. On the surface if seems not so bad but if you must take scaling into account then it gets trickier. I think if you were to grab the 3x3 rotation matrix from the Matrix4f that you could deduce scale from it. But I haven’t tried it.

@jagwire - If you do it as a wiki page everyone benefits :slight_smile: