Hi, I am simulating a trajectory of an object using java3d. And i am trying to give Quaternion values for each points so that when the object is at the respective coordinates its rotated givin a realistic view of the trajectory. But i am not comfortable with how to use the quaternions. If anyone could help me with knowing more about quaternions usage and values getting assigned to quaternions that would be great.
thanks, ram --- "Nitin.Jain" <[EMAIL PROTECTED]> wrote: > Hi, > > I have a plane defined by four points which is > normal to x-axis. I have a > line defined by two arbitrary points, eg. (x1,y1,z1) > and (x2,y2,z2) now, I > want to transform the plane in such a way that it > becomes normal to the new > line and is positioned at the first point of the > line. > > Can the lookAt method of Transform3D be used for > this. > > The code I'm using for rotation and translation is > given below: > > Thanks for the help, > nitin > > /****** > > //points on plane > Point3f vertex1 = new > Point3f(0,-theWidth/2,theThickness/2); > Point3f vertex2 = new > Point3f(0,-theWidth/2,-theThickness /2); > Point3f vertex3 = new > Point3f(0,theWidth/2,-theThickness/2); > Point3f vertex4 = new > Point3f(0,theWidth/2,theThickness/2); > > > Vector3f line = new Vector3f(x2-x1, y2-y1,z2 - > z1); > line.normalize(); > > Transform3D aTransForm3dRotateY = new > Transform3D(); > Transform3D aTransForm3dRotateZ = new > Transform3D(); > > //trying to find the angle direction > double SignFactorY = line.y/Math.abs(line.y ); > double SignFactorX = line.x/Math.abs(line.x ); > > //Rotation along Y-axis is equal to the angle formed > be the line with the > z-axis > aTransForm3dRotateY.rotY(SignFactorX*Math.acos(line.z)); > > //Rotation along Z-axis is equal to the angle formed > be the line with the > x-axis > aTransForm3dRotateZ.rotZ(SignFactorY * > Math.acos(line.x)); > > aTransForm3dRotateY.mul(aTransForm3dRotateY,aTransForm3dRotateZ); > > > Transform3D aTransForm3dTranslate = new > Transform3D(); > aTransForm3dTranslate.setTranslation(new > Vector3f(x1,y1,z1) ); > > aTransForm3dRotateY.transform(vertex1); > aTransForm3dRotateY.transform(vertex2); > aTransForm3dRotateY.transform(vertex3); > aTransForm3dRotateY.transform(vertex4); > > aTransForm3dTranslate.transform(vertex1); > aTransForm3dTranslate.transform(vertex2); > aTransForm3dTranslate.transform(vertex3); > aTransForm3dTranslate.transform(vertex4); > > *********/ > > =========================================================================== > 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". __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 =========================================================================== 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".
