public class Quaternion2
extends java.lang.Object
Constructor and Description |
---|
Quaternion2()
Default constructor
|
Quaternion2(java.lang.String myName)
Default constructor
|
Quaternion2(java.lang.String myName,
double ww,
double xx,
double yy,
double zz)
Default constructor
|
Modifier and Type | Method and Description |
---|---|
Quaternion2 |
add(Quaternion2 QUAT)
Adds two quaternions
|
double |
dotProduct(Quaternion2 QUAT5)
Finds the dot product of two quaternions
|
double |
getW()
Returns the w value of quaternion.
|
double |
getX()
Returns the x value of quaternion.
|
double |
getY()
Returns the y value of quaternion.
|
double |
getZ()
Returns the z value of quaternion.
|
Quaternion2 |
invert()
Finds the inverse (conjugate) of a quaternion
|
static void |
main(java.lang.String[] ags)
Main method for testing
|
Quaternion2 |
multiply(double NUM)
Multiplies this quaternion with a scalar
|
Quaternion2 |
multiply(Quaternion2 QUAT)
Multiplies two quaternions
|
void |
normalize()
Normalizes the quaternion
modifies the current quaternion
|
Quaternion2 |
rotate(Quaternion2 QUAT4)
Rotates a vector by quaternions
|
void |
setQuaternion2(double ww,
double xx,
double yy,
double zz)
Sets the quaternion values
|
Quaternion2 |
substract(Quaternion2 QUAT)
Substracts two quaternions
|
Quaternion2 |
toAxisAngles()
Calculates the axis angles of quaternion for drawing,
results must be used in glRotatef() by using get() functions
|
Quaternion2 |
toBody(Quaternion2 QUAT)
Converts to body coordinates
|
Quaternion2 |
toEulerAngles()
Converts a quaternion into Euler angles
Warning : This conversion is inherently ill-defined
|
float[] |
toFloat()
Converts quaternion's values into float
|
Quaternion2 |
toQuaternion2()
Calculates the quaternion value of three rotations
Current object is a 3D vector with rotation angles in quaternion form
|
java.lang.String |
toString()
Overrides the toString method
|
public Quaternion2(java.lang.String myName, double ww, double xx, double yy, double zz)
myName
- Name of the quaternionww
- w value of the quaternionxx
- x value of the quaternionyy
- y value of the quaternionzz
- z value of the quaternionpublic Quaternion2(java.lang.String myName)
myName
- Name of the quaternionpublic Quaternion2()
public void setQuaternion2(double ww, double xx, double yy, double zz)
ww
- w value of the quaternionxx
- x value of the quaternionyy
- y value of the quaternionzz
- z value of the quaternionpublic double getW()
public double getX()
public double getY()
public double getZ()
public Quaternion2 multiply(Quaternion2 QUAT)
QUAT
- second quaternionpublic Quaternion2 multiply(double NUM)
NUM
- is a scalarpublic Quaternion2 add(Quaternion2 QUAT)
QUAT
- is a quaternion to addpublic Quaternion2 substract(Quaternion2 QUAT)
QUAT
- is a quaternion to substractpublic Quaternion2 invert()
public Quaternion2 rotate(Quaternion2 QUAT4)
QUAT4
- a vector in quaternion formpublic Quaternion2 toBody(Quaternion2 QUAT)
QUAT
- a vector in quaternion form to convert to body coordinatespublic double dotProduct(Quaternion2 QUAT5)
QUAT5
- a quaternionpublic void normalize()
public Quaternion2 toAxisAngles()
public Quaternion2 toQuaternion2()
public Quaternion2 toEulerAngles()
public java.lang.String toString()
toString
in class java.lang.Object
public float[] toFloat()
public static void main(java.lang.String[] ags)