page.title=RenderScript Quaternion Functions @jd:body
The following functions manipulate quaternions.
Functions | |
---|---|
rsQuaternionAdd | Add two quaternions |
rsQuaternionConjugate | Conjugate a quaternion |
rsQuaternionDot | Dot product of two quaternions |
rsQuaternionGetMatrixUnit | Get a rotation matrix from a quaternion |
rsQuaternionLoadRotate | Create a rotation quaternion |
rsQuaternionLoadRotateUnit | Quaternion that represents a rotation about an arbitrary unit vector |
rsQuaternionMultiply | Multiply a quaternion by a scalar or another quaternion |
rsQuaternionNormalize | Normalize a quaternion |
rsQuaternionSet | Create a quaternion |
rsQuaternionSlerp | Spherical linear interpolation between two quaternions |
void rsQuaternionAdd(rs_quaternion* q, const rs_quaternion* rhs); |
q | Destination quaternion to add to. |
---|---|
rhs | Quaternion to add. |
Adds two quaternions, i.e. *q += *rhs;
void rsQuaternionConjugate(rs_quaternion* q); |
q | Quaternion to modify. |
---|
Conjugates the quaternion.
float rsQuaternionDot(const rs_quaternion* q0, const rs_quaternion* q1); |
q0 | First quaternion. |
---|---|
q1 | Second quaternion. |
Returns the dot product of two quaternions.
void rsQuaternionGetMatrixUnit(rs_matrix4x4* m, const rs_quaternion* q); |
m | Resulting matrix. |
---|---|
q | Normalized quaternion. |
Computes a rotation matrix from the normalized quaternion.
void rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z); |
q | Destination quaternion. |
---|---|
rot | Angle to rotate by. |
x | X component of a vector. |
y | Y component of a vector. |
z | Z component of a vector. |
Loads a quaternion that represents a rotation about an arbitrary vector (doesn't have to be unit)
void rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z); |
q | Destination quaternion. |
---|---|
rot | Angle to rotate by, in radians. |
x | X component of the vector. |
y | Y component of the vector. |
z | Z component of the vector. |
Loads a quaternion that represents a rotation about an arbitrary unit vector.
void rsQuaternionMultiply(rs_quaternion* q, const rs_quaternion* rhs); | |
void rsQuaternionMultiply(rs_quaternion* q, float scalar); |
q | Destination quaternion. |
---|---|
scalar | Scalar to multiply the quaternion by. |
rhs | Quaternion to multiply the destination quaternion by. |
Multiplies a quaternion by a scalar or by another quaternion, e.g
*q = *q * scalar;
or *q = *q * *rhs;
.
void rsQuaternionNormalize(rs_quaternion* q); |
q | Quaternion to normalize. |
---|
Normalizes the quaternion.
void rsQuaternionSet(rs_quaternion* q, const rs_quaternion* rhs); | |
void rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z); |
q | Destination quaternion. |
---|---|
w | W component. |
x | X component. |
y | Y component. |
z | Z component. |
rhs | Source quaternion. |
Creates a quaternion from its four components or from another quaternion.
void rsQuaternionSlerp(rs_quaternion* q, const rs_quaternion* q0, const rs_quaternion* q1, float t); |
q | Result quaternion from the interpolation. |
---|---|
q0 | First input quaternion. |
q1 | Second input quaternion. |
t | How much to interpolate by. |
Performs spherical linear interpolation between two quaternions.