• Articles
  • Api Documentation
Show / Hide Table of Contents
  • Vim.Math3d
    • AABox
    • AABox2D
    • AABox4D
    • AngularMotion
    • AxisAngle
    • Byte2
    • Byte3
    • Byte4
    • ColorHDR
    • ColorRGB
    • ColorRGBA
    • Complex
    • Constants
    • ContainmentType
    • CylindricalCoordinate
    • DAABox
    • DAABox2D
    • DAABox4D
    • DInterval
    • DPlane
    • DQuaternion
    • DRay
    • DSphere
    • DVector2
    • DVector3
    • DVector4
    • Euler
    • GeoCoordinate
    • Hash
    • HorizontalCoordinate
    • IMappable<TContainer, TPart>
    • Int2
    • Int3
    • Int4
    • Interval
    • IPoints
    • IPoints2D
    • ITransformable3D<TSelf>
    • Line
    • Line2D
    • LinearMotion
    • LinqUtil
    • LogPolarCoordinate
    • MathOps
    • Matrix4x4
    • Motion
    • MovementExtensions
    • Plane
    • PlaneIntersectionType
    • PolarCoordinate
    • Quad
    • Quad2D
    • Quaternion
    • Ray
    • Sphere
    • SphericalCoordinate
    • StatelessRandom
    • Stats<T>
    • Transform
    • Transformable3D
    • Triangle
    • Triangle2D
    • Vector2
    • Vector3
    • Vector4

Struct Quaternion

A structure encapsulating a four-dimensional vector (x,y,z,w), which is used to efficiently rotate an object about the (x,y,z) vector by the angle theta, where w = cos(theta/2).

Implements
System.IEquatable<Quaternion>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Vim.Math3d
Assembly: Vim.Math3D.dll
[DataContract]
public readonly struct Quaternion : IEquatable<Quaternion>

Constructors

View Source

Quaternion(Single, Single, Single, Single)

public Quaternion(float x, float y, float z, float w)
View Source

Quaternion((Single x, Single y, Single z, Single w))

public Quaternion((float x, float y, float z, float w) tuple)
View Source

Quaternion(Vector3, Single)

Constructs a Quaternion from the given vector and rotation parts.

public Quaternion(Vector3 vectorPart, float scalarPart)

Fields

View Source

MaxValue

public static Quaternion MaxValue
View Source

MinValue

public static Quaternion MinValue
View Source

W

[DataMember]
public readonly float W
View Source

X

[DataMember]
public readonly float X
View Source

Y

[DataMember]
public readonly float Y
View Source

Z

[DataMember]
public readonly float Z
View Source

Zero

public static Quaternion Zero

Properties

View Source

Identity

Returns a Quaternion representing no rotation.

public static readonly Quaternion Identity { get; }
View Source

IsIdentity

Returns whether the Quaternion is the identity Quaternion.

public readonly bool IsIdentity { get; }
View Source

Vector4

public readonly Vector4 Vector4 { get; }

Methods

View Source

AlmostEquals(Quaternion, Single)

public readonly bool AlmostEquals(Quaternion x, float tolerance = 1E-07F)
View Source

Concatenate(Quaternion, Quaternion)

Concatenates two Quaternions; the result represents the value1 rotation followed by the value2 rotation.

public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
View Source

Conjugate()

Returns the conjugate of the quaternion

public readonly Quaternion Conjugate()
View Source

Create(Single, Single, Single, Single)

public static Quaternion Create(float x, float y, float z, float w)
View Source

Create((Single x, Single y, Single z, Single w))

public static Quaternion Create((float x, float y, float z, float w) tuple)
View Source

CreateFromAxisAngle(Vector3, Single)

Creates a Quaternion from a normalized vector axis and an angle to rotate about the vector.

public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
View Source

CreateFromEulerAngles(Vector3)

Creates a new Quaternion from the given rotation around X, Y, and Z

public static Quaternion CreateFromEulerAngles(Vector3 v)
View Source

CreateFromRotationMatrix(Matrix4x4)

Creates a Quaternion from the given rotation matrix.

public static Quaternion CreateFromRotationMatrix(Matrix4x4 matrix)
View Source

CreateFromYawPitchRoll(Single, Single, Single)

Creates a new Quaternion from the given yaw, pitch, and roll, in radians. Roll first, about axis the object is facing, then pitch upward, then yaw to face into the new heading

  1. Z(roll), 2. X (pitch), 3. Y (yaw)
public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
View Source

CreateRotationFromAToB(Vector3, Vector3)

Creates a new Quaternion rotating vector 'fromA' to 'toB'

public static Quaternion CreateRotationFromAToB(Vector3 fromA, Vector3 toB)
View Source

CreateXRotation(Single)

Creates a new Quaternion from the given rotation around the X axis

public static Quaternion CreateXRotation(float theta)
View Source

CreateYRotation(Single)

Creates a new Quaternion from the given rotation around the Y axis

public static Quaternion CreateYRotation(float theta)
View Source

CreateZRotation(Single)

Creates a new Quaternion from the given rotation around the Z axis

public static Quaternion CreateZRotation(float theta)
View Source

Deconstruct(out Single, out Single, out Single, out Single)

public readonly void Deconstruct(out float x, out float y, out float z, out float w)
View Source

Dot(Quaternion, Quaternion)

Calculates the dot product of two Quaternions.

public static float Dot(Quaternion quaternion1, Quaternion quaternion2)
View Source

Equals(Object)

public override readonly bool Equals(object obj)
Overrides
System.ValueType.Equals(System.Object)
View Source

Equals(Quaternion)

public readonly bool Equals(Quaternion x)
View Source

GetHashCode()

public override readonly int GetHashCode()
Overrides
System.ValueType.GetHashCode()
View Source

Inverse()

Returns the inverse of a Quaternion.

public readonly Quaternion Inverse()
View Source

Length()

Calculates the length of the Quaternion.

public readonly float Length()
View Source

LengthSquared()

Calculates the length squared of the Quaternion. This operation is cheaper than Length().

public readonly float LengthSquared()
View Source

Lerp(Quaternion, Quaternion, Single)

Linearly interpolates between two quaternions.

public static Quaternion Lerp(Quaternion q1, Quaternion q2, float t)
View Source

LookAt(Vector3, Vector3, Vector3, Vector3)

Creates a new look-at Quaternion

public static Quaternion LookAt(Vector3 position, Vector3 targetPosition, Vector3 up, Vector3 forward)
View Source

Normalize()

Divides each component of the Quaternion by the length of the Quaternion.

public readonly Quaternion Normalize()
View Source

SetW(Single)

public readonly Quaternion SetW(float x)
View Source

SetX(Single)

public readonly Quaternion SetX(float x)
View Source

SetY(Single)

public readonly Quaternion SetY(float x)
View Source

SetZ(Single)

public readonly Quaternion SetZ(float x)
View Source

Slerp(Quaternion, Quaternion, Single)

Interpolates between two quaternions, using spherical linear interpolation.

public static Quaternion Slerp(Quaternion q1, Quaternion q2, float t)
View Source

ToEulerAngles()

Returns Euler123 angles (rotate around, X, then Y, then Z).

public readonly Vector3 ToEulerAngles()
View Source

ToString()

public override readonly string ToString()
Overrides
System.ValueType.ToString()

Operators

View Source

Addition(Quaternion, Quaternion)

Adds two Quaternions element-by-element.

public static Quaternion operator +(Quaternion value1, Quaternion value2)
View Source

Division(Quaternion, Quaternion)

Divides a Quaternion by another Quaternion.

public static Quaternion operator /(Quaternion value1, Quaternion value2)
View Source

Equality(Quaternion, Quaternion)

public static bool operator ==(Quaternion x0, Quaternion x1)
View Source

Implicit((Single x, Single y, Single z, Single w) to Quaternion)

public static implicit operator Quaternion((float x, float y, float z, float w) tuple)
View Source

Implicit(Quaternion to (Single x, Single y, Single z, Single w))

public static implicit operator (float x, float y, float z, float w)(Quaternion self)
View Source

Inequality(Quaternion, Quaternion)

public static bool operator !=(Quaternion x0, Quaternion x1)
View Source

Multiply(Quaternion, Single)

Multiplies a Quaternion by a scalar value.

public static Quaternion operator *(Quaternion value1, float value2)
View Source

Multiply(Quaternion, Quaternion)

Multiplies two Quaternions together.

public static Quaternion operator *(Quaternion value1, Quaternion value2)
View Source

Subtraction(Quaternion, Quaternion)

Subtracts one Quaternion from another.

public static Quaternion operator -(Quaternion value1, Quaternion value2)
View Source

UnaryNegation(Quaternion)

Flips the sign of each component of the quaternion.

public static Quaternion operator -(Quaternion value)

Implements

System.IEquatable<T>

Extension Methods

MathOps.ToMatrix(Quaternion)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright VIM 2021, Generated by DocFX