Speaking of the Java3D implementation for transforms, I have some questions
reguarding it. Do we have to create seperate Transform3D objects every time
we want to do transforms that dont fit into the matrix order transformations?
I worked on my own 3D scene graph in the past, and I had it function more
closely to OpenGL, instead of setting the matrix values, it would work more
like a pipeline, the first transform you do will be the last transform
applied to the object, and the last transform you do will be applied first to
the object. So basicly you end up creating a transform path that the object
will travel down and be tranformed. So far in the tutorials and other
material I have read, it seems that this does not exist in Java3D. This would
make transformations a lot easier. For example, instead of doing this from
the tutorial...
Transform3D rotate = new Transform3D();
Transform3D tempRotate = new Transform3D();
rotate.rotX(Math.PI/4.0d);
tempRotate.rotY(Math.PI/5.0d);
rotate.mul(tempRotate);
TransformGroup objRotate = new TransformGroup(rotate);
instead of that, having something working more like this...
Transform3D trans = new Transform3D();
trans.applyRotateX(Math.PI/4.0d);
trans.applyRotateY(Math.PI/5.0d);
TransformGroup objRotate = new TransformGroup(trans);
In my old code I used to go even further and break things down into
individual objects, it would probably be more equivalent to...
Transform3D trans = new Transform3D();
trans.add(new RotateXd(Math.PI/4.0d));
trans.add(new RotateYd(Math.PI/5.0d));
trans.add(new Translated( 0,0,-4));
trans.add(new Scaled(0.5));
trans.add(new Rotated(0,0.707,0.707, Math.PI/6.0d));
TransformGroup objRotate = new TransformGroup(trans);
That way I can generate a Matrix from the pathways. And as you could see, it
would first rotate the object around an vector by 1/6th PI, and then it would
scale the object in half, then it would translate the object by -4 down the
Z, then it would rotate the object around the Y axis and finally it would
rotate around the X axis.
Now given behaviors would have to work diffrently in this case as well, im
not sure the reason the engine was architected this way so I really cant say
what would be the best way to apply this kind of control. Another possibility
I could imagine, is to have a Rotate Translate Scale classes that inherit
from Transform3D class, and have TransformGroup able to have more then one
Transform3D class in it, or even lower then that, have those classes inherit
from TransformGroup class, so you can directly apply a behavior to it.
But reguardless of how its done, having the user have to deal with matrix
mulitiplications is not exactly the best design if its required to do certain
operations, for the most part the end user would have to know what the
multiplication means (which rotation is applied to the object first, for
example), which is itself a little more complicated and requires the
developer to know about matrix math and to know how Java3D uses matrix math.
If anything I have some code from my own 3D engines that shows how to apply
these transformations to a matrix, if you are interested email me.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".