Package au.edu.unsw.cse
Class Quaternion
java.lang.Object
au.edu.unsw.cse.Quaternion
public class Quaternion
extends java.lang.Object
A quaternion. Really handy for representing a 3D rotation.
-
Constructor Summary
Constructors Constructor Description Quaternion(double x, double y, double z, double w)Create the quaternion ix+jy+kz+wQuaternion(Point3d axis, double theta)Create a unit quaternion that represents the rotation about axis by theta -
Method Summary
Modifier and Type Method Description Quaternionadd(Quaternion x)Quaternionconjugate()static QuaternionfromRotMatrix(Point3d u, Point3d v, Point3d w)construct Quaternion from a rotation matrix expressed as a triple of vectors, each one a row of the matrix.Quaternioninverse()static voidmain(java.lang.String[] arg)Quaternionmultiply(Quaternion x)doublenorm()Quaternionscale(double x)java.lang.StringtoString()java.lang.StringtoVRML()Convert to VRML representation: axis + rotation angleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
Quaternion
public Quaternion(double x, double y, double z, double w)Create the quaternion ix+jy+kz+w -
Quaternion
Create a unit quaternion that represents the rotation about axis by theta
-
-
Method Details
-
add
-
multiply
-
scale
-
conjugate
-
norm
public double norm() -
inverse
-
fromRotMatrix
construct Quaternion from a rotation matrix expressed as a triple of vectors, each one a row of the matrix. Code adapted from Shoemake's paper "Quaternions". -
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
toVRML
public java.lang.String toVRML()Convert to VRML representation: axis + rotation angle -
main
public static void main(java.lang.String[] arg)
-