Show / Hide Table of Contents

    Struct Vector3

    Represents a 3D vector using three single-precision floating-point numbers.

    Implements
    System.IEquatable<Vector3>
    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 Vector3 : IEquatable<Vector3>
    Remarks

    The Vector3 structure is suitable for interoperation with unmanaged code requiring three consecutive floats.

    Constructors

    | Improve this Doc View Source

    Vector3(Vector2)

    Constructs a new Vector3 from the given Vector2.

    Declaration
    public Vector3(Vector2 v)
    Parameters
    Type Name Description
    Vector2 v

    The Vector2 to copy components from.

    | Improve this Doc View Source

    Vector3(Vector3)

    Constructs a new Vector3 from the given Vector3.

    Declaration
    public Vector3(Vector3 v)
    Parameters
    Type Name Description
    Vector3 v

    The Vector3 to copy components from.

    | Improve this Doc View Source

    Vector3(Vector4)

    Constructs a new Vector3 from the given Vector4.

    Declaration
    public Vector3(Vector4 v)
    Parameters
    Type Name Description
    Vector4 v

    The Vector4 to copy components from.

    | Improve this Doc View Source

    Vector3(Single)

    Constructs a new instance.

    Declaration
    public Vector3(float value)
    Parameters
    Type Name Description
    System.Single value

    The value that will initialize this instance.

    | Improve this Doc View Source

    Vector3(Single, Single, Single)

    Constructs a new Vector3.

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

    The x component of the Vector3.

    System.Single y

    The y component of the Vector3.

    System.Single z

    The z component of the Vector3.

    Fields

    | Improve this Doc View Source

    One

    Defines an instance with all components set to 1.

    Declaration
    public static readonly Vector3 One
    Field Value
    Type Description
    Vector3
    | Improve this Doc View Source

    SizeInBytes

    Defines the size of the Vector3 struct in bytes.

    Declaration
    public static readonly int SizeInBytes
    Field Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    UnitX

    Defines a unit-length Vector3 that points towards the X-axis.

    Declaration
    public static readonly Vector3 UnitX
    Field Value
    Type Description
    Vector3
    | Improve this Doc View Source

    UnitY

    Defines a unit-length Vector3 that points towards the Y-axis.

    Declaration
    public static readonly Vector3 UnitY
    Field Value
    Type Description
    Vector3
    | Improve this Doc View Source

    UnitZ

    /// Defines a unit-length Vector3 that points towards the Z-axis.

    Declaration
    public static readonly Vector3 UnitZ
    Field Value
    Type Description
    Vector3
    | Improve this Doc View Source

    X

    The X component of the Vector3.

    Declaration
    public float X
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Y

    The Y component of the Vector3.

    Declaration
    public float Y
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Z

    The Z component of the Vector3.

    Declaration
    public float Z
    Field Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Zero

    Defines a zero-length Vector3.

    Declaration
    public static readonly Vector3 Zero
    Field Value
    Type Description
    Vector3

    Properties

    | Improve this Doc View Source

    Item[Int32]

    Gets or sets the value at the index of the Vector.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type Description
    System.Single
    | Improve this Doc View Source

    Length

    Gets the length (magnitude) of the vector.

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

    LengthFast

    Gets an approximation of the vector length (magnitude).

    Declaration
    public float LengthFast { get; }
    Property Value
    Type Description
    System.Single
    Remarks

    This property uses an approximation of the square root function to calculate vector magnitude, with an upper error bound of 0.001.

    See Also
    LengthSquared
    | Improve this Doc View Source

    LengthSquared

    Gets the square of the vector length (magnitude).

    Declaration
    public float LengthSquared { get; }
    Property Value
    Type Description
    System.Single
    Remarks

    This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.

    See Also
    LengthFast
    | Improve this Doc View Source

    Xy

    Gets or sets an OpenTK.Vector2 with the X and Y components of this instance.

    Declaration
    public Vector2 Xy { get; set; }
    Property Value
    Type Description
    Vector2
    | Improve this Doc View Source

    Xz

    Gets or sets an OpenTK.Vector2 with the X and Z components of this instance.

    Declaration
    public Vector2 Xz { get; set; }
    Property Value
    Type Description
    Vector2
    | Improve this Doc View Source

    Xzy

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

    Declaration
    public Vector3 Xzy { get; set; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Yx

    Gets or sets an OpenTK.Vector2 with the Y and X components of this instance.

    Declaration
    public Vector2 Yx { get; set; }
    Property Value
    Type Description
    Vector2
    | Improve this Doc View Source

    Yxz

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

    Declaration
    public Vector3 Yxz { get; set; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Yz

    Gets or sets an OpenTK.Vector2 with the Y and Z components of this instance.

    Declaration
    public Vector2 Yz { get; set; }
    Property Value
    Type Description
    Vector2
    | Improve this Doc View Source

    Yzx

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

    Declaration
    public Vector3 Yzx { get; set; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Zx

    Gets or sets an OpenTK.Vector2 with the Z and X components of this instance.

    Declaration
    public Vector2 Zx { get; set; }
    Property Value
    Type Description
    Vector2
    | Improve this Doc View Source

    Zxy

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

    Declaration
    public Vector3 Zxy { get; set; }
    Property Value
    Type Description
    Vector3
    | Improve this Doc View Source

    Zy

    Gets or sets an OpenTK.Vector2 with the Z and Y components of this instance.

    Declaration
    public Vector2 Zy { get; set; }
    Property Value
    Type Description
    Vector2
    | Improve this Doc View Source

    Zyx

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

    Declaration
    public Vector3 Zyx { get; set; }
    Property Value
    Type Description
    Vector3

    Methods

    | Improve this Doc View Source

    Add(Vector3)

    Add the Vector passed as parameter to this instance.

    Declaration
    [CLSCompliant(false)]
    [Obsolete("Use static Add() method instead.")]
    public void Add(Vector3 right)
    Parameters
    Type Name Description
    Vector3 right

    Right operand. This parameter is only read from.

    | Improve this Doc View Source

    Add(Vector3, Vector3)

    Adds two vectors.

    Declaration
    public static Vector3 Add(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    Left operand.

    Vector3 b

    Right operand.

    Returns
    Type Description
    Vector3

    Result of operation.

    | Improve this Doc View Source

    Add(ref Vector3)

    Add the Vector passed as parameter to this instance.

    Declaration
    [CLSCompliant(false)]
    [Obsolete("Use static Add() method instead.")]
    public void Add(ref Vector3 right)
    Parameters
    Type Name Description
    Vector3 right

    Right operand. This parameter is only read from.

    | Improve this Doc View Source

    Add(ref Vector3, ref Vector3, out Vector3)

    Adds two vectors.

    Declaration
    public static void Add(ref Vector3 a, ref Vector3 b, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    Left operand.

    Vector3 b

    Right operand.

    Vector3 result

    Result of operation.

    | Improve this Doc View Source

    BaryCentric(Vector3, Vector3, Vector3, Single, Single)

    Interpolate 3 Vectors using Barycentric coordinates

    Declaration
    public static Vector3 BaryCentric(Vector3 a, Vector3 b, Vector3 c, float u, float v)
    Parameters
    Type Name Description
    Vector3 a

    First input Vector

    Vector3 b

    Second input Vector

    Vector3 c

    Third input Vector

    System.Single u

    First Barycentric Coordinate

    System.Single v

    Second Barycentric Coordinate

    Returns
    Type Description
    Vector3

    a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise

    | Improve this Doc View Source

    BaryCentric(ref Vector3, ref Vector3, ref Vector3, Single, Single, out Vector3)

    Interpolate 3 Vectors using Barycentric coordinates

    Declaration
    public static void BaryCentric(ref Vector3 a, ref Vector3 b, ref Vector3 c, float u, float v, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    First input Vector.

    Vector3 b

    Second input Vector.

    Vector3 c

    Third input Vector.

    System.Single u

    First Barycentric Coordinate.

    System.Single v

    Second Barycentric Coordinate.

    Vector3 result

    Output Vector. a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise

    | Improve this Doc View Source

    CalculateAngle(Vector3, Vector3)

    Calculates the angle (in radians) between two vectors.

    Declaration
    public static float CalculateAngle(Vector3 first, Vector3 second)
    Parameters
    Type Name Description
    Vector3 first

    The first vector.

    Vector3 second

    The second vector.

    Returns
    Type Description
    System.Single

    Angle (in radians) between the vectors.

    Remarks

    Note that the returned angle is never bigger than the constant Pi.

    | Improve this Doc View Source

    CalculateAngle(ref Vector3, ref Vector3, out Single)

    Calculates the angle (in radians) between two vectors.

    Declaration
    public static void CalculateAngle(ref Vector3 first, ref Vector3 second, out float result)
    Parameters
    Type Name Description
    Vector3 first

    The first vector.

    Vector3 second

    The second vector.

    System.Single result

    Angle (in radians) between the vectors.

    Remarks

    Note that the returned angle is never bigger than the constant Pi.

    | Improve this Doc View Source

    Clamp(Vector3, Vector3, Vector3)

    Clamp a vector to the given minimum and maximum vectors

    Declaration
    public static Vector3 Clamp(Vector3 vec, Vector3 min, Vector3 max)
    Parameters
    Type Name Description
    Vector3 vec

    Input vector

    Vector3 min

    Minimum vector

    Vector3 max

    Maximum vector

    Returns
    Type Description
    Vector3

    The clamped vector

    | Improve this Doc View Source

    Clamp(ref Vector3, ref Vector3, ref Vector3, out Vector3)

    Clamp a vector to the given minimum and maximum vectors

    Declaration
    public static void Clamp(ref Vector3 vec, ref Vector3 min, ref Vector3 max, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    Input vector

    Vector3 min

    Minimum vector

    Vector3 max

    Maximum vector

    Vector3 result

    The clamped vector

    | Improve this Doc View Source

    ComponentMax(Vector3, Vector3)

    Calculate the component-wise maximum of two vectors

    Declaration
    public static Vector3 ComponentMax(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Returns
    Type Description
    Vector3

    The component-wise maximum

    | Improve this Doc View Source

    ComponentMax(ref Vector3, ref Vector3, out Vector3)

    Calculate the component-wise maximum of two vectors

    Declaration
    public static void ComponentMax(ref Vector3 a, ref Vector3 b, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Vector3 result

    The component-wise maximum

    | Improve this Doc View Source

    ComponentMin(Vector3, Vector3)

    Calculate the component-wise minimum of two vectors

    Declaration
    public static Vector3 ComponentMin(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Returns
    Type Description
    Vector3

    The component-wise minimum

    | Improve this Doc View Source

    ComponentMin(ref Vector3, ref Vector3, out Vector3)

    Calculate the component-wise minimum of two vectors

    Declaration
    public static void ComponentMin(ref Vector3 a, ref Vector3 b, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Vector3 result

    The component-wise minimum

    | Improve this Doc View Source

    Cross(Vector3, Vector3)

    Caclulate the cross (vector) product of two vectors

    Declaration
    public static Vector3 Cross(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    First operand

    Vector3 right

    Second operand

    Returns
    Type Description
    Vector3

    The cross product of the two inputs

    | Improve this Doc View Source

    Cross(ref Vector3, ref Vector3, out Vector3)

    Caclulate the cross (vector) product of two vectors

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

    First operand

    Vector3 right

    Second operand

    Vector3 result

    The cross product of the two inputs

    | Improve this Doc View Source

    Div(Vector3, Single)

    Divide a vector by a scalar

    Declaration
    [Obsolete("Use static Divide() method instead.")]
    public static Vector3 Div(Vector3 a, float f)
    Parameters
    Type Name Description
    Vector3 a

    Vector operand

    System.Single f

    Scalar operand

    Returns
    Type Description
    Vector3

    Result of the division

    | Improve this Doc View Source

    Div(ref Vector3, Single, out Vector3)

    Divide a vector by a scalar

    Declaration
    [Obsolete("Use static Divide() method instead.")]
    public static void Div(ref Vector3 a, float f, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    Vector operand

    System.Single f

    Scalar operand

    Vector3 result

    Result of the division

    | Improve this Doc View Source

    Div(Single)

    Divide this instance by a scalar.

    Declaration
    [Obsolete("Use static Divide() method instead.")]
    public void Div(float f)
    Parameters
    Type Name Description
    System.Single f

    Scalar operand.

    | Improve this Doc View Source

    Divide(Vector3, Vector3)

    Divides a vector by the components of a vector (scale).

    Declaration
    public static Vector3 Divide(Vector3 vector, Vector3 scale)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    Vector3 scale

    Right operand.

    Returns
    Type Description
    Vector3

    Result of the operation.

    | Improve this Doc View Source

    Divide(Vector3, Single)

    Divides a vector by a scalar.

    Declaration
    public static Vector3 Divide(Vector3 vector, float scale)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    System.Single scale

    Right operand.

    Returns
    Type Description
    Vector3

    Result of the operation.

    | Improve this Doc View Source

    Divide(ref Vector3, ref Vector3, out Vector3)

    Divide a vector by the components of a vector (scale).

    Declaration
    public static void Divide(ref Vector3 vector, ref Vector3 scale, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    Vector3 scale

    Right operand.

    Vector3 result

    Result of the operation.

    | Improve this Doc View Source

    Divide(ref Vector3, Single, out Vector3)

    Divides a vector by a scalar.

    Declaration
    public static void Divide(ref Vector3 vector, float scale, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    System.Single scale

    Right operand.

    Vector3 result

    Result of the operation.

    | Improve this Doc View Source

    Dot(Vector3, Vector3)

    Calculate the dot (scalar) product of two vectors

    Declaration
    public static float Dot(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    First operand

    Vector3 right

    Second operand

    Returns
    Type Description
    System.Single

    The dot product of the two inputs

    | Improve this Doc View Source

    Dot(ref Vector3, ref Vector3, out Single)

    Calculate the dot (scalar) product of two vectors

    Declaration
    public static void Dot(ref Vector3 left, ref Vector3 right, out float result)
    Parameters
    Type Name Description
    Vector3 left

    First operand

    Vector3 right

    Second operand

    System.Single result

    The dot product of the two inputs

    | Improve this Doc View Source

    Equals(Vector3)

    Indicates whether the current vector is equal to another vector.

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

    A vector to compare with this vector.

    Returns
    Type Description
    System.Boolean

    true if the current vector is equal to the vector parameter; otherwise, false.

    | Improve this Doc View Source

    Equals(Object)

    Indicates whether this instance and a specified object are equal.

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

    The object to compare to.

    Returns
    Type Description
    System.Boolean

    True if the instances are equal; false otherwise.

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

    GetHashCode()

    Returns the hashcode for this instance.

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

    A System.Int32 containing the unique hashcode for this instance.

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

    Lerp(Vector3, Vector3, Single)

    Returns a new Vector that is the linear blend of the 2 given Vectors

    Declaration
    public static Vector3 Lerp(Vector3 a, Vector3 b, float blend)
    Parameters
    Type Name Description
    Vector3 a

    First input vector

    Vector3 b

    Second input vector

    System.Single blend

    The blend factor. a when blend=0, b when blend=1.

    Returns
    Type Description
    Vector3

    a when blend=0, b when blend=1, and a linear combination otherwise

    | Improve this Doc View Source

    Lerp(ref Vector3, ref Vector3, Single, out Vector3)

    Returns a new Vector that is the linear blend of the 2 given Vectors

    Declaration
    public static void Lerp(ref Vector3 a, ref Vector3 b, float blend, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    First input vector

    Vector3 b

    Second input vector

    System.Single blend

    The blend factor. a when blend=0, b when blend=1.

    Vector3 result

    a when blend=0, b when blend=1, and a linear combination otherwise

    | Improve this Doc View Source

    Max(Vector3, Vector3)

    Returns the Vector3 with the minimum magnitude

    Declaration
    public static Vector3 Max(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    Left operand

    Vector3 right

    Right operand

    Returns
    Type Description
    Vector3

    The minimum Vector3

    | Improve this Doc View Source

    Min(Vector3, Vector3)

    Returns the Vector3 with the minimum magnitude

    Declaration
    public static Vector3 Min(Vector3 left, Vector3 right)
    Parameters
    Type Name Description
    Vector3 left

    Left operand

    Vector3 right

    Right operand

    Returns
    Type Description
    Vector3

    The minimum Vector3

    | Improve this Doc View Source

    Mult(Vector3, Single)

    Multiply a vector and a scalar

    Declaration
    [Obsolete("Use static Multiply() method instead.")]
    public static Vector3 Mult(Vector3 a, float f)
    Parameters
    Type Name Description
    Vector3 a

    Vector operand

    System.Single f

    Scalar operand

    Returns
    Type Description
    Vector3

    Result of the multiplication

    | Improve this Doc View Source

    Mult(ref Vector3, Single, out Vector3)

    Multiply a vector and a scalar

    Declaration
    [Obsolete("Use static Multiply() method instead.")]
    public static void Mult(ref Vector3 a, float f, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    Vector operand

    System.Single f

    Scalar operand

    Vector3 result

    Result of the multiplication

    | Improve this Doc View Source

    Mult(Single)

    Multiply this instance by a scalar.

    Declaration
    [Obsolete("Use static Multiply() method instead.")]
    public void Mult(float f)
    Parameters
    Type Name Description
    System.Single f

    Scalar operand.

    | Improve this Doc View Source

    Multiply(Vector3, Vector3)

    Multiplies a vector by the components a vector (scale).

    Declaration
    public static Vector3 Multiply(Vector3 vector, Vector3 scale)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    Vector3 scale

    Right operand.

    Returns
    Type Description
    Vector3

    Result of the operation.

    | Improve this Doc View Source

    Multiply(Vector3, Single)

    Multiplies a vector by a scalar.

    Declaration
    public static Vector3 Multiply(Vector3 vector, float scale)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    System.Single scale

    Right operand.

    Returns
    Type Description
    Vector3

    Result of the operation.

    | Improve this Doc View Source

    Multiply(ref Vector3, ref Vector3, out Vector3)

    Multiplies a vector by the components of a vector (scale).

    Declaration
    public static void Multiply(ref Vector3 vector, ref Vector3 scale, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vector

    Left operand.

    Vector3 scale

    Right operand.

    Vector3 result

    Result of the operation.

    | Improve this Doc View Source

    Multiply(ref Vector3, Single, out Vector3)

    Multiplies a vector by a scalar.

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

    Left operand.

    System.Single scale

    Right operand.

    Vector3 result

    Result of the operation.

    | Improve this Doc View Source

    Normalize()

    Scales the Vector3 to unit length.

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

    Normalize(Vector3)

    Scale a vector to unit length

    Declaration
    public static Vector3 Normalize(Vector3 vec)
    Parameters
    Type Name Description
    Vector3 vec

    The input vector

    Returns
    Type Description
    Vector3

    The normalized vector

    | Improve this Doc View Source

    Normalize(ref Vector3, out Vector3)

    Scale a vector to unit length

    Declaration
    public static void Normalize(ref Vector3 vec, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    The input vector

    Vector3 result

    The normalized vector

    | Improve this Doc View Source

    Normalized()

    Returns a copy of the Vector3 scaled to unit length.

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

    NormalizeFast()

    Scales the Vector3 to approximately unit length.

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

    NormalizeFast(Vector3)

    Scale a vector to approximately unit length

    Declaration
    public static Vector3 NormalizeFast(Vector3 vec)
    Parameters
    Type Name Description
    Vector3 vec

    The input vector

    Returns
    Type Description
    Vector3

    The normalized vector

    | Improve this Doc View Source

    NormalizeFast(ref Vector3, out Vector3)

    Scale a vector to approximately unit length

    Declaration
    public static void NormalizeFast(ref Vector3 vec, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    The input vector

    Vector3 result

    The normalized vector

    | Improve this Doc View Source

    Project(Vector3, Single, Single, Single, Single, Single, Single, Matrix4)

    Projects a vector from object space into screen space.

    Declaration
    public static Vector3 Project(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix4 worldViewProjection)
    Parameters
    Type Name Description
    Vector3 vector

    The vector to project.

    System.Single x

    The X coordinate of the viewport.

    System.Single y

    The Y coordinate of the viewport.

    System.Single width

    The width of the viewport.

    System.Single height

    The height of the viewport.

    System.Single minZ

    The minimum depth of the viewport.

    System.Single maxZ

    The maximum depth of the viewport.

    Matrix4 worldViewProjection

    The world-view-projection matrix.

    Returns
    Type Description
    Vector3

    The vector in screen space.

    Remarks

    To project to normalized device coordinates (NDC) use the following parameters: Project(vector, -1, -1, 2, 2, -1, 1, worldViewProjection).

    | Improve this Doc View Source

    Scale(Vector3)

    Scales this instance by the given parameter.

    Declaration
    [CLSCompliant(false)]
    [Obsolete("Use static Multiply() method instead.")]
    public void Scale(Vector3 scale)
    Parameters
    Type Name Description
    Vector3 scale

    The scaling of the individual components.

    | Improve this Doc View Source

    Scale(ref Vector3)

    Scales this instance by the given parameter.

    Declaration
    [CLSCompliant(false)]
    [Obsolete("Use static Multiply() method instead.")]
    public void Scale(ref Vector3 scale)
    Parameters
    Type Name Description
    Vector3 scale

    The scaling of the individual components.

    | Improve this Doc View Source

    Scale(Single, Single, Single)

    Scales the current Vector3 by the given amounts.

    Declaration
    [Obsolete("Use static Multiply() method instead.")]
    public void Scale(float sx, float sy, float sz)
    Parameters
    Type Name Description
    System.Single sx

    The scale of the X component.

    System.Single sy

    The scale of the Y component.

    System.Single sz

    The scale of the Z component.

    | Improve this Doc View Source

    Sub(Vector3)

    Subtract the Vector passed as parameter from this instance.

    Declaration
    [CLSCompliant(false)]
    [Obsolete("Use static Subtract() method instead.")]
    public void Sub(Vector3 right)
    Parameters
    Type Name Description
    Vector3 right

    Right operand. This parameter is only read from.

    | Improve this Doc View Source

    Sub(Vector3, Vector3)

    Subtract one Vector from another

    Declaration
    [Obsolete("Use static Subtract() method instead.")]
    public static Vector3 Sub(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Returns
    Type Description
    Vector3

    Result of subtraction

    | Improve this Doc View Source

    Sub(ref Vector3)

    Subtract the Vector passed as parameter from this instance.

    Declaration
    [CLSCompliant(false)]
    [Obsolete("Use static Subtract() method instead.")]
    public void Sub(ref Vector3 right)
    Parameters
    Type Name Description
    Vector3 right

    Right operand. This parameter is only read from.

    | Improve this Doc View Source

    Sub(ref Vector3, ref Vector3, out Vector3)

    Subtract one Vector from another

    Declaration
    [Obsolete("Use static Subtract() method instead.")]
    public static void Sub(ref Vector3 a, ref Vector3 b, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Vector3 result

    Result of subtraction

    | Improve this Doc View Source

    Subtract(Vector3, Vector3)

    Subtract one Vector from another

    Declaration
    public static Vector3 Subtract(Vector3 a, Vector3 b)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Returns
    Type Description
    Vector3

    Result of subtraction

    | Improve this Doc View Source

    Subtract(ref Vector3, ref Vector3, out Vector3)

    Subtract one Vector from another

    Declaration
    public static void Subtract(ref Vector3 a, ref Vector3 b, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 a

    First operand

    Vector3 b

    Second operand

    Vector3 result

    Result of subtraction

    | Improve this Doc View Source

    ToString()

    Returns a System.String that represents the current Vector3.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.ValueType.ToString()
    | Improve this Doc View Source

    Transform(Matrix3, Vector3)

    Transform a Vector by the given Matrix using right-handed notation

    Declaration
    public static Vector3 Transform(Matrix3 mat, Vector3 vec)
    Parameters
    Type Name Description
    Matrix3 mat

    The desired transformation

    Vector3 vec

    The vector to transform

    Returns
    Type Description
    Vector3
    | Improve this Doc View Source

    Transform(ref Matrix3, ref Vector3, out Vector3)

    Transform a Vector by the given Matrix using right-handed notation

    Declaration
    public static void Transform(ref Matrix3 mat, ref Vector3 vec, out Vector3 result)
    Parameters
    Type Name Description
    Matrix3 mat

    The desired transformation

    Vector3 vec

    The vector to transform

    Vector3 result

    The transformed vector

    | Improve this Doc View Source

    Transform(Vector3, Matrix3)

    Transform a Vector by the given Matrix

    Declaration
    public static Vector3 Transform(Vector3 vec, Matrix3 mat)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix3 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed vector

    | Improve this Doc View Source

    Transform(Vector3, Matrix4)

    Transform a direction vector by the given Matrix Assumes the matrix has a bottom row of (0,0,0,1), that is the translation part is ignored.

    Declaration
    public static Vector3 Transform(Vector3 vec, Matrix4 mat)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix4 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed vector

    | Improve this Doc View Source

    Transform(Vector3, Quaternion)

    Transforms a vector by a quaternion rotation.

    Declaration
    public static Vector3 Transform(Vector3 vec, Quaternion quat)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform.

    Quaternion quat

    The quaternion to rotate the vector by.

    Returns
    Type Description
    Vector3

    The result of the operation.

    | Improve this Doc View Source

    Transform(ref Vector3, ref Matrix3, out Vector3)

    Transform a Vector by the given Matrix

    Declaration
    public static void Transform(ref Vector3 vec, ref Matrix3 mat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix3 mat

    The desired transformation

    Vector3 result

    The transformed vector

    | Improve this Doc View Source

    Transform(ref Vector3, ref Matrix4, out Vector3)

    Declaration
    public static void Transform(ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec
    Matrix4 mat
    Vector3 result
    | Improve this Doc View Source

    Transform(ref Vector3, ref Quaternion, out Vector3)

    Transforms a vector by a quaternion rotation.

    Declaration
    public static void Transform(ref Vector3 vec, ref Quaternion quat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform.

    Quaternion quat

    The quaternion to rotate the vector by.

    Vector3 result

    The result of the operation.

    | Improve this Doc View Source

    TransformNormal(Vector3, Matrix4)

    Transform a Normal by the given Matrix

    Declaration
    public static Vector3 TransformNormal(Vector3 norm, Matrix4 mat)
    Parameters
    Type Name Description
    Vector3 norm

    The normal to transform

    Matrix4 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed normal

    Remarks

    This calculates the inverse of the given matrix, use TransformNormalInverse if you already have the inverse to avoid this extra calculation

    | Improve this Doc View Source

    TransformNormal(ref Vector3, ref Matrix4, out Vector3)

    Transform a Normal by the given Matrix

    Declaration
    public static void TransformNormal(ref Vector3 norm, ref Matrix4 mat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 norm

    The normal to transform

    Matrix4 mat

    The desired transformation

    Vector3 result

    The transformed normal

    Remarks

    This calculates the inverse of the given matrix, use TransformNormalInverse if you already have the inverse to avoid this extra calculation

    | Improve this Doc View Source

    TransformNormalInverse(Vector3, Matrix4)

    Transform a Normal by the (transpose of the) given Matrix

    Declaration
    public static Vector3 TransformNormalInverse(Vector3 norm, Matrix4 invMat)
    Parameters
    Type Name Description
    Vector3 norm

    The normal to transform

    Matrix4 invMat

    The inverse of the desired transformation

    Returns
    Type Description
    Vector3

    The transformed normal

    Remarks

    This version doesn't calculate the inverse matrix. Use this version if you already have the inverse of the desired transform to hand

    | Improve this Doc View Source

    TransformNormalInverse(ref Vector3, ref Matrix4, out Vector3)

    Transform a Normal by the (transpose of the) given Matrix

    Declaration
    public static void TransformNormalInverse(ref Vector3 norm, ref Matrix4 invMat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 norm

    The normal to transform

    Matrix4 invMat

    The inverse of the desired transformation

    Vector3 result

    The transformed normal

    Remarks

    This version doesn't calculate the inverse matrix. Use this version if you already have the inverse of the desired transform to hand

    | Improve this Doc View Source

    TransformPerspective(Vector3, Matrix4)

    Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3

    Declaration
    public static Vector3 TransformPerspective(Vector3 vec, Matrix4 mat)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix4 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed vector

    | Improve this Doc View Source

    TransformPerspective(ref Vector3, ref Matrix4, out Vector3)

    Transform a Vector3 by the given Matrix, and project the resulting Vector4 back to a Vector3

    Declaration
    public static void TransformPerspective(ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix4 mat

    The desired transformation

    Vector3 result

    The transformed vector

    | Improve this Doc View Source

    TransformPosition(Vector3, Matrix4)

    Transform a Position by the given Matrix

    Declaration
    public static Vector3 TransformPosition(Vector3 pos, Matrix4 mat)
    Parameters
    Type Name Description
    Vector3 pos

    The position to transform

    Matrix4 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed position

    | Improve this Doc View Source

    TransformPosition(ref Vector3, ref Matrix4, out Vector3)

    Transform a Position by the given Matrix

    Declaration
    public static void TransformPosition(ref Vector3 pos, ref Matrix4 mat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 pos

    The position to transform

    Matrix4 mat

    The desired transformation

    Vector3 result

    The transformed position

    | Improve this Doc View Source

    TransformVector(Vector3, Matrix4)

    Transform a direction vector by the given Matrix Assumes the matrix has a bottom row of (0,0,0,1), that is the translation part is ignored.

    Declaration
    public static Vector3 TransformVector(Vector3 vec, Matrix4 mat)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix4 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed vector

    | Improve this Doc View Source

    TransformVector(ref Vector3, ref Matrix4, out Vector3)

    Transform a direction vector by the given Matrix Assumes the matrix has a bottom row of (0,0,0,1), that is the translation part is ignored.

    Declaration
    public static void TransformVector(ref Vector3 vec, ref Matrix4 mat, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix4 mat

    The desired transformation

    Vector3 result

    The transformed vector

    | Improve this Doc View Source

    Unproject(Vector3, Single, Single, Single, Single, Single, Single, Matrix4)

    Projects a vector from screen space into object space.

    Declaration
    public static Vector3 Unproject(Vector3 vector, float x, float y, float width, float height, float minZ, float maxZ, Matrix4 inverseWorldViewProjection)
    Parameters
    Type Name Description
    Vector3 vector

    The vector to project.

    System.Single x

    The X coordinate of the viewport.

    System.Single y

    The Y coordinate of the viewport.

    System.Single width

    The width of the viewport.

    System.Single height

    The height of the viewport.

    System.Single minZ

    The minimum depth of the viewport.

    System.Single maxZ

    The maximum depth of the viewport.

    Matrix4 inverseWorldViewProjection
    Returns
    Type Description
    Vector3

    The vector in object space.

    Remarks

    To project from normalized device coordinates (NDC) use the following parameters: Project(vector, -1, -1, 2, 2, -1, 1, inverseWorldViewProjection).

    Operators

    | Improve this Doc View Source

    Addition(Vector3, Vector3)

    Adds two instances.

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

    The first instance.

    Vector3 right

    The second instance.

    Returns
    Type Description
    Vector3

    The result of the calculation.

    | Improve this Doc View Source

    Division(Vector3, Single)

    Divides an instance by a scalar.

    Declaration
    public static Vector3 operator /(Vector3 vec, float scale)
    Parameters
    Type Name Description
    Vector3 vec

    The instance.

    System.Single scale

    The scalar.

    Returns
    Type Description
    Vector3

    The result of the calculation.

    | Improve this Doc View Source

    Equality(Vector3, Vector3)

    Compares two instances for equality.

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

    The first instance.

    Vector3 right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left equals right; false otherwise.

    | Improve this Doc View Source

    Inequality(Vector3, Vector3)

    Compares two instances for inequality.

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

    The first instance.

    Vector3 right

    The second instance.

    Returns
    Type Description
    System.Boolean

    True, if left does not equa lright; false otherwise.

    | Improve this Doc View Source

    Multiply(Matrix3, Vector3)

    Transform a Vector by the given Matrix using right-handed notation

    Declaration
    public static Vector3 operator *(Matrix3 mat, Vector3 vec)
    Parameters
    Type Name Description
    Matrix3 mat

    The desired transformation

    Vector3 vec

    The vector to transform

    Returns
    Type Description
    Vector3

    The transformed vector

    | Improve this Doc View Source

    Multiply(Quaternion, Vector3)

    Transforms a vector by a quaternion rotation.

    Declaration
    public static Vector3 operator *(Quaternion quat, Vector3 vec)
    Parameters
    Type Name Description
    Quaternion quat

    The quaternion to rotate the vector by.

    Vector3 vec

    The vector to transform.

    Returns
    Type Description
    Vector3
    | Improve this Doc View Source

    Multiply(Vector3, Matrix3)

    Transform a Vector by the given Matrix.

    Declaration
    public static Vector3 operator *(Vector3 vec, Matrix3 mat)
    Parameters
    Type Name Description
    Vector3 vec

    The vector to transform

    Matrix3 mat

    The desired transformation

    Returns
    Type Description
    Vector3

    The transformed vector

    | Improve this Doc View Source

    Multiply(Vector3, Vector3)

    Component-wise multiplication between the specified instance by a scale vector.

    Declaration
    public static Vector3 operator *(Vector3 vec, Vector3 scale)
    Parameters
    Type Name Description
    Vector3 vec

    Right operand.

    Vector3 scale

    Left operand.

    Returns
    Type Description
    Vector3

    Result of multiplication.

    | Improve this Doc View Source

    Multiply(Vector3, Single)

    Multiplies an instance by a scalar.

    Declaration
    public static Vector3 operator *(Vector3 vec, float scale)
    Parameters
    Type Name Description
    Vector3 vec

    The instance.

    System.Single scale

    The scalar.

    Returns
    Type Description
    Vector3

    The result of the calculation.

    | Improve this Doc View Source

    Multiply(Single, Vector3)

    Multiplies an instance by a scalar.

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

    The scalar.

    Vector3 vec

    The instance.

    Returns
    Type Description
    Vector3

    The result of the calculation.

    | Improve this Doc View Source

    Subtraction(Vector3, Vector3)

    Subtracts two instances.

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

    The first instance.

    Vector3 right

    The second instance.

    Returns
    Type Description
    Vector3

    The result of the calculation.

    | Improve this Doc View Source

    UnaryNegation(Vector3)

    Negates an instance.

    Declaration
    public static Vector3 operator -(Vector3 vec)
    Parameters
    Type Name Description
    Vector3 vec

    The instance.

    Returns
    Type Description
    Vector3

    The result of the calculation.

    Implements

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