Hi Daniel,
if you want to let rotate an object around an arbitrary axis in an
arbitrary coordinate system, you have to transform the object into that
coordinate system.
Then transform it into the origin of that coordinate system and apply
rotation. You can get a transform3D consisting of all rotation information
by using an AxisAngle
and an angle. This transform3D must be multiplied to the current
transform3D of the object. If you want to navigate via mouse you can use
MouseEvent.getX(),getY() to calculate the angle from successive
mouseEvents. Or if you like to use your keyboard, use successive KeyEvents
to increase/decrease the angle. If you have done rotation, you have to
apply inverse transformations back from the origin and back to the objects
former coordinate system.
In your example:
double angle = 2 * Math.PI/360 * 5;
AxisAngle ax = new AxisAnlge4d(new Vector3d(0,1,0), angle);
Transform3D trans = new Transform3D();
trans.set(ax);
//your current transform3D
currentTransform3D.mul(trans, currentTransform3D);
currentTransformGroup.setTransform(currentTransform3D);
If you're interested only in rotations around the axis of your coordinate
system, that can be done also by rotX() rotY() rotZ() of Transform3D.
Gernot
[EMAIL PROTECTED]
http://www.janet.de
"Dvorak, Daniel J."
<[EMAIL PROTECTED] To:
[EMAIL PROTECTED]
.NASA.GOV> cc:
Sent by: Discussion list Subject: Re: [JAVA3D] Moving
the view around on a sphere
for Java 3D API
<[EMAIL PROTECTED]
COM>
27.01.00 20:12
Please respond to
Discussion list for Java
3D API
I don't understand your answer. You talk about mouse, but I'm using keys
to
manipulate the apparent yaw, pitch, roll of a vehicle.
Perhaps a side question will help: If I have an arbitrary rotation in a
Transform3D, how do I add more (say 5 deg) rotation in the WORLD y-axis?
If
I create an AxisAngle object with a 5 degree rotation about the y axis, do
I
set a Transform3D from that AxisAngle, then multiply my viewtransform by
it?
Daniel
> -----Original Message-----
> From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, January 26, 2000 12:48 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [JAVA3D] Moving the view around on a sphere
>
> hi Daniel,
>
> sure, this can be done.
> first get the vector that is perpenticular to your mouse movement.
> transform it with Transform3D of the transformGroup containing the
> viewplatform.
> get an AxisAngle of the transformed vector. get a Transform3D from this
> AxisAngle. multiply this transform from left to the Transform3D of the
> transformGroup containing the viewplatform. the angle in question can be
> retrieved from the difference of the mouse coordinates for example.
>
> gernot
> [EMAIL PROTECTED]
>
>
>
> "Dvorak, Daniel J."
> <[EMAIL PROTECTED] To:
> [EMAIL PROTECTED]
> .NASA.GOV> cc:
> Sent by: Discussion list Subject:
> [JAVA3D] Moving the view around on a sphere
> for Java 3D API
> <[EMAIL PROTECTED]
> COM>
>
>
> 25.01.00 20:10
> Please respond to
> Discussion list for Java
> 3D API
>
>
>
>
>
>
> I'm trying to write a MovementBehavior class that moves
> (translates/rotates)
> the view in a way that looks like the object is rotating instead of the
> view. I want to use keystrokes to increase and decrease the angle in
> each
> plane that the object appears to be rotated through. In reality, my view
> is
> moving around on a sphere, always pointing at (0,0,0).
>
> I've thought of using the lookAt method of Transform3D, but would still
> have
> trouble defining which direction is "up", so I'm just creating rotation
> matrices and multiplying them by my Transform matrix successively to get
> the
> final transform. My angle calculations are not quite right, so the
object
> in my view appears to translate around the screen as I "rotate" it.
>
> Is there an algorithm for manipulating a transform matrix to make the
> illusion that the object in the view is rotating through arbitrary angles
> on
> the 3 planes?
>
> Daniel
>
>
==========================================================================
> =
> 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".
>
>
==========================================================================
> =
> 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".
===========================================================================
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".
===========================================================================
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".