AnyCAD Rapid API 2024
Help you to create a better world!
载入中...
搜索中...
未找到
GQuaternion类 参考

Public 成员函数

 GQuaternion ()
 
 GQuaternion (double theX, double theY, double theZ, double theW)
 
 GQuaternion (GVec theVecFrom, GVec theVecTo)
 
 GQuaternion (GVec theVecFrom, GVec theVecTo, GVec theHelpCrossVec)
 
 GQuaternion (GVec theAxis, double theAngle)
 
 GQuaternion (GMat theMat)
 
boolean IsEqual (GQuaternion theOther)
 
void SetRotation (GVec theVecFrom, GVec theVecTo)
 
void SetRotation (GVec theVecFrom, GVec theVecTo, GVec theHelpCrossVec)
 
void SetVectorAndAngle (GVec theAxis, double theAngle)
 
void GetVectorAndAngle (GVec theAxis, double[] theAngle)
 
void SetMatrix (GMat theMat)
 
GMat GetMatrix ()
 
void SetEulerAngles (GEulerSequence theOrder, double theAlpha, double theBeta, double theGamma)
 
void GetEulerAngles (GEulerSequence theOrder, double[] theAlpha, double[] theBeta, double[] theGamma)
 
void Set (double theX, double theY, double theZ, double theW)
 
void Set (GQuaternion theQuaternion)
 
double X ()
 
double Y ()
 
double Z ()
 
double W ()
 
void SetIdent ()
 
void Reverse ()
 
GQuaternion Reversed ()
 
void Invert ()
 
GQuaternion Inverted ()
 
double SquareNorm ()
 
double Norm ()
 
void Scale (double theScale)
 
GQuaternion Scaled (double theScale)
 
void StabilizeLength ()
 
void Normalize ()
 
GQuaternion Normalized ()
 
GQuaternion Negated ()
 
GQuaternion Added (GQuaternion theOther)
 
GQuaternion Subtracted (GQuaternion theOther)
 
GQuaternion Multiplied (GQuaternion theOther)
 
void Add (GQuaternion theOther)
 
void Subtract (GQuaternion theOther)
 
void Multiply (GQuaternion theOther)
 
double Dot (GQuaternion theOther)
 
double GetRotationAngle ()
 
GVec Multiply (GVec theVec)
 

详细描述

Represents operation of rotation in 3d space as quaternion and implements operations with rotations basing on quaternion mathematics. In addition, provides methods for conversion to and from other representations of rotation (3*3 matrix, vector and angle, Euler angles)

构造及析构函数说明

◆ GQuaternion() [1/6]

GQuaternion.GQuaternion ( )

Creates an identity quaternion

◆ GQuaternion() [2/6]

GQuaternion.GQuaternion ( double theX,
double theY,
double theZ,
double theW )

Creates quaternion directly from component values

◆ GQuaternion() [3/6]

GQuaternion.GQuaternion ( GVec theVecFrom,
GVec theVecTo )

Creates quaternion representing shortest-arc rotation operator producing vector theVecTo from vector theVecFrom.

◆ GQuaternion() [4/6]

GQuaternion.GQuaternion ( GVec theVecFrom,
GVec theVecTo,
GVec theHelpCrossVec )

Creates quaternion representing shortest-arc rotation operator producing vector theVecTo from vector theVecFrom. Additional vector theHelpCrossVec defines preferred direction for rotation and is used when theVecTo and theVecFrom are directed oppositely.

◆ GQuaternion() [5/6]

GQuaternion.GQuaternion ( GVec theAxis,
double theAngle )

Creates quaternion representing rotation on angle theAngle around vector theAxis

◆ GQuaternion() [6/6]

GQuaternion.GQuaternion ( GMat theMat)

Creates quaternion from rotation matrix 3*3 (which should be orthonormal skew-symmetric matrix)

成员函数说明

◆ Add()

void GQuaternion.Add ( GQuaternion theOther)

Adds components of other quaternion; result is "rotations mix"

◆ Added()

GQuaternion GQuaternion.Added ( GQuaternion theOther)

Makes sum of quaternion components; result is "rotations mix"

◆ Dot()

double GQuaternion.Dot ( GQuaternion theOther)

Computes inner product / scalar product / Dot

◆ GetEulerAngles()

void GQuaternion.GetEulerAngles ( GEulerSequence theOrder,
double[] theAlpha,
double[] theBeta,
double[] theGamma )

Returns Euler angles describing current rotation

◆ GetMatrix()

GMat GQuaternion.GetMatrix ( )

Returns rotation operation as 3*3 matrix

◆ GetRotationAngle()

double GQuaternion.GetRotationAngle ( )

Return rotation angle from -PI to PI

◆ GetVectorAndAngle()

void GQuaternion.GetVectorAndAngle ( GVec theAxis,
double[] theAngle )

Convert a quaternion to Axis+Angle representation, preserve the axis direction and angle from -PI to +PI

◆ Invert()

void GQuaternion.Invert ( )

Inverts quaternion (both rotation direction and norm)

◆ Inverted()

GQuaternion GQuaternion.Inverted ( )

Return inversed quaternion q^-1

◆ IsEqual()

boolean GQuaternion.IsEqual ( GQuaternion theOther)

Simple equal test without precision

◆ Multiplied()

GQuaternion GQuaternion.Multiplied ( GQuaternion theOther)

Multiply function - work the same as Matrices multiplying. qq' = (cross(v,v') + wv' + w'v, ww' - dot(v,v')) Result is rotation combination: q' than q (here q=this, q'=theQ). Notices that: qq' != q'q; qq^-1 = q;

◆ Multiply() [1/2]

void GQuaternion.Multiply ( GQuaternion theOther)

Adds rotation by multiplication

◆ Multiply() [2/2]

GVec GQuaternion.Multiply ( GVec theVec)

Rotates vector by quaternion as rotation operator

◆ Negated()

GQuaternion GQuaternion.Negated ( )

Returns quaternion with all components negated. Note that this operation does not affect neither rotation operator defined by quaternion nor its norm.

◆ Norm()

double GQuaternion.Norm ( )

Returns norm of quaternion

◆ Normalize()

void GQuaternion.Normalize ( )

Scale quaternion that its norm goes to 1. The appearing of 0 magnitude or near is a error, so we can be sure that can divide by magnitude

◆ Normalized()

GQuaternion GQuaternion.Normalized ( )

Returns quaternion scaled so that its norm goes to 1.

◆ Reverse()

void GQuaternion.Reverse ( )

Reverse direction of rotation (conjugate quaternion)

◆ Reversed()

GQuaternion GQuaternion.Reversed ( )

Return rotation with reversed direction (conjugated quaternion)

◆ Scale()

void GQuaternion.Scale ( double theScale)

Scale all components by quaternion by theScale; note that rotation is not changed by this operation (except 0-scaling)

◆ Scaled()

GQuaternion GQuaternion.Scaled ( double theScale)

Returns scaled quaternion

◆ SetEulerAngles()

void GQuaternion.SetEulerAngles ( GEulerSequence theOrder,
double theAlpha,
double theBeta,
double theGamma )

Create a unit quaternion representing rotation defined by generalized Euler angles

◆ SetIdent()

void GQuaternion.SetIdent ( )

Make identity quaternion (zero-rotation)

◆ SetMatrix()

void GQuaternion.SetMatrix ( GMat theMat)

Create a unit quaternion by rotation matrix matrix must contain only rotation (not scale or shear) For numerical stability we find first the greatest component of quaternion and than search others from this one

◆ SetRotation() [1/2]

void GQuaternion.SetRotation ( GVec theVecFrom,
GVec theVecTo )

Sets quaternion to shortest-arc rotation producing vector theVecTo from vector theVecFrom. If vectors theVecFrom and theVecTo are opposite then rotation axis is computed as theVecFrom ^ (1,0,0) or theVecFrom ^ (0,0,1).

◆ SetRotation() [2/2]

void GQuaternion.SetRotation ( GVec theVecFrom,
GVec theVecTo,
GVec theHelpCrossVec )

Sets quaternion to shortest-arc rotation producing vector theVecTo from vector theVecFrom. If vectors theVecFrom and theVecTo are opposite then rotation axis is computed as theVecFrom ^ theHelpCrossVec.

◆ SetVectorAndAngle()

void GQuaternion.SetVectorAndAngle ( GVec theAxis,
double theAngle )

Create a unit quaternion from Axis+Angle representation

◆ SquareNorm()

double GQuaternion.SquareNorm ( )

Returns square norm of quaternion

◆ StabilizeLength()

void GQuaternion.StabilizeLength ( )

Stabilize quaternion length within 1 - 1/4. This operation is a lot faster than normalization and preserve length goes to 0 or infinity

◆ Subtract()

void GQuaternion.Subtract ( GQuaternion theOther)

Subtracts components of other quaternion; result is "rotations mix"

◆ Subtracted()

GQuaternion GQuaternion.Subtracted ( GQuaternion theOther)

Makes difference of quaternion components; result is "rotations mix"