I hate to complain, but I think 807 kilobytes of
attachments is about 700k too much!! Some of us only
have a 6 meg e-mail quota, and this took a huge chunk
of that.
Please, if you want to illustrate something like that,
post it on a webpage and provide a link in your
e-mail. Not eveyone has a high speed internet
connection.
--- "Illarramendi Amilibia, Aitor"
<[EMAIL PROTECTED]> wrote:
> Hello everybody:
>
> I'm looking how to rotate an object over it's
> own X,Y or Z axis.
>
> The idea is to rotate them without translation,
> I mean, the object must
> still in the same point.
>
> I have developed this code:
>
> public void rotateOverX(double angle)
> throws Exception
> {
> // PI factor for radians
> double factor = 180d / angle;
> // Auxiliar transform for saving the state
> before
> Transform3D theTransformBefore = new
> Transform3D();
> // Get it from the object's transform
>
> objectsTransform.getTransform(theTransformBefore);
> // In a transform I make the rotation
> Transform3D transformWithXRotation = new
> Transform3D();
> transformWithXRotation.rotX(Math.PI/factor);
> // Take the original matrix
> Matrix4d mat4D = new Matrix4d();
> theTransformBefore.get(mat4D);
> // I translate the transform to the origin
> theTransformBefore.setTranslation(new
> Vector3d(0.0,0.0,0.0));
> // I take the actual transform of the view
> Transform3D viewTransform = new Transform3D();
>
>
viewObject.getTransform().getTransform(viewTransform);
> // I translate it to the origin too
> viewTransform.setTranslation(new
> Vector3d(0.0,0.0,0.0));
> // I invert it for getting out form the objects
> transform
> viewTransform.invert();
> // I multiply it to the transform so is out
>
>
theTransformBefore.mul(viewTransform,theTransformBefore);
> // Then I add the rotation transform
>
>
theTransformBefore.mul(transformWithXRotation,theTransformBefore);
> // Then I re-invert the transform of the view
> for adding again
> viewTransform.invert();
>
>
theTransformBefore.mul(viewTransform,theTransformBefore);
> // With the Matrix4d I add again the translation
> form the origin (set it
> back at it's point)
> Vector3d translation = new
> Vector3d(mat4D.m03,mat4D.m13,mat4D.m23);
> theTransformBefore.setTranslation(translation);
> // I set it like the new transform of the object
>
> objectsTransform.setTransform(theTransformBefore);
> }
>
> I use the same for rotating over Y and Z axis only
> using rotY or rotZ
> methods.
>
> This looks like works great, but when I change the
> view location I notice
> that is not the result I wanted to see.
>
> In the first image is an scene with an object inside
> a "building". When I
> select to rotate it I display the X,Y and Z axis
> represented by a colored
> line.
>
> I want to rotate the object over this line axis.
>
> For example I rotate it 90 degrees angle in X axis
> and in the second image
> the display looks ok. The Y axis line (green one)
> now is over the floor, and
> Z axis is in the cell of my object.
>
> Over this view ( I am over the scene objects at 0=X
> , 30=y, 0=Z point and
> looking down to the scene) if I want to rotate over
> Y axis I notice that the
> rotation is being doing like in Z axis and inversely
> with Z axis rotation.
>
> If I move the view and I try again this again with X
> axis I notice that this
> is not what I intended, I want to be carelless about
> views location and that
> objects will rotate only over X, Y or Z and it's own
> centre.
>
> See over the thrid to the seventh images and look
> how has good behavior when
> I rotate in steps of 90 degrees angle in X axis in
> some view locations.
> And see in the last four ones what does in Y axis
> with same steps.
>
> Does anyone know what happens with the method above?
>
> Thanks for advance.
>
> First image
>
>
>
> Second Image
>
>
> Initial before X rotating
>
>
> First 90 degrees angle rotation in X axis (the red
> line at the left of the
> objects refers to X axis)
>
>
>
> Another 90 degrees in X axis
>
>
>
> Another 90 degrees in X axis
>
>
>
> And if rotate it another 90 degrees I come back to
> the same state that in
> the third image.
>
> But now if I rotate starting of the state of the
> third image in steps of 90
> degrees but in Y axis I can see this:
>
> First 90 degrees rotation in Y axis (the object is
> red because collides with
> floor and grid) note where are the axis-lines
>
>
>
> And I would like that object only had rotate over Y
> axis (so it couldn�t get
> under the grid and floor)
>
> I I rotate other 90 degrees over Y axis
>
>
>
> And other 90 degrees more
>
>
>
> With other 90 degrees more I logically come back to
> the initial state.
>
> Aitor Illarramendi Amilibia
>
> Ingeniero de software
> Detecci�n, Mando y Control
> <http://www.indra.es/> Indra.bmp
>
> Carretera de Loeches, 9
> 28850 - Torrej�n de Ardoz, Madrid (ESPA�A)
> Tel: +34-91-396.82.47
> Fax: +34-91-396.81.14
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
> www.indra.es <http://www.indra.es/>
>
>
>
> ATTACHMENT part 2 image/bmp name=Indra.bmp
> ATTACHMENT part 3 image/jpeg name=normalEjes.jpg
> ATTACHMENT part 4 image/jpeg name=Xrot90.jpg
> ATTACHMENT part 5 image/jpeg name=InitialX.jpg
> ATTACHMENT part 6 image/jpeg name=1X.jpg
> ATTACHMENT part 7 image/jpeg name=2X.jpg
> ATTACHMENT part 8 image/jpeg name=3X.jpg
> ATTACHMENT part 9 image/jpeg name=1Y.jpg
> ATTACHMENT part 10 image/jpeg name=2Y.jpg
> ATTACHMENT part 11 image/jpeg name=3Y.jpg
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
===========================================================================
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".