RenderScript Quaternion Functions
    
    
      
    
    
      
      Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
      
    
  
  
  
  
  
    
    
    
  
  
    
    
Overview
The following functions manipulate quaternions.
Summary
Functions
  
    rsQuaternionAdd
    : Add two quaternions
  
  
      Parameters
    
    | q | Destination quaternion to add to. | 
|---|
    | rhs | Quaternion to add. | 
|---|
    
   
  
 Adds two quaternions, i.e. *q += *rhs;
   
 
  
    rsQuaternionConjugate
    : Conjugate a quaternion
  
  
  
  
 Conjugates the quaternion.
   
 
  
    rsQuaternionDot
    : Dot product of two quaternions
  
  
      Parameters
    
    | q0 | First quaternion. | 
|---|
    | q1 | Second quaternion. | 
|---|
    
   
  
 Returns the dot product of two quaternions.
   
 
  
    rsQuaternionGetMatrixUnit
    : Get a rotation matrix from a quaternion
  
  
      Parameters
    
    | m | Resulting matrix. | 
|---|
    | q | Normalized 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
    
    | 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)
   
 
  
    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
    
    | 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.
   
 
  
    rsQuaternionMultiply
    : Multiply a quaternion by a scalar or another quaternion
  
  
      Parameters
    
    | 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;.
   
 
  
    rsQuaternionNormalize
    : Normalize a quaternion
  
  
      Parameters
    
    | q | Quaternion to normalize. | 
|---|
    
   
  
 Normalizes the quaternion.
   
 
  
    rsQuaternionSet
    : Create a quaternion
  
  
      Parameters
    
    | 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.
   
 
  
    rsQuaternionSlerp
    : Spherical linear interpolation between two quaternions
  
  
      Parameters
    
    | 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.
   
 
 
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]