Transforms

Not sure if this is the right place to be posting, as it looks like there hasn't been any activity here in several weeks - but here goes…



First, an introduction… I'm in the Intelligent Robotics Group at NASA Ames Research Center and we're using jME as the foundation of our scientific visualization and real time telemetry monitoring tools. Our use of jME differs somewhat from it's primary use (games), and we were invited to participate in the architecture discussions for jME2. We've been using jME1 for scientific visualization for the past year, and I'm currently in the process of refactoring some of that code to work with jME2 and porting our Java3D-based real time monitoring visualization.



In an email discussion a few months ago, Josh had mentioned that Spatial may be changed to use a 4x4 matrix transform instead of the separate rotation, translation, and scale that it currently uses. Is this still planned? In any case, I'd like to suggest adding a Spatial.setTransform() method that allows the complete transform to be set in a single call, e.g.

foo.setTransform(poseProvider.getPose());

Whether the transform is a 4x4 or not is less important than having a single object that describes the complete transform to pass around and set on a spatial. I realize that the above call could be rearranged to

poseProvider.getPose().applyToSpatial(foo);

but that call seems somewhat nonintuitive.



There are two transform classes in the jME2 codebase (TransformQuaternion and TransformMatrix), but they don't share a common interface. A common interface for these that defines the basics (getRotation(), getTranslation(), etc) as well as a set(Transform in) that could do conversions between Transform types would be very useful. Spatial could be modified to hold a Transform reference that is initialized to a TransformQuaternion rather than the separate transform components that it currently uses.

I was a bit surprised to see that TransformMatrix doesn't have

set(Matrix4f mat);

or

Matrix4f get();



Anyway, I was just wondering what the plans are for transforms, because it'll have a big influence on how I port our Java3d code…



Cheers,

-Mark

I think a big issue is trying to get the scale portion of the transform out of the matrix in a reliable way for all 4x4 matrices, which is why we do things with rotation and scale/translation separately.  The original thought was (and still is… other things have been more pressing lately though) to move our transforms out from being separate fields in Spatial, to being a single Transform object that follows some of the newer ideas of Eberly (see his latest game engine design book.)  Theoretically, this would allow you to replace or extend that Transform object as you see fit.  Would be happy to discuss more though.

Providing access to a single transform object wouldn't be a problem (whether or not Spatial actually stores it that way). But what we should consider in this regard is to allow change notification in some way. As we already discussed quite some time ago this would allow for more efficient scene graph updates…