T_Rhino_Geometry_Quaternion - mcneel/rhinocommon-api-docs GitHub Wiki

Quaternion Structure

Represents the four coefficient values in a quaternion. The first value a is the real part, while the rest multipies i, j and k, that are imaginary.

quaternion = a + bi + cj + dk

Namespace: Rhino.Geometry
Assembly: RhinoCommon (in RhinoCommon.dll) Version: Rhino 6.0

Syntax

C#

[SerializableAttribute]
public struct Quaternion : IEquatable<Quaternion>

VB

<SerializableAttribute>
Public Structure Quaternion
	Implements IEquatable(Of Quaternion)

The Quaternion type exposes the following members.

Constructors

 

Name Description
Public method Quaternion Initializes a new quaternion with the provided coefficients.
  Back to Top

Properties

 

Name Description
Public property A Gets or sets the real part of the quaternion.
Public property B Gets or sets the first imaginary coefficient of the quaternion.
Public property C Gets or sets the second imaginary coefficient of the quaternion.
Public property Conjugate Gets a new quaternion that is the conjugate of this quaternion. This is (a,-b,-c,-d)
Public property D Gets or sets the third imaginary coefficient of the quaternion.
Public propertyStatic member I Returns the (0,1,0,0) quaternion.
Public propertyStatic member Identity Returns the (1,0,0,0) quaternion.
Public property Inverse Computes a new inverted quaternion, (a/L2, -b/L2, -c/L2, -d/L2),

where L2 = length squared = (aa + bb + cc + dd). This is the multiplicative inverse, i.e., (a,b,c,d)*(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0). If this is the zero quaternion, then the zero quaternion is returned.

Public property IsScalar true if b, c, and d are all zero.
Public property IsValid Determines if the four coefficients are valid numbers within RhinoCommon. See IsValidDouble(Double).
Public property IsVector true if a = 0 and at least one of b, c, or d is not zero.
Public property IsZero true if a, b, c, and d are all zero.
Public propertyStatic member J Returns the (0,0,1,0) quaternion.
Public propertyStatic member K Returns the (0,0,0,1) quaternion.
Public property Length Returns the length or norm of the quaternion.
Public property LengthSquared Gets the result of (a^2 + b^2 + c^2 + d^2).
Public property Scalar The real (scalar) part of the quaternion This is A.
Public property Vector The imaginary part of the quaternion (B,C,D)
Public propertyStatic member Zero Returns the dafault quaternion, where all coefficients are 0.
  Back to Top

Methods

 

Name Description
Public methodStatic member CrossProduct Computes the vector cross product of p and q = (0,x,y,z), where (x,y,z) = CrossProduct(p.Vector,q.Vector).

This is not the same as the quaternion product p*q.

Public methodStatic member Distance Returns the distance or norm of the difference between two quaternions.
Public method DistanceTo Computes the distance or norm of the difference between this and another quaternion.
Public method EpsilonEquals Check that all values in other are within epsilon of the values in this
Public method Equals(Object) Determines whether an object is a quaternion and has the same value of this quaternion. (Overrides ValueType.Equals(Object).)
Public method Equals(Quaternion) Determines whether this quaternion has the same value of another quaternion.
Public method GetHashCode Gets a non-unique but repeatable hashing code for this quaternion. (Overrides ValueType.GetHashCode().)
Public method GetRotation(Plane) Returns the frame created by applying the quaternion's rotation to the canonical world frame (1,0,0),(0,1,0),(0,0,1).
Public method GetRotation(Double, Vector3d) Returns the rotation defined by the quaternion.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Invert Modifies this quaternion to become (a/L2, -b/L2, -c/L2, -d/L2),

where L2 = length squared = (aa + bb + cc + dd).

This is the multiplicative inverse, i.e., (a,b,c,d)(a/L2, -b/L2, -c/L2, -d/L2) = (1,0,0,0).

Public method MatrixForm Returns 4x4 real valued matrix form of the quaternion a b c d -b a -d c -c d a -b -d -c b a which has the same arithmetic properties as the quaternion.
Public methodStatic member Product The quaternion product of p and q. This is the same value as pq.
Public method Rotate Rotates a 3d vector. This operation is also called conjugation, because the result is the same as (q.Conjugate()*(0,x,y,x)*q/q.LengthSquared).Vector.
Public methodStatic member Rotation(Double, Vector3d) Returns the unit quaternion cos(angle/2), sin(angle/2)*x, sin(angle/2)*y, sin(angle/2)z where (x,y,z) is the unit vector parallel to axis. This is the unit quaternion that represents the rotation of angle about axis.
Public methodStatic member Rotation(Plane, Plane) Returns the unit quaternion that represents the the rotation that maps plane0.xaxis to plane1.xaxis, plane0.yaxis to plane1.yaxis, and plane0.zaxis to plane1.zaxis.
Public method Set Sets all coefficients of the quaternion.
Public method SetRotation(Double, Vector3d) Sets the quaternion to cos(angle/2), sin(angle/2)x, sin(angle/2)y, sin(angle/2)z where (x,y,z) is the unit vector parallel to axis. This is the unit quaternion that represents the rotation of angle about axis.
Public method SetRotation(Plane, Plane) Sets the quaternion to the unit quaternion which rotates plane0.xaxis to plane1.xaxis, plane0.yaxis to plane1.yaxis, and plane0.zaxis to plane1.zaxis.
Public method ToString Returns the fully qualified type name of this instance. (Inherited from ValueType.)
Public method Unitize Scales the quaternion's coordinates so that aa + bb + cc + dd = 1.
  Back to Top

Operators

 

Name Description
Public operatorStatic member Addition Adds two quaternions. This sums each quaternion coefficient with its correspondant and returns a new result quaternion.
Public operatorStatic member Division Divides all quaternion coefficients by a factor and returns a new quaternion with the result.
Public operatorStatic member Equality Determines whether two quaternions have the same value.
Public operatorStatic member Inequality Determines whether two quaternions have different values.
Public operatorStatic member Multiply(Quaternion, Quaternion) Multiplies a quaternion with another one. Quaternion multiplication (Hamilton product) is not commutative.
Public operatorStatic member Multiply(Quaternion, Double) Multiplies (scales) all quaternion coefficients by a factor and returns a new quaternion with the result.
Public operatorStatic member Multiply(Quaternion, Int32) Multiplies (scales) all quaternion coefficients by a factor and returns a new quaternion with the result.
Public operatorStatic member Multiply(Quaternion, Single) Multiplies (scales) all quaternion coefficients by a factor and returns a new quaternion with the result.
Public operatorStatic member Subtraction Subtracts a quaternion from another one. This computes the difference of each quaternion coefficient with its correspondant and returns a new result quaternion.
  Back to Top

Version Information

Supported in: 6.0.16224.21491, 5D58w

See Also

Reference

Rhino.Geometry Namespace

⚠️ **GitHub.com Fallback** ⚠️