public final class Quaternion extends java.lang.Object implements com.aspose.threed.Struct<Quaternion>, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static Quaternion |
IDENTITY
The Identity quaternion.
|
double |
w
The w component.
|
double |
x
The x component.
|
double |
y
The y component.
|
double |
z
The z component.
|
Constructor and Description |
---|
Quaternion() |
Quaternion(double w,
double x,
double y,
double z)
Initializes a new instance of the
Quaternion class. |
Modifier and Type | Method and Description |
---|---|
static Quaternion |
add(Quaternion lhs,
Quaternion rhs)
Operator overloading for +
|
Quaternion |
clone() |
Quaternion |
concat(Quaternion rhs)
Concatenate two quaternions
|
Quaternion |
conjugate()
Returns a conjugate quaternion of current quaternion
|
void |
copyFrom(Quaternion src) |
static Quaternion |
div(Quaternion lhs,
double rhs)
Operator overloading for /
|
double |
dot(Quaternion q)
Dots product
|
boolean |
equals(java.lang.Object obj)
Check if two quaternions equals
|
Vector3 |
eulerAngles()
Converts quaternion to rotation represented by Euler angles
All components are in radian
|
static Quaternion |
fromAngleAxis(double a,
Vector3 axis)
Creates a quaternion around given axis and rotate in clockwise
|
static Quaternion |
fromEulerAngle(double pitch,
double yaw,
double roll)
Creates quaternion from given Euler angle
|
static Quaternion |
fromEulerAngle(Vector3 eulerAngle)
Creates quaternion from given Euler angle
|
static Quaternion |
fromRotation(Vector3 orig,
Vector3 dest)
Creates a quaternion that rotate from original to destination direction
|
double |
getLength()
Gets the length of the quaternion
|
int |
hashCode()
Gets the hash code of Quaternion
|
static Quaternion |
interpolate(float t,
Quaternion from,
Quaternion to)
Populates this quaternion with the interpolated value between the given quaternion arguments for a t between from and to.
|
Quaternion |
inverse()
Returns a inverse quaternion of current quaternion
|
static Quaternion |
mul(Quaternion lhs,
double rhs)
Operator overloading for *
|
static Quaternion |
mul(Quaternion lhs,
Quaternion rhs)
Operator overloading for *
|
static Vector3 |
mul(Quaternion q,
Vector3 v)
Operator overloading for *
|
static Vector4 |
mul(Quaternion q,
Vector4 v)
Operator overloading for *
|
static Vector3 |
mul(Vector3 v,
Quaternion q)
Operator overloading for *
|
Quaternion |
normalize()
Normalize the quaternion
|
static boolean |
op_eq(Quaternion lhs,
Quaternion rhs)
Equal operator for quaternion
|
static boolean |
op_ne(Quaternion lhs,
Quaternion rhs)
Not-equal operator for quaternion
|
void |
toAngleAxis(double[] angle,
Vector3 axis)
Decompose the quaternion to angle and axis
|
Matrix4 |
toMatrix()
Convert the rotation presented by quaternion to transform matrix.
|
java.lang.String |
toString()
Gets the representation of quaternion in string
|
public static final Quaternion IDENTITY
public double w
public double x
public double y
public double z
public Quaternion(double w, double x, double y, double z)
Quaternion
class.w
- w component of the quaternionx
- x component of the quaterniony
- y component of the quaternionz
- z component of the quaternionpublic Quaternion()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to check equality.public Quaternion conjugate()
public Quaternion inverse()
public double dot(Quaternion q)
q
- The quaternionpublic Vector3 eulerAngles()
public double getLength()
public Quaternion normalize()
public void toAngleAxis(double[] angle, Vector3 axis)
angle
- The angle to rotate, in radian.axis
- The axis that rotates around.public Quaternion concat(Quaternion rhs)
rhs
- public static Quaternion fromAngleAxis(double a, Vector3 axis)
a
- Clockwise rotation in radianaxis
- Axispublic static Quaternion fromRotation(Vector3 orig, Vector3 dest)
orig
- Original directiondest
- Destination directionpublic static Quaternion fromEulerAngle(double pitch, double yaw, double roll)
pitch
- Pitch in radianyaw
- Yaw in radianroll
- Roll in radianpublic static Quaternion fromEulerAngle(Vector3 eulerAngle)
eulerAngle
- Euler angle in radianpublic Matrix4 toMatrix()
public static Quaternion add(Quaternion lhs, Quaternion rhs)
lhs
- Left quaternionrhs
- Right quaternionpublic static Quaternion div(Quaternion lhs, double rhs)
lhs
- Left quaternionrhs
- Right quaternionpublic static Quaternion mul(Quaternion lhs, double rhs)
lhs
- Left quaternionrhs
- Right quaternionpublic static Quaternion mul(Quaternion lhs, Quaternion rhs)
lhs
- Left quaternionrhs
- Right quaternionpublic static Vector3 mul(Quaternion q, Vector3 v)
q
- The rotation quaternionv
- Vector to rotatepublic static Vector4 mul(Quaternion q, Vector4 v)
q
- The rotation quaternionv
- Vector to rotatepublic java.lang.String toString()
toString
in class java.lang.Object
public static Vector3 mul(Vector3 v, Quaternion q)
v
- The rotation quaternionq
- Vector to rotatepublic static boolean op_eq(Quaternion lhs, Quaternion rhs)
lhs
- Left hand side value.rhs
- Right hand side value.public static boolean op_ne(Quaternion lhs, Quaternion rhs)
lhs
- Left hand side value.rhs
- Right hand side value.public static Quaternion interpolate(float t, Quaternion from, Quaternion to)
t
- The coefficient to interpolate.from
- Source quaternion.to
- Target quaternion.public Quaternion clone()
clone
in interface com.aspose.threed.Struct<Quaternion>
clone
in class java.lang.Object
public void copyFrom(Quaternion src)
copyFrom
in interface com.aspose.threed.Struct<Quaternion>
public int hashCode()
hashCode
in class java.lang.Object
Quaternion