![]() |
KudanAR - iOS
1.6.0
|
#import <ARQuaternion.h>
Inherits NSObject, and <NSCoding>.
Instance Methods | |
(BOOL) | - equalsQuaternion:withTolerance: |
(ARQuaternion *) | - addQuaternion: |
(ARQuaternion *) | - localAddQuaternion: |
(ARQuaternion *) | - subtractQuaternion: |
(ARQuaternion *) | - localSubtractQuaternion: |
(ARQuaternion *) | - multiplyByQuaternion: |
(ARQuaternion *) | - localMultiplyByQuaternion: |
(ARVector3 *) | - multiplyByVector: |
(ARVector3 *) | - localMultiplyByVector: |
(ARQuaternion *) | - negate |
(ARQuaternion *) | - localNegate |
(float) | - dotWithQuaternion: |
(ARQuaternion *) | - normalise |
(ARQuaternion *) | - localNormalise |
(ARQuaternion *) | - inverse |
(ARQuaternion *) | - localInverse |
(ARQuaternion *) | - slerpToQuaternion:atTime: |
Class Methods | |
(ARQuaternion *) | + quaternionWithIdentity |
(ARQuaternion *) | + quaternionWithX:y:z:w: |
(ARQuaternion *) | + quaternionFromMatrix4: |
(ARQuaternion *) | + quaternionWithDegrees:axisX:y:z: |
(ARQuaternion *) | + quaternionWithRadians:axisX:y:z: |
(ARQuaternion *) | + quaternionWithOML: [implementation] |
Properties | |
float | x |
float | y |
float | z |
float | w |
OgreMathLib::Quaternion | quaternionOML [implementation] |
An ARQuaternion is a class that represents a rotation. Working with quaternions is better than simply using Euler angles because quaternions avoid problems such as gimbal lock.
- (ARQuaternion *) addQuaternion: | (ARQuaternion *) | quaternion |
Adds the components of two quaternions together and returns the result.
Example of use:
quaternion | The quaternion to add to this quaternion. |
- (float) dotWithQuaternion: | (ARQuaternion *) | quaternion |
Calculates the dot product of this quaternion and another given quaternion and returns the result.
Example of use:
quaternion | The other quaternion to use for the dot product calculation. |
- (BOOL) equalsQuaternion: | (ARQuaternion *) | quaternion | |
withTolerance: | (float) | tolerance | |
Checks whether this quaternion is equal to another given quaternion. A tolerance value is used to account for potential floating-point errors.
Example of use:
quaternion | The quaternion to check against. |
tolerance | The maximum difference between each component of the quaternion. For example, if the tolerance were 0.1, then a quaternion with values (0.5, 0.5, 0.5, 1.0) would be considered equal to a quaternion with values (0.45, 0.52, 0.59, 1.01). The value FLT_EPSILON is a costant value of 0.00001, or 1e-5. |
- (ARQuaternion *) inverse |
Finds the inverse rotation of this quaternion and returns the result. This is useful for rotating something back to its original position.
Example of use:
- (ARQuaternion *) localAddQuaternion: | (ARQuaternion *) | quaternion |
Adds the components of two quaternions together and stores the result in this quaternion.
Example of use:
quaternion | The quaternion to add to this quaternion. |
- (ARQuaternion *) localInverse |
Finds the inverse rotation of this quaternion and stores the result in this quaternion.
Example of use:
- (ARQuaternion *) localMultiplyByQuaternion: | (ARQuaternion *) | quaternion |
Multiplies this quaternion's components by the components of a given quaternion and stores the result in this quaternion. This is NOT the same as the Dot Product. It simply multiplies the components together.
Example of use:
quaternion | The quaternion to multiply with this quaternion. |
Multiplies this quaternion by an ARVector3 and stores the resulting rotated vector in the given vector.
Example of use:
vector | The vector to multiply this quaternion by. |
- (ARQuaternion *) localNegate |
Multiplies this quaternion by -1 and stores the result in this quaternion.
Example of use:
- (ARQuaternion *) localNormalise |
Normliases this quaternion so that each component of the quaternion is in the range 0..1 and stores the result in this quaternion.
Example of use:
- (ARQuaternion *) localSubtractQuaternion: | (ARQuaternion *) | quaternion |
Subtracts a given quaternion's components from the components of this quaternion and stores the result in this quaternion.
Example of use:
quaternion | The quaternion to subtract from this quaternion. |
- (ARQuaternion *) multiplyByQuaternion: | (ARQuaternion *) | quaternion |
Multiplies this quaternion's components by the components of a given quaternion and returns the result. This is NOT the same as the Dot Product OR the Cross Product. It simply multiplies the components together.
Example of use:
quaternion | The quaternion to multiply with this quaternion. |
Multiplies this quaternion by an ARVector3 and returns the resulting rotated vector.
Example of use:
vector | The vector to multiply this quaternion by. |
- (ARQuaternion *) negate |
Multiplies this quaternion by -1 and returns the result.
Example of use:
- (ARQuaternion *) normalise |
Normliases this quaternion so that each component of the quaternion is in the range 0..1 and returns the result.
Example of use:
+ (ARQuaternion *) quaternionFromMatrix4: | (ARMatrix4 *) | matrix |
Creates an ARQuaternion from a 4x4 matrix.
Example of use:
matrix | The 4x4 matrix to convert to a quaternion. |
+ (ARQuaternion *) quaternionWithDegrees: | (float) | angle | |
axisX: | (float) | x | |
y: | (float) | y | |
z: | (float) | z | |
Creates an ARQuaternion representing a rotation of the given angle in degrees around the constructed axis.
Example of use:
angle | The number of degrees around the axes this quaternion should rotate. |
x | The x component of the axis. |
y | The y component of the axis. |
z | The z component of the axis. |
+ (ARQuaternion *) quaternionWithIdentity |
Creates an ARQuaternion with identity, representing no rotation.
Example of use:
+ (ARQuaternion *) quaternionWithRadians: | (float) | angle | |
axisX: | (float) | x | |
y: | (float) | y | |
z: | (float) | z | |
Creates an ARQuaternion representing a rotation of the given angle in radians around the constructed axis.
Example of use:
angle | The number of radians around the axes this quaternion should rotate. |
x | The x component of the axis. |
y | The y component of the axis. |
z | The z component of the axis. |
+ (ARQuaternion *) quaternionWithX: | (float) | x | |
y: | (float) | y | |
z: | (float) | z | |
w: | (float) | w | |
Creates an ARQuaternion with the given values.
Example of use:
x | The value to give the X component of this quaternion. |
y | The value to give the Y component of this quaternion. |
z | The value to give the Z component of this quaternion. |
w | The value to give the W component of this quaternion. |
- (ARQuaternion *) slerpToQuaternion: | (ARQuaternion *) | quaternion | |
atTime: | (float) | time | |
Spherically interpolates between this quaternion and another given quaternion and returns the result. Slerp provides a "slow in" and "slow out" effect. Each step is not equidstant. When time = 0 this quaternion will be return. When time = 1 the given quaternion is returned. When time = 0.5 a rotation halfway between the two quaternions will be returned. Values below 0 or above 1 will return a larger rotation than either of the two.
£xample of use:
quaternion | The other quaternion to use for the interpolation calculation. |
time | Represents a percentage of how much of a rotation between the two quaternions the result should represent. |
- (ARQuaternion *) subtractQuaternion: | (ARQuaternion *) | quaternion |
Subtracts a given quaternion's components from the components of this quaternion and returns the result.
Example of use:
quaternion | The quaternion to subtract from this quaternion. |
|
readnonatomicassign |
The w value of the quaternion.
|
readnonatomicassign |
The x value of the quaternion.
|
readnonatomicassign |
The y value of the quaternion.
|
readnonatomicassign |
The z value of the quaternion.