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 Quaternion
add(Quaternion x)
Quaternion
conjugate()
static Quaternion
fromRotMatrix(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.Quaternion
inverse()
static void
main(java.lang.String[] arg)
Quaternion
multiply(Quaternion x)
double
norm()
Quaternion
scale(double x)
java.lang.String
toString()
java.lang.String
toVRML()
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:
toString
in 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)
-