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

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) 更多...

类 AnyCAD.Foundation.GQuaternion 继承关系图:

Public 成员函数

 GQuaternion (global::System.IntPtr cPtr, bool cMemoryOwn)
 仅供内部使用
 
void Dispose ()
 
 GQuaternion ()
 Creates an identity quaternion
 
 GQuaternion (double theX, double theY, double theZ, double theW)
 Creates quaternion directly from component values
 
 GQuaternion (GVec theVecFrom, GVec theVecTo)
 Creates quaternion representing shortest-arc rotation operator producing vector theVecTo from vector theVecFrom.
 
 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 (GVec theAxis, double theAngle)
 Creates quaternion representing rotation on angle theAngle around vector theAxis
 
 GQuaternion (GMat theMat)
 Creates quaternion from rotation matrix 3*3 (which should be orthonormal skew-symmetric matrix)
 
bool IsEqual (GQuaternion theOther)
 Simple equal test without precision
 
void 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).
 
void 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.
 
void SetVectorAndAngle (GVec theAxis, double theAngle)
 Create a unit quaternion from Axis+Angle representation
 
void GetVectorAndAngle (GVec theAxis, ref double theAngle)
 Convert a quaternion to Axis+Angle representation, preserve the axis direction and angle from -PI to +PI
 
void 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
 
GMat GetMatrix ()
 Returns rotation operation as 3*3 matrix
 
void SetEulerAngles (GEulerSequence theOrder, double theAlpha, double theBeta, double theGamma)
 Create a unit quaternion representing rotation defined by generalized Euler angles
 
void GetEulerAngles (GEulerSequence theOrder, ref double theAlpha, ref double theBeta, ref double theGamma)
 Returns Euler angles describing current rotation
 
void Set (double theX, double theY, double theZ, double theW)
 
void Set (GQuaternion theQuaternion)
 
double X ()
 
double Y ()
 
double Z ()
 
double W ()
 
void SetIdent ()
 Make identity quaternion (zero-rotation)
 
void Reverse ()
 Reverse direction of rotation (conjugate quaternion)
 
GQuaternion Reversed ()
 Return rotation with reversed direction (conjugated quaternion)
 
void Invert ()
 Inverts quaternion (both rotation direction and norm)
 
GQuaternion Inverted ()
 Return inversed quaternion q^-1
 
double SquareNorm ()
 Returns square norm of quaternion
 
double Norm ()
 Returns norm of quaternion
 
void Scale (double theScale)
 Scale all components by quaternion by theScale; note that rotation is not changed by this operation (except 0-scaling)
 
GQuaternion Scaled (double theScale)
 Returns scaled quaternion
 
void StabilizeLength ()
 Stabilize quaternion length within 1 - 1/4. This operation is a lot faster than normalization and preserve length goes to 0 or infinity
 
void 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
 
GQuaternion Normalized ()
 Returns quaternion scaled so that its norm goes to 1.
 
GQuaternion Negated ()
 Returns quaternion with all components negated. Note that this operation does not affect neither rotation operator defined by quaternion nor its norm.
 
GQuaternion Added (GQuaternion theOther)
 Makes sum of quaternion components; result is "rotations mix"
 
GQuaternion Subtracted (GQuaternion theOther)
 Makes difference of quaternion components; result is "rotations mix"
 
GQuaternion Multiplied (GQuaternion theOther)
 
void Add (GQuaternion theOther)
 Adds components of other quaternion; result is "rotations mix"
 
void Subtract (GQuaternion theOther)
 Subtracts components of other quaternion; result is "rotations mix"
 
void Multiply (GQuaternion theOther)
 Adds rotation by multiplication
 
double Dot (GQuaternion theOther)
 Computes inner product / scalar product / Dot
 
double GetRotationAngle ()
 Return rotation angle from -PI to PI
 
GVec Multiply (GVec theVec)
 Rotates vector by quaternion as rotation operator
 

详细描述

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)

成员函数说明

◆ Multiplied()

GQuaternion AnyCAD.Foundation.GQuaternion.Multiplied ( GQuaternion theOther)

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