Most visited


Recently visited


RenderScript Quaternion Functions

Overview


The following functions manipulate quaternions.

Summary


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

Functions


rsQuaternionAdd : Add two quaternions

void rsQuaternionAdd(rs_quaternion* q, const rs_quaternion* rhs);
Parameters
qDestination quaternion to add to.
rhsQuaternion to add.

Adds two quaternions, i.e. *q += *rhs;

rsQuaternionConjugate : Conjugate a quaternion

void rsQuaternionConjugate(rs_quaternion* q);
Parameters
qQuaternion to modify.

Conjugates the quaternion.

rsQuaternionDot : Dot product of two quaternions

float rsQuaternionDot(const rs_quaternion* q0, const rs_quaternion* q1);
Parameters
q0First quaternion.
q1Second quaternion.

Returns the dot product of two quaternions.

rsQuaternionGetMatrixUnit : Get a rotation matrix from a quaternion

void rsQuaternionGetMatrixUnit(rs_matrix4x4* m, const rs_quaternion* q);
Parameters
mResulting matrix.
qNormalized quaternion.

Computes a rotation matrix from the normalized quaternion.

rsQuaternionLoadRotate : Create a rotation quaternion

void rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z);
Parameters
qDestination quaternion.
rotAngle to rotate by.
xX component of a vector.
yY component of a vector.
zZ component of a vector.

Loads a quaternion that represents a rotation about an arbitrary vector (doesn't have to be unit)

rsQuaternionLoadRotateUnit : Quaternion that represents a rotation about an arbitrary unit vector

void rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z);
Parameters
qDestination quaternion.
rotAngle to rotate by, in radians.
xX component of the vector.
yY component of the vector.
zZ component of the vector.

Loads a quaternion that represents a rotation about an arbitrary unit vector.

rsQuaternionMultiply : Multiply a quaternion by a scalar or another quaternion

void rsQuaternionMultiply(rs_quaternion* q, const rs_quaternion* rhs);
void rsQuaternionMultiply(rs_quaternion* q, float scalar);
Parameters
qDestination quaternion.
scalarScalar to multiply the quaternion by.
rhsQuaternion 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;.

rsQuaternionNormalize : Normalize a quaternion

void rsQuaternionNormalize(rs_quaternion* q);
Parameters
qQuaternion to normalize.

Normalizes the quaternion.

rsQuaternionSet : Create a quaternion

void rsQuaternionSet(rs_quaternion* q, const rs_quaternion* rhs);
void rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z);
Parameters
qDestination quaternion.
wW component.
xX component.
yY component.
zZ component.
rhsSource quaternion.

Creates a quaternion from its four components or from another quaternion.

rsQuaternionSlerp : Spherical linear interpolation between two quaternions

void rsQuaternionSlerp(rs_quaternion* q, const rs_quaternion* q0, const rs_quaternion* q1, float t);
Parameters
qResult quaternion from the interpolation.
q0First input quaternion.
q1Second input quaternion.
tHow much to interpolate by.

Performs spherical linear interpolation between two quaternions.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in English?

You requested a page in English, but your language preference for this site is English.

Would you like to change your language preference and browse this site in English? If you want to change your language preference later, use the language menu at the bottom of each page.