> From: Shawn Kendall <[EMAIL PROTECTED]>
>
> To set translation in a TransfromGroup I'm using:
>
> myVector3f.x = newValueX;
> myVector3f.y = newValueY;
> myVector3f.z = newValueZ;
> myTransform3D.setTranslation( myVector3f );
> myTransformGroup.setTransform( myTransform3D );
>
> But this copies the entire Transform3d matrix ( 16 values! ) plus
> copying the Vector3f as well.
> Is there a more efficient way to set these values?
> Can I get handles to the matrix stored in TransformGroup?
> Thanks for any help
Nope.
The interface is designed so that changes to the transform have to go through
the setTransform() method so that J3D knows that the state has changes and can
update its internal state. If you could change the value "directly" there
would be all kinds of bad side effects. Look at OpenGL (or any other
industrial strength API), they all have the same kind of interface.
As it turns out, copying the data is a very small inefficency. If you look a
the performance traces for an application doing lots of animations (where many
transforms are changing rapidly) the setTransform() method won't be anywhere
near the top of the list.
On the other hand, if you create a new Vector3f and Transform3D for each
interation of your animation, you'll leak mempory which will lead to excessive
garbage collection and noticable pauses in your animation.
Doug Gehringer
Sun Microsystems
=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/