AnyCAD Rapid API 2023
Help you to create a better world!
|
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.GQuaternion | ( | ) |
Creates an identity quaternion
GQuaternion.GQuaternion | ( | double | theX, |
double | theY, | ||
double | theZ, | ||
double | theW | ||
) |
Creates quaternion directly from component values
Creates quaternion representing shortest-arc rotation operator producing vector theVecTo from vector theVecFrom.
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.GQuaternion | ( | GVec | theAxis, |
double | theAngle | ||
) |
Creates quaternion representing rotation on angle theAngle around vector theAxis
GQuaternion.GQuaternion | ( | GMat | theMat | ) |
Creates quaternion from rotation matrix 3*3 (which should be orthonormal skew-symmetric matrix)
void GQuaternion.Add | ( | GQuaternion | theOther | ) |
Adds components of other quaternion; result is "rotations mix"
GQuaternion GQuaternion.Added | ( | GQuaternion | theOther | ) |
Makes sum of quaternion components; result is "rotations mix"
double GQuaternion.Dot | ( | GQuaternion | theOther | ) |
Computes inner product / scalar product / Dot
void GQuaternion.GetEulerAngles | ( | GEulerSequence | theOrder, |
double[] | theAlpha, | ||
double[] | theBeta, | ||
double[] | theGamma | ||
) |
Returns Euler angles describing current rotation
GMat GQuaternion.GetMatrix | ( | ) |
Returns rotation operation as 3*3 matrix
double GQuaternion.GetRotationAngle | ( | ) |
Return rotation angle from -PI to PI
void GQuaternion.GetVectorAndAngle | ( | GVec | theAxis, |
double[] | theAngle | ||
) |
Convert a quaternion to Axis+Angle representation, preserve the axis direction and angle from -PI to +PI
void GQuaternion.Invert | ( | ) |
Inverts quaternion (both rotation direction and norm)
GQuaternion GQuaternion.Inverted | ( | ) |
Return inversed quaternion q^-1
boolean GQuaternion.IsEqual | ( | GQuaternion | theOther | ) |
Simple equal test without precision
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;
void GQuaternion.Multiply | ( | GQuaternion | theOther | ) |
Adds rotation by multiplication
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.
double GQuaternion.Norm | ( | ) |
Returns norm of quaternion
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
GQuaternion GQuaternion.Normalized | ( | ) |
Returns quaternion scaled so that its norm goes to 1.
void GQuaternion.Reverse | ( | ) |
Reverse direction of rotation (conjugate quaternion)
GQuaternion GQuaternion.Reversed | ( | ) |
Return rotation with reversed direction (conjugated quaternion)
void GQuaternion.Scale | ( | double | theScale | ) |
Scale all components by quaternion by theScale; note that rotation is not changed by this operation (except 0-scaling)
GQuaternion GQuaternion.Scaled | ( | double | theScale | ) |
Returns scaled quaternion
void GQuaternion.SetEulerAngles | ( | GEulerSequence | theOrder, |
double | theAlpha, | ||
double | theBeta, | ||
double | theGamma | ||
) |
Create a unit quaternion representing rotation defined by generalized Euler angles
void GQuaternion.SetIdent | ( | ) |
Make identity quaternion (zero-rotation)
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
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).
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 GQuaternion.SetVectorAndAngle | ( | GVec | theAxis, |
double | theAngle | ||
) |
Create a unit quaternion from Axis+Angle representation
double GQuaternion.SquareNorm | ( | ) |
Returns square norm of quaternion
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
void GQuaternion.Subtract | ( | GQuaternion | theOther | ) |
Subtracts components of other quaternion; result is "rotations mix"
GQuaternion GQuaternion.Subtracted | ( | GQuaternion | theOther | ) |
Makes difference of quaternion components; result is "rotations mix"