Search Results for

    Show / Hide Table of Contents

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

    Inherited Members
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Namespace: System.Numerics
    Assembly: System.Numerics.dll
    Syntax
    public struct Quaternion

    Constructors

    | Improve this Doc View Source

    Quaternion(Double, Double, Double, Double)

    Constructs a Quaternion from the given components.

    Declaration
    public Quaternion(double x, double y, double z, double w)
    Parameters
    Type Name Description
    Double x

    The X component of the Quaternion.

    Double y

    The Y component of the Quaternion.

    Double z

    The Z component of the Quaternion.

    Double w

    The W component of the Quaternion.

    | Improve this Doc View Source

    Quaternion(Vector3, Double)

    Constructs a Quaternion from the given vector and rotation parts.

    Declaration
    public Quaternion(Vector3 vectorPart, double scalarPart)
    Parameters
    Type Name Description
    Vector3 vectorPart

    The vector part of the Quaternion.

    Double scalarPart

    The rotation part of the Quaternion.

    Fields

    | Improve this Doc View Source

    W

    Specifies the rotation component of the Quaternion.

    Declaration
    public double W
    Field Value
    Type Description
    Double
    | Improve this Doc View Source

    X

    Specifies the X-value of the vector component of the Quaternion.

    Declaration
    public double X
    Field Value
    Type Description
    Double
    | Improve this Doc View Source

    Y

    Specifies the Y-value of the vector component of the Quaternion.

    Declaration
    public double Y
    Field Value
    Type Description
    Double
    | Improve this Doc View Source

    Z

    Specifies the Z-value of the vector component of the Quaternion.

    Declaration
    public double Z
    Field Value
    Type Description
    Double

    Properties

    | Improve this Doc View Source

    Identity

    Returns a Quaternion representing no rotation.

    Declaration
    public static readonly Quaternion Identity { get; }
    Property Value
    Type Description
    Quaternion
    | Improve this Doc View Source

    IsIdentity

    Returns whether the Quaternion is the identity Quaternion.

    Declaration
    public readonly bool IsIdentity { get; }
    Property Value
    Type Description
    Boolean

    Methods

    | Improve this Doc View Source

    Add(Quaternion, Quaternion)

    Adds two Quaternions element-by-element.

    Declaration
    public static Quaternion Add(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first source Quaternion.

    Quaternion value2

    The second source Quaternion.

    Returns
    Type Description
    Quaternion

    The result of adding the Quaternions.

    | Improve this Doc View Source

    Concatenate(Quaternion, Quaternion)

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

    Declaration
    public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first Quaternion rotation in the series.

    Quaternion value2

    The second Quaternion rotation in the series.

    Returns
    Type Description
    Quaternion

    A new Quaternion representing the concatenation of the value1 rotation followed by the value2 rotation.

    | Improve this Doc View Source

    Conjugate(Quaternion)

    Creates the conjugate of a specified Quaternion.

    Declaration
    public static Quaternion Conjugate(Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    The Quaternion of which to return the conjugate.

    Returns
    Type Description
    Quaternion

    A new Quaternion that is the conjugate of the specified one.

    | Improve this Doc View Source

    CreateFromAxisAngle(Vector3, Double)

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

    Declaration
    public static Quaternion CreateFromAxisAngle(Vector3 axis, double angle)
    Parameters
    Type Name Description
    Vector3 axis

    The vector to rotate around.

    Double angle

    The angle, in radians, to rotate around the vector.

    Returns
    Type Description
    Quaternion

    The created Quaternion.

    | Improve this Doc View Source

    CreateFromYawPitchRoll(Double, Double, Double)

    Creates a new Quaternion from the given yaw, pitch, and roll, in radians.

    Declaration
    public static Quaternion CreateFromYawPitchRoll(double yaw, double pitch, double roll)
    Parameters
    Type Name Description
    Double yaw

    The yaw angle, in radians, around the Y-axis.

    Double pitch

    The pitch angle, in radians, around the X-axis.

    Double roll

    The roll angle, in radians, around the Z-axis.

    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    Divide(Quaternion, Quaternion)

    Divides a Quaternion by another Quaternion.

    Declaration
    public static Quaternion Divide(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The source Quaternion.

    Quaternion value2

    The divisor.

    Returns
    Type Description
    Quaternion

    The result of the division.

    | Improve this Doc View Source

    Dot(Quaternion, Quaternion)

    Calculates the dot product of two Quaternions.

    Declaration
    public static double Dot(Quaternion quaternion1, Quaternion quaternion2)
    Parameters
    Type Name Description
    Quaternion quaternion1

    The first source Quaternion.

    Quaternion quaternion2

    The second source Quaternion.

    Returns
    Type Description
    Double

    The dot product of the Quaternions.

    | Improve this Doc View Source

    Equals(Quaternion)

    Returns a boolean indicating whether the given Quaternion is equal to this Quaternion instance.

    Declaration
    public bool Equals(Quaternion other)
    Parameters
    Type Name Description
    Quaternion other

    The Quaternion to compare this instance to.

    Returns
    Type Description
    Boolean

    True if the other Quaternion is equal to this instance; False otherwise.

    | Improve this Doc View Source

    Equals(Object)

    Returns a boolean indicating whether the given Object is equal to this Quaternion instance.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    Object obj

    The Object to compare against.

    Returns
    Type Description
    Boolean

    True if the Object is equal to this Quaternion; False otherwise.

    Overrides
    ValueType.Equals(Object)
    | Improve this Doc View Source

    GetHashCode()

    Returns the hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    Int32

    The hash code.

    Overrides
    Object.GetHashCode()
    | Improve this Doc View Source

    Inverse(Quaternion)

    Returns the inverse of a Quaternion.

    Declaration
    public static Quaternion Inverse(Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    The source Quaternion.

    Returns
    Type Description
    Quaternion

    The inverted Quaternion.

    | Improve this Doc View Source

    Length()

    Calculates the length of the Quaternion.

    Declaration
    public double Length()
    Returns
    Type Description
    Double

    The computed length of the Quaternion.

    | Improve this Doc View Source

    LengthSquared()

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

    Declaration
    public double LengthSquared()
    Returns
    Type Description
    Double

    The length squared of the Quaternion.

    | Improve this Doc View Source

    Lerp(Quaternion, Quaternion, Double)

    Linearly interpolates between two quaternions.

    Declaration
    public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, double amount)
    Parameters
    Type Name Description
    Quaternion quaternion1

    The first source Quaternion.

    Quaternion quaternion2

    The second source Quaternion.

    Double amount

    The relative weight of the second source Quaternion in the interpolation.

    Returns
    Type Description
    Quaternion

    The interpolated Quaternion.

    | Improve this Doc View Source

    Multiply(Quaternion, Double)

    Multiplies a Quaternion by a scalar value.

    Declaration
    public static Quaternion Multiply(Quaternion value1, double value2)
    Parameters
    Type Name Description
    Quaternion value1

    The source Quaternion.

    Double value2

    The scalar value.

    Returns
    Type Description
    Quaternion

    The result of the multiplication.

    | Improve this Doc View Source

    Multiply(Quaternion, Quaternion)

    Multiplies two Quaternions together.

    Declaration
    public static Quaternion Multiply(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The Quaternion on the left side of the multiplication.

    Quaternion value2

    The Quaternion on the right side of the multiplication.

    Returns
    Type Description
    Quaternion

    The result of the multiplication.

    | Improve this Doc View Source

    Negate(Quaternion)

    Flips the sign of each component of the quaternion.

    Declaration
    public static Quaternion Negate(Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    The source Quaternion.

    Returns
    Type Description
    Quaternion

    The negated Quaternion.

    | Improve this Doc View Source

    Normalize(Quaternion)

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

    Declaration
    public static Quaternion Normalize(Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    The source Quaternion.

    Returns
    Type Description
    Quaternion

    The normalized Quaternion.

    | Improve this Doc View Source

    Slerp(Quaternion, Quaternion, Double)

    Interpolates between two quaternions, using spherical linear interpolation.

    Declaration
    public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, double amount)
    Parameters
    Type Name Description
    Quaternion quaternion1

    The first source Quaternion.

    Quaternion quaternion2

    The second source Quaternion.

    Double amount

    The relative weight of the second source Quaternion in the interpolation.

    Returns
    Type Description
    Quaternion

    The interpolated Quaternion.

    | Improve this Doc View Source

    Subtract(Quaternion, Quaternion)

    Subtracts one Quaternion from another.

    Declaration
    public static Quaternion Subtract(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first source Quaternion.

    Quaternion value2

    The second Quaternion, to be subtracted from the first.

    Returns
    Type Description
    Quaternion

    The result of the subtraction.

    | Improve this Doc View Source

    ToString()

    Returns a String representing this Quaternion instance.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String

    The string representation.

    Overrides
    Object.ToString()

    Operators

    | Improve this Doc View Source

    Addition(Quaternion, Quaternion)

    Adds two Quaternions element-by-element.

    Declaration
    public static Quaternion operator +(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first source Quaternion.

    Quaternion value2

    The second source Quaternion.

    Returns
    Type Description
    Quaternion

    The result of adding the Quaternions.

    | Improve this Doc View Source

    Division(Quaternion, Quaternion)

    Divides a Quaternion by another Quaternion.

    Declaration
    public static Quaternion operator /(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The source Quaternion.

    Quaternion value2

    The divisor.

    Returns
    Type Description
    Quaternion

    The result of the division.

    | Improve this Doc View Source

    Equality(Quaternion, Quaternion)

    Returns a boolean indicating whether the two given Quaternions are equal.

    Declaration
    public static bool operator ==(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first Quaternion to compare.

    Quaternion value2

    The second Quaternion to compare.

    Returns
    Type Description
    Boolean

    True if the Quaternions are equal; False otherwise.

    | Improve this Doc View Source

    Inequality(Quaternion, Quaternion)

    Returns a boolean indicating whether the two given Quaternions are not equal.

    Declaration
    public static bool operator !=(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first Quaternion to compare.

    Quaternion value2

    The second Quaternion to compare.

    Returns
    Type Description
    Boolean

    True if the Quaternions are not equal; False if they are equal.

    | Improve this Doc View Source

    Multiply(Quaternion, Double)

    Multiplies a Quaternion by a scalar value.

    Declaration
    public static Quaternion operator *(Quaternion value1, double value2)
    Parameters
    Type Name Description
    Quaternion value1

    The source Quaternion.

    Double value2

    The scalar value.

    Returns
    Type Description
    Quaternion

    The result of the multiplication.

    | Improve this Doc View Source

    Multiply(Quaternion, Quaternion)

    Multiplies two Quaternions together.

    Declaration
    public static Quaternion operator *(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The Quaternion on the left side of the multiplication.

    Quaternion value2

    The Quaternion on the right side of the multiplication.

    Returns
    Type Description
    Quaternion

    The result of the multiplication.

    | Improve this Doc View Source

    Subtraction(Quaternion, Quaternion)

    Subtracts one Quaternion from another.

    Declaration
    public static Quaternion operator -(Quaternion value1, Quaternion value2)
    Parameters
    Type Name Description
    Quaternion value1

    The first source Quaternion.

    Quaternion value2

    The second Quaternion, to be subtracted from the first.

    Returns
    Type Description
    Quaternion

    The result of the subtraction.

    | Improve this Doc View Source

    UnaryNegation(Quaternion)

    Flips the sign of each component of the quaternion.

    Declaration
    public static Quaternion operator -(Quaternion value)
    Parameters
    Type Name Description
    Quaternion value

    The source Quaternion.

    Returns
    Type Description
    Quaternion

    The negated Quaternion.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2018 nanoFramework Contributors
    Generated by DocFX