Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers
|
Unit CastleQuaternions
Description
Quaternions (in particular using them to express 3D rotations).
Uses
Overview
Classes, Interfaces, Objects and Records
Record TQuaternion |
Quaternions are useful to represent rotations in 3D that can be easily applied and combined with other rotations. |
Functions and Procedures
Constants
Description
Functions and Procedures
function QuatFromAxisAngle(const Axis: TVector3; const AngleRad: Single; const NormalizeAxis: boolean = false): TQuaternion; overload; |
Calculate unit quaternion representing rotation around Axis by AngleRad angle (in radians).
Axis must be normalized, or you have to pass NormalizeAxis = true (then we'll normalize it ourselves inside). Otherwise you will get non-normalized quaternion that doesn't represent rotation, and is usually useless for us.
|
function QuatFromAxisAngle(const AxisAngle: TVector4; const NormalizeAxis: boolean = false): TQuaternion; overload; |
|
function SLerp(const A: Single; const Q1, Q2: TQuaternion): TQuaternion; overload; |
Interpolate between two rotations, along the shortest path on the unit sphere, with constant speed.
The overloaded version that works with TVector4 takes a rotation (not a quaternion) expressed as an axis (first 3 elements) and angle (in radians, 4th element). Axis does not have to be normalized (we'll normalize it). This is nice e.g. to interpolate VRML/X3D rotations.
|
function SLerp(const A: Single; const Rot1, Rot2: TVector4): TVector4; overload; |
|
function NLerp(const A: Single; const Q1, Q2: TQuaternion; const ForceShortestPath: boolean = true): TQuaternion; overload; |
Interpolate between two rotations, along the straightest path on the unit sphere.
This is faster than SLerp, but does not guarantee the interpolated result travels with constant speed. Often it's not a noticeable / important problem (see http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/)
When ForceShortestPath = False , this doesn't guarantee choosing the shortest path. Although it goes through the straightest path, there are two such paths, it may go through the shorter or longer one. Use ForceShortestPath = True if you want to interpolate through the shortest.
The overloaded version that works with TVector4 takes a rotation (not a quaternion) expressed as an axis (first 3 elements) and angle (in radians, 4th element). Axis does not have to be normalized (we'll normalize it). This is nice e.g. to interpolate VRML/X3D rotations.
|
function NLerp(const A: Single; const Rot1, Rot2: TVector4; const ForceShortestPath: boolean = true): TVector4; overload; |
|
Constants
QuatIdentityRot: TQuaternion = (Data: (Vector: (Data: (0, 0, 0)); Real: 1))
deprecated 'use TQuaternion.ZeroRotation'; |
Warning: this symbol is deprecated: use TQuaternion.ZeroRotation |
Generated by PasDoc 0.15.0.
|