xith 3D ROTATION

HI ALL
I AM NEW TO XITH.SO CANT CULTIVATE THE IDEAS AND I NEED UR HELP.

IN MY SCENE GRAPH I WANT TO ROTATE MY OBJECT AROUND ARBITRARY AXIS. FOR THAT AXIS I HAVE A POINT AND VECTOR GIVING THE DIRECTION. SO CAN ANY 1 TELL HOW TO IMPLEMNT AN AXIS USING VECTOR AND POINT AND SECONDLY HOW TO IMPLEMT ROTATION ABOUT ANY ARBITRARY AXIS.

BASICALLY I WANT TO MAKE MY OWN ROTATION CLASS TO WHICH I WIL PASS TG AND POINT AND VECTOR AND IT SHOULD ROTATE ALONG IT.

REGARDS
ROSE

hi, Rosemary

Welcome to the board.

A rotation around an arbitrary axis is done by


Vecfor3f axis = new Vector3f(a, b, c);
float angle = 0.2 * Math.PI;
Transform3D t3d = new Transform3D();
t3d.rotAxis(axis, angle);
tg.setTransform(t3d); // Where tg is your TransformGroup

But rotation around an arbitrary straight line is not manifested in any method. I also couldn’t find a formula on wikipedia. But if I should develop an algorithm on my own, I would go the following way:

m1 =
m2 =
rotMax = m1 * m2 (in that order)

Do the multiplication by hand and with no constants but variables. Take rotMat as your rotation matrix about an arbitrary straight line.

Qudus

PS: Please don’t use only upper case.

First if your Caps Lock key isn’t jammed there’s no reason to write in Capital letters the people on this forum usually reads what they can and answer to what they know.

Please be more precise about your problem. Why are you defining an axis using a vector and a point ? Do you mean you want to know X, Y, Z angle between a line and the origin so you can rotate your object by the same angle ?

You could just use AxisAngle4f :


Vector3f vec;
Point3f p;
Vector3f dir = new Vector3f();
dir.sub(p, vec);
AxisAngle4f angle = new AxisAngle4f(dir.length(), dir.x, dir.y, dir.z);

Not sure if it works…

[quote="<MagicSpark.org [ BlueSky ]>,post:3,topic:27642"]
Please be more precise about your problem. Why are you defining an axis using a vector and a point ? Do you mean you want to know X, Y, Z angle between a line and the origin so you can rotate your object by the same angle ?
[/quote]
I think, she just wants to rotate about a straight line but not about a vector. A vector only would define a straight line intersecting the center of the object to rotate in that context. A straight line would intersect the given point.

I think, she just wants to rotate about a straight line but not about a vector. A vector only would define a straight line intersecting the center of the object to rotate in that context. A straight line would intersect the given point.
[/quote]
Ahhhhhhhh ok.