Show / Hide Table of Contents

    Struct Quaternion

    Represents a Quaternion.

    Implements
    System.IEquatable<Quaternion>
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: AGS.API
    Assembly: AGS.API.dll
    Syntax
    public struct Quaternion : IEquatable<Quaternion>

    Constructors

    | Improve this Doc View Source

    Quaternion(Vector3)

    Construct a new Quaternion from given Euler angles

    Declaration
    public Quaternion(Vector3 eulerAngles)
    Parameters
    Type Name Description
    Vector3 eulerAngles

    The euler angles as a Vector3

    | Improve this Doc View Source

    Quaternion(Vector3, Single)

    Construct a new Quaternion from vector and w components

    Declaration
    public Quaternion(Vector3 v, float w)
    Parameters
    Type Name Description
    Vector3 v

    The vector part

    System.Single w

    The w part

    | Improve this Doc View Source

    Quaternion(Single, Single, Single)

    Construct a new Quaternion from given Euler angles

    Declaration
    public Quaternion(float pitch, float yaw, float roll)
    Parameters
    Type Name Description
    System.Single pitch

    The pitch (attitude), rotation around X axis

    System.Single yaw

    The yaw (heading), rotation around Y axis

    System.Single roll

    The roll (bank), rotation around Z axis

    | Improve this Doc View Source

    Quaternion(Single, Single, Single, Single)

    Construct a new Quaternion

    Declaration
    public Quaternion(float x, float y, float z, float w)
    Parameters
    Type Name Description
    System.Single x

    The x component

    System.Single y

    The y component

    System.Single z

    The z component

    System.Single w

    The w component

    Fields

    | Improve this Doc View Source

    Identity

    Defines the identity quaternion.

    Declaration
    public static readonly Quaternion Identity
    Field Value
    Type Description
    Quaternion

    Properties

    | Improve this Doc View Source

    Length

    Gets the length (magnitude) of the quaternion.

    Declaration
    public float Length { get; }
    Property Value
    Type Description
    System.Single
    See Also
    LengthSquared
    | Improve this Doc View Source

    LengthSquared

    Gets the square of the quaternion length (magnitude).

    Declaration
    public float LengthSquared { get; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    W

    Gets or sets the W component of this instance.

    Declaration
    public float W { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    X

    Gets or sets the X component of this instance.

    Declaration
    public float X { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Xyz

    Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance.

    Declaration
    [CLSCompliant(false)]
    public Vector3 Xyz { get; set; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Y

    Gets or sets the Y component of this instance.

    Declaration
    public float Y { get; set; }
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Z

    Gets or sets the Z component of this instance.

    Declaration
    public float Z { get; set; }
    Property Value
    Type Description
    System.Single

    Methods

    | Improve this Doc View Source

    Add(Quaternion, Quaternion)

    Add two quaternions

    Declaration
    public static Quaternion Add(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first operand

    Quaternion right

    The second operand

    Returns
    Type Description
    Quaternion

    The result of the addition

    | Improve this Doc View Source

    Add(ref Quaternion, ref Quaternion, out Quaternion)

    Add two quaternions

    Declaration
    public static void Add(ref Quaternion left, ref Quaternion right, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion left

    The first operand

    Quaternion right

    The second operand

    Quaternion result

    The result of the addition

    | Improve this Doc View Source

    Conjugate()

    Inverts the Vector3 component of this Quaternion.

    Declaration
    public void Conjugate()
    | Improve this Doc View Source

    Conjugate(Quaternion)

    Get the conjugate of the given quaternion

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

    The quaternion

    Returns
    Type Description
    Quaternion

    The conjugate of the given quaternion

    | Improve this Doc View Source

    Conjugate(ref Quaternion, out Quaternion)

    Get the conjugate of the given quaternion

    Declaration
    public static void Conjugate(ref Quaternion q, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion q

    The quaternion

    Quaternion result

    The conjugate of the given quaternion

    | Improve this Doc View Source

    Equals(Quaternion)

    Compares this Quaternion instance to another Quaternion for equality.

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

    The other Quaternion to be used in the comparison.

    Returns
    Type Description
    System.Boolean

    True if both instances are equal; false otherwise.

    | Improve this Doc View Source

    Equals(Object)

    Compares this object instance to another object for equality.

    Declaration
    public override bool Equals(object other)
    Parameters
    Type Name Description
    System.Object other

    The other object to be used in the comparison.

    Returns
    Type Description
    System.Boolean

    True if both objects are Quaternions of equal value. Otherwise it returns false.

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

    FromAxisAngle(Vector3, Single)

    Build a quaternion from the given axis and angle

    Declaration
    public static Quaternion FromAxisAngle(Vector3 axis, float angle)
    Parameters
    Type Name Description
    Vector3 axis

    The axis to rotate about

    System.Single angle

    The rotation angle in radians

    Returns
    Type Description
    Quaternion

    The equivalent quaternion

    | Improve this Doc View Source

    FromEulerAngles(Vector3)

    Builds a Quaternion from the given euler angles

    Declaration
    public static Quaternion FromEulerAngles(Vector3 eulerAngles)
    Parameters
    Type Name Description
    Vector3 eulerAngles

    The euler angles as a vector

    Returns
    Type Description
    Quaternion

    The equivalent Quaternion

    | Improve this Doc View Source

    FromEulerAngles(ref Vector3, out Quaternion)

    Builds a Quaternion from the given euler angles

    Declaration
    public static void FromEulerAngles(ref Vector3 eulerAngles, out Quaternion result)
    Parameters
    Type Name Description
    Vector3 eulerAngles

    The euler angles a vector

    Quaternion result

    The equivalent Quaternion

    | Improve this Doc View Source

    FromEulerAngles(Single, Single, Single)

    Builds a Quaternion from the given euler angles

    Declaration
    public static Quaternion FromEulerAngles(float pitch, float yaw, float roll)
    Parameters
    Type Name Description
    System.Single pitch

    The pitch (attitude), rotation around X axis

    System.Single yaw

    The yaw (heading), rotation around Y axis

    System.Single roll

    The roll (bank), rotation around Z axis

    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    FromMatrix(Matrix3)

    Builds a quaternion from the given rotation matrix

    Declaration
    public static Quaternion FromMatrix(Matrix3 matrix)
    Parameters
    Type Name Description
    Matrix3 matrix

    A rotation matrix

    Returns
    Type Description
    Quaternion

    The equivalent quaternion

    | Improve this Doc View Source

    FromMatrix(ref Matrix3, out Quaternion)

    Builds a quaternion from the given rotation matrix

    Declaration
    public static void FromMatrix(ref Matrix3 matrix, out Quaternion result)
    Parameters
    Type Name Description
    Matrix3 matrix

    A rotation matrix

    Quaternion result

    The equivalent quaternion

    | Improve this Doc View Source

    GetHashCode()

    Provides the hash code for this object.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    A hash code formed from the bitwise XOR of this objects members.

    Overrides
    System.ValueType.GetHashCode()
    | Improve this Doc View Source

    Invert()

    Reverses the rotation angle of this Quaterniond.

    Declaration
    public void Invert()
    | Improve this Doc View Source

    Invert(Quaternion)

    Get the inverse of the given quaternion

    Declaration
    public static Quaternion Invert(Quaternion q)
    Parameters
    Type Name Description
    Quaternion q

    The quaternion to invert

    Returns
    Type Description
    Quaternion

    The inverse of the given quaternion

    | Improve this Doc View Source

    Invert(ref Quaternion, out Quaternion)

    Get the inverse of the given quaternion

    Declaration
    public static void Invert(ref Quaternion q, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion q

    The quaternion to invert

    Quaternion result

    The inverse of the given quaternion

    | Improve this Doc View Source

    Inverted()

    Returns a copy of this Quaterniond with its rotation angle reversed.

    Declaration
    public Quaternion Inverted()
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    Mult(Quaternion, Quaternion)

    Multiplies two instances.

    Declaration
    [Obsolete("Use Multiply instead.")]
    public static Quaternion Mult(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    Quaternion

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Mult(ref Quaternion, ref Quaternion, out Quaternion)

    Multiplies two instances.

    Declaration
    [Obsolete("Use Multiply instead.")]
    public static void Mult(ref Quaternion left, ref Quaternion right, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Quaternion result

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Multiply(Quaternion, Quaternion)

    Multiplies two instances.

    Declaration
    public static Quaternion Multiply(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    Quaternion

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Multiply(Quaternion, Single)

    Multiplies an instance by a scalar.

    Declaration
    public static Quaternion Multiply(Quaternion quaternion, float scale)
    Parameters
    Type Name Description
    Quaternion quaternion

    The instance.

    System.Single scale

    The scalar.

    Returns
    Type Description
    Quaternion

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Multiply(ref Quaternion, ref Quaternion, out Quaternion)

    Multiplies two instances.

    Declaration
    public static void Multiply(ref Quaternion left, ref Quaternion right, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Quaternion result

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Multiply(ref Quaternion, Single, out Quaternion)

    Multiplies an instance by a scalar.

    Declaration
    public static void Multiply(ref Quaternion quaternion, float scale, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion quaternion

    The instance.

    System.Single scale

    The scalar.

    Quaternion result

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Normalize()

    Scales the Quaternion to unit length.

    Declaration
    public void Normalize()
    | Improve this Doc View Source

    Normalize(Quaternion)

    Scale the given quaternion to unit length

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

    The quaternion to normalize

    Returns
    Type Description
    Quaternion

    The normalized quaternion

    | Improve this Doc View Source

    Normalize(ref Quaternion, out Quaternion)

    Scale the given quaternion to unit length

    Declaration
    public static void Normalize(ref Quaternion q, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion q

    The quaternion to normalize

    Quaternion result

    The normalized quaternion

    | Improve this Doc View Source

    Normalized()

    Returns a copy of the Quaternion scaled to unit length.

    Declaration
    public Quaternion Normalized()
    Returns
    Type Description
    Quaternion
    | Improve this Doc View Source

    Slerp(Quaternion, Quaternion, Single)

    Do Spherical linear interpolation between two quaternions

    Declaration
    public static Quaternion Slerp(Quaternion q1, Quaternion q2, float blend)
    Parameters
    Type Name Description
    Quaternion q1

    The first quaternion

    Quaternion q2

    The second quaternion

    System.Single blend

    The blend factor

    Returns
    Type Description
    Quaternion

    A smooth blend between the given quaternions

    | Improve this Doc View Source

    Sub(Quaternion, Quaternion)

    Subtracts two instances.

    Declaration
    public static Quaternion Sub(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The left instance.

    Quaternion right

    The right instance.

    Returns
    Type Description
    Quaternion

    The result of the operation.

    | Improve this Doc View Source

    Sub(ref Quaternion, ref Quaternion, out Quaternion)

    Subtracts two instances.

    Declaration
    public static void Sub(ref Quaternion left, ref Quaternion right, out Quaternion result)
    Parameters
    Type Name Description
    Quaternion left

    The left instance.

    Quaternion right

    The right instance.

    Quaternion result

    The result of the operation.

    | Improve this Doc View Source

    ToAxisAngle()

    Convert this instance to an axis-angle representation.

    Declaration
    public Vector4 ToAxisAngle()
    Returns
    Type Description
    Vector4

    A Vector4 that is the axis-angle representation of this quaternion.

    | Improve this Doc View Source

    ToAxisAngle(out Vector3, out Single)

    Convert the current quaternion to axis angle representation

    Declaration
    public void ToAxisAngle(out Vector3 axis, out float angle)
    Parameters
    Type Name Description
    Vector3 axis

    The resultant axis

    System.Single angle

    The resultant angle

    | Improve this Doc View Source

    ToString()

    Returns a System.String that represents the current Quaternion.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()

    Operators

    | Improve this Doc View Source

    Addition(Quaternion, Quaternion)

    Adds two instances.

    Declaration
    public static Quaternion operator +(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    Quaternion

    The result of the calculation.

    | Improve this Doc View Source

    Equality(Quaternion, Quaternion)

    Compares two instances for equality.

    Declaration
    public static bool operator ==(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left equals right; false otherwise.

    | Improve this Doc View Source

    Inequality(Quaternion, Quaternion)

    Compares two instances for inequality.

    Declaration
    public static bool operator !=(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left does not equal right; false otherwise.

    | Improve this Doc View Source

    Multiply(Quaternion, Quaternion)

    Multiplies two instances.

    Declaration
    public static Quaternion operator *(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    Quaternion

    The result of the calculation.

    | Improve this Doc View Source

    Multiply(Quaternion, Single)

    Multiplies an instance by a scalar.

    Declaration
    public static Quaternion operator *(Quaternion quaternion, float scale)
    Parameters
    Type Name Description
    Quaternion quaternion

    The instance.

    System.Single scale

    The scalar.

    Returns
    Type Description
    Quaternion

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Multiply(Single, Quaternion)

    Multiplies an instance by a scalar.

    Declaration
    public static Quaternion operator *(float scale, Quaternion quaternion)
    Parameters
    Type Name Description
    System.Single scale

    The scalar.

    Quaternion quaternion

    The instance.

    Returns
    Type Description
    Quaternion

    A new instance containing the result of the calculation.

    | Improve this Doc View Source

    Subtraction(Quaternion, Quaternion)

    Subtracts two instances.

    Declaration
    public static Quaternion operator -(Quaternion left, Quaternion right)
    Parameters
    Type Name Description
    Quaternion left

    The first instance.

    Quaternion right

    The second instance.

    Returns
    Type Description
    Quaternion

    The result of the calculation.

    Implements

    System.IEquatable<T>
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX