Class dnx.geom.Quaternion
All Packages Class Hierarchy This Package Previous Next Index
Class dnx.geom.Quaternion
java.lang.Object
|
+----dnx.geom.Quaternion
- public class Quaternion
- extends Object
- implements Cloneable, Copyable
Basic quaternion math package.
-
w
-
-
x
-
-
y
-
-
z
-
-
Quaternion()
- Create a quaternion initialized to zero.
-
Quaternion(float, float, float, float)
-
-
Quaternion(Quaternion)
- Create a new quaternion which is a copy of q.
-
Quaternion(Vector3, float)
- Create a new quaternion representing a 3D rotation about the origin.
-
add(Quaternion)
-
-
add(Quaternion, Quaternion)
-
-
clear()
-
-
clone()
-
-
conjugate()
- Set the quaternion to its conjugate.
-
conjugate(Quaternion)
- Set the quaternion to conjugate of q.
-
copy(Copyable)
-
-
dot(Quaternion)
- Compute the dot product of this quaternion with another; this quantity
is the cosine of the angle between two unit quaternions.
-
equals(Object)
-
-
multiply(Quaternion, Quaternion)
- Set the value to the quaternion product q1 * q2
-
negate()
-
-
normalize()
- Normalize the quaternion.
-
normalize(Quaternion)
- Set the quaternion to the normalized value of q.
-
postMultiply(Quaternion)
- Set the quaternion to the quaternion product of q and
itself.
-
preMultiply(Quaternion)
- Set the quaternion to the quaternion product of itself
and q.
-
rotation(float, float, float, float)
- Compute the unit quaternion representing the 3D rotation of angle
radians about the origin, through the axis (ax, ay, az)
(ax, ay, az) should be a unit vector.
-
rotation(Vector3, float)
- Compute the unit quaternion representing the 3D rotation of angle
radians about the origin, through axis.
-
setValue(float, float, float, float)
-
-
subtract(Quaternion)
-
-
subtract(Quaternion, Quaternion)
-
-
toAxisAngle(Vector3)
- Convert a unit quaternion to an axis-angle 3D rotation.
-
toString()
-
x
public float x
y
public float y
z
public float z
w
public float w
Quaternion
public Quaternion()
- Create a quaternion initialized to zero.
Quaternion
public Quaternion(float x,
float y,
float z,
float w)
Quaternion
public Quaternion(Quaternion q)
- Create a new quaternion which is a copy of q.
Quaternion
public Quaternion(Vector3 axis,
float angle)
- Create a new quaternion representing a 3D rotation about the origin.
clear
public void clear()
setValue
public void setValue(float x,
float y,
float z,
float w)
add
public final void add(Quaternion q)
add
public void add(Quaternion q,
Quaternion r)
subtract
public void subtract(Quaternion q)
subtract
public void subtract(Quaternion q,
Quaternion r)
multiply
public void multiply(Quaternion q1,
Quaternion q2)
- Set the value to the quaternion product q1 * q2
preMultiply
public final void preMultiply(Quaternion q)
- Set the quaternion to the quaternion product of itself
and q.
postMultiply
public final void postMultiply(Quaternion q)
- Set the quaternion to the quaternion product of q and
itself.
dot
public final float dot(Quaternion q)
- Compute the dot product of this quaternion with another; this quantity
is the cosine of the angle between two unit quaternions.
normalize
public final float normalize()
- Normalize the quaternion. The value returned is the magnitude
of the quaternion before normalization.
@exception NormalizationException if the quaternion is zero.
normalize
public final float normalize(Quaternion q)
- Set the quaternion to the normalized value of q. The value returned
is the magnitude of q before normalization.
@exception NormalizationException if q is zero.
negate
public final void negate()
conjugate
public final void conjugate()
- Set the quaternion to its conjugate.
conjugate
public final void conjugate(Quaternion q)
- Set the quaternion to conjugate of q.
rotation
public final void rotation(float ax,
float ay,
float az,
float angle)
- Compute the unit quaternion representing the 3D rotation of angle
radians about the origin, through the axis (ax, ay, az)
(ax, ay, az) should be a unit vector.
rotation
public final void rotation(Vector3 axis,
float angle)
- Compute the unit quaternion representing the 3D rotation of angle
radians about the origin, through axis.
@param axis axis is a unit vector
toAxisAngle
public final float toAxisAngle(Vector3 axis)
- Convert a unit quaternion to an axis-angle 3D rotation. The return
value is an angle between -PI and +PI, and the axis of rotation
is placed into axis. This method will only work properly for
unit quaternions.
AXIS is can be null, if you're not interested in the axis value.
equals
public boolean equals(Object obj)
- Overrides:
- equals in class Object
copy
public void copy(Copyable cop)
clone
public Object clone()
- Overrides:
- clone in class Object
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index