Search Results for

    Show / Hide Table of Contents

    Class Vector4

    Represents a four dimensional mathematical vector.

    Inheritance
    System.Object
    Vector4
    Implements
    System.IEquatable<Vector4>
    System.IFormattable
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [Unmanaged]
    public sealed class Vector4 : ValueType, IEquatable<Vector4>, IFormattable

    Constructors

    Vector4(Vector2, Vector2)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(Vector2 xy, Vector2 zw)
    Parameters
    Vector2 xy

    A vector containing the values with which to initialize the X and Y components.

    Vector2 zw

    A vector containing the values with which to initialize the Z and W components.

    Vector4(Vector2, Single, Single)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(Vector2 value, float z, float w)
    Parameters
    Vector2 value

    A vector containing the values with which to initialize the X and Y components.

    System.Single z

    Initial value for the Z component of the vector.

    System.Single w

    Initial value for the W component of the vector.

    Vector4(Vector3, Single)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(Vector3 value, float w)
    Parameters
    Vector3 value

    A vector containing the values with which to initialize the X, Y, and Z components.

    System.Single w

    Initial value for the W component of the vector.

    Vector4(Double)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(double value)
    Parameters
    System.Double value

    The value that will be assigned to all components.

    Vector4(Double, Double, Double, Double)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(double x, double y, double z, double w)
    Parameters
    System.Double x

    Initial value for the X component of the vector.

    System.Double y

    Initial value for the Y component of the vector.

    System.Double z

    Initial value for the Z component of the vector.

    System.Double w

    Initial value for the W component of the vector.

    Vector4(Single)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(float value)
    Parameters
    System.Single value

    The value that will be assigned to all components.

    Vector4(Single, Single, Single, Single)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(float x, float y, float z, float w)
    Parameters
    System.Single x

    Initial value for the X component of the vector.

    System.Single y

    Initial value for the Y component of the vector.

    System.Single z

    Initial value for the Z component of the vector.

    System.Single w

    Initial value for the W component of the vector.

    Vector4(Single[])

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(float[] values)
    Parameters
    System.Single[] values

    The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements.

    Exceptions
    System.ArgumentNullException

    Thrown when values is null.

    System.ArgumentOutOfRangeException

    Thrown when values contains more or less than four elements.

    Fields

    Half

    A Vector4 with all of its components set to half.

    Declaration
    public static readonly Vector4 Half
    Field Value
    Vector4

    Maximum

    A Vector4 with all components equal to System.Double.MaxValue (or System.Single.MaxValue if using 32-bit precision).

    Declaration
    public static readonly Vector4 Maximum
    Field Value
    Vector4

    Minimum

    A Vector4 with all components equal to System.Double.MinValue (or System.Single.MinValue if using 32-bit precision).

    Declaration
    public static readonly Vector4 Minimum
    Field Value
    Vector4

    One

    A Vector4 with all of its components set to one.

    Declaration
    public static readonly Vector4 One
    Field Value
    Vector4

    SizeInBytes

    The size of the Vector4 type, in bytes.

    Declaration
    public static readonly int SizeInBytes
    Field Value
    System.Int32

    UnitW

    The W unit Vector4 (0, 0, 0, 1).

    Declaration
    public static readonly Vector4 UnitW
    Field Value
    Vector4

    UnitX

    The X unit Vector4 (1, 0, 0, 0).

    Declaration
    public static readonly Vector4 UnitX
    Field Value
    Vector4

    UnitY

    The Y unit Vector4 (0, 1, 0, 0).

    Declaration
    public static readonly Vector4 UnitY
    Field Value
    Vector4

    UnitZ

    The Z unit Vector4 (0, 0, 1, 0).

    Declaration
    public static readonly Vector4 UnitZ
    Field Value
    Vector4

    W

    The W component.

    Declaration
    public float W
    Field Value
    System.Single

    X

    The X component.

    Declaration
    public float X
    Field Value
    System.Single

    Y

    The Y component.

    Declaration
    public float Y
    Field Value
    System.Single

    Z

    The Z component.

    Declaration
    public float Z
    Field Value
    System.Single

    Zero

    A Vector4 with all of its components set to zero.

    Declaration
    public static readonly Vector4 Zero
    Field Value
    Vector4

    Properties

    Absolute

    Gets a vector with values being absolute values of that vector.

    Declaration
    public Vector4 Absolute { get; }
    Property Value
    Vector4

    AvgValue

    Gets an arithmetic average value of all vector components.

    Declaration
    public float AvgValue { get; }
    Property Value
    System.Single

    IsNormalized

    Gets a value indicting whether this instance is normalized.

    Declaration
    public bool IsNormalized { get; }
    Property Value
    System.Boolean

    IsOne

    Gets a value indicting whether this vector is one

    Declaration
    public bool IsOne { get; }
    Property Value
    System.Boolean

    IsZero

    Gets a value indicting whether this vector is zero

    Declaration
    public bool IsZero { get; }
    Property Value
    System.Boolean

    Item[Int32]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    System.Int32 index

    The index of the component to access. Use 0 for the X component, 1 for the Y component, 2 for the Z component, and 3 for the W component.

    Property Value
    System.Single

    The value of the X, Y, Z, or W component, depending on the index.

    Exceptions
    System.ArgumentOutOfRangeException

    Thrown when the index is out of the range [0,3].

    Length

    Calculates the length of the vector.

    Declaration
    public float Length { get; }
    Property Value
    System.Single

    The length of the vector.

    Remarks

    LengthSquared may be preferred when only the relative length is needed and speed is of the essence.

    LengthSquared

    Calculates the squared length of the vector.

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

    The squared length of the vector.

    Remarks

    This method may be preferred to Length when only a relative length is needed and speed is of the essence.

    MaxValue

    Gets a maximum component value

    Declaration
    public float MaxValue { get; }
    Property Value
    System.Single

    MinValue

    Gets a minimum component value

    Declaration
    public float MinValue { get; }
    Property Value
    System.Single

    Negative

    Gets a vector with values being opposite to values of that vector.

    Declaration
    public Vector4 Negative { get; }
    Property Value
    Vector4

    ValuesSum

    Gets a sum of the component values.

    Declaration
    public float ValuesSum { get; }
    Property Value
    System.Single

    Methods

    Abs(Vector4)

    Returns the absolute value of a vector.

    Declaration
    public static Vector4 Abs(Vector4 v)
    Parameters
    Vector4 v

    The value.

    Returns
    Vector4

    A vector which components are less or equal to 0.

    Add(Vector4, Vector4)

    Adds two vectors.

    Declaration
    public static Vector4 Add(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first vector to add.

    Vector4 right

    The second vector to add.

    Returns
    Vector4

    The sum of the two vectors.

    Add(Vector4, Single)

    Performs a component-wise addition.

    Declaration
    public static Vector4 Add(Vector4 left, float right)
    Parameters
    Vector4 left

    The input vector

    System.Single right

    The scalar value to be added to elements

    Returns
    Vector4

    The vector with added scalar for each element.

    Add(ref Vector4, ref Vector4, out Vector4)

    Adds two vectors.

    Declaration
    public static void Add(ref Vector4 left, ref Vector4 right, out Vector4 result)
    Parameters
    Vector4 left

    The first vector to add.

    Vector4 right

    The second vector to add.

    Vector4 result

    When the method completes, contains the sum of the two vectors.

    Add(ref Vector4, ref Single, out Vector4)

    Performs a component-wise addition.

    Declaration
    public static void Add(ref Vector4 left, ref float right, out Vector4 result)
    Parameters
    Vector4 left

    The input vector

    System.Single right

    The scalar value to be added to elements

    Vector4 result

    The vector with added scalar for each element.

    Barycentric(Vector4, Vector4, Vector4, Single, Single)

    Returns a Vector4 containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle.

    Declaration
    public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2)
    Parameters
    Vector4 value1

    A Vector4 containing the 4D Cartesian coordinates of vertex 1 of the triangle.

    Vector4 value2

    A Vector4 containing the 4D Cartesian coordinates of vertex 2 of the triangle.

    Vector4 value3

    A Vector4 containing the 4D Cartesian coordinates of vertex 3 of the triangle.

    System.Single amount1

    Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

    System.Single amount2

    Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

    Returns
    Vector4

    A new Vector4 containing the 4D Cartesian coordinates of the specified point.

    Barycentric(ref Vector4, ref Vector4, ref Vector4, Single, Single, out Vector4)

    Returns a Vector4 containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle.

    Declaration
    public static void Barycentric(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, float amount1, float amount2, out Vector4 result)
    Parameters
    Vector4 value1

    A Vector4 containing the 4D Cartesian coordinates of vertex 1 of the triangle.

    Vector4 value2

    A Vector4 containing the 4D Cartesian coordinates of vertex 2 of the triangle.

    Vector4 value3

    A Vector4 containing the 4D Cartesian coordinates of vertex 3 of the triangle.

    System.Single amount1

    Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

    System.Single amount2

    Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

    Vector4 result

    When the method completes, contains the 4D Cartesian coordinates of the specified point.

    CatmullRom(Vector4, Vector4, Vector4, Vector4, Single)

    Performs a Catmull-Rom interpolation using the specified positions.

    Declaration
    public static Vector4 CatmullRom(Vector4 value1, Vector4 value2, Vector4 value3, Vector4 value4, float amount)
    Parameters
    Vector4 value1

    The first position in the interpolation.

    Vector4 value2

    The second position in the interpolation.

    Vector4 value3

    The third position in the interpolation.

    Vector4 value4

    The fourth position in the interpolation.

    System.Single amount

    Weighting factor.

    Returns
    Vector4

    A vector that is the result of the Catmull-Rom interpolation.

    CatmullRom(ref Vector4, ref Vector4, ref Vector4, ref Vector4, Single, out Vector4)

    Performs a Catmull-Rom interpolation using the specified positions.

    Declaration
    public static void CatmullRom(ref Vector4 value1, ref Vector4 value2, ref Vector4 value3, ref Vector4 value4, float amount, out Vector4 result)
    Parameters
    Vector4 value1

    The first position in the interpolation.

    Vector4 value2

    The second position in the interpolation.

    Vector4 value3

    The third position in the interpolation.

    Vector4 value4

    The fourth position in the interpolation.

    System.Single amount

    Weighting factor.

    Vector4 result

    When the method completes, contains the result of the Catmull-Rom interpolation.

    Clamp(Vector4, Vector4, Vector4)

    Restricts a value to be within a specified range.

    Declaration
    public static Vector4 Clamp(Vector4 value, Vector4 min, Vector4 max)
    Parameters
    Vector4 value

    The value to clamp.

    Vector4 min

    The minimum value.

    Vector4 max

    The maximum value.

    Returns
    Vector4

    The clamped value.

    Clamp(ref Vector4, ref Vector4, ref Vector4, out Vector4)

    Restricts a value to be within a specified range.

    Declaration
    public static void Clamp(ref Vector4 value, ref Vector4 min, ref Vector4 max, out Vector4 result)
    Parameters
    Vector4 value

    The value to clamp.

    Vector4 min

    The minimum value.

    Vector4 max

    The maximum value.

    Vector4 result

    When the method completes, contains the clamped value.

    ClampLength(Vector4, Single)

    Makes sure that Length of the output vector is always below max and above 0.

    Declaration
    public static Vector4 ClampLength(Vector4 vector, float max)
    Parameters
    Vector4 vector

    Input Vector.

    System.Single max

    Max Length

    Returns
    Vector4

    ClampLength(Vector4, Single, Single)

    Makes sure that Length of the output vector is always below max and above min.

    Declaration
    public static Vector4 ClampLength(Vector4 vector, float min, float max)
    Parameters
    Vector4 vector

    Input Vector.

    System.Single min

    Min Length

    System.Single max

    Max Length

    Returns
    Vector4

    ClampLength(Vector4, Single, Single, out Vector4)

    Makes sure that Length of the output vector is always below max and above min.

    Declaration
    public static void ClampLength(Vector4 vector, float min, float max, out Vector4 result)
    Parameters
    Vector4 vector

    Input Vector.

    System.Single min

    Min Length

    System.Single max

    Max Length

    Vector4 result

    The result vector.

    Distance(Vector4, Vector4)

    Calculates the distance between two vectors.

    Declaration
    public static float Distance(Vector4 value1, Vector4 value2)
    Parameters
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    System.Single

    The distance between the two vectors.

    Remarks

    DistanceSquared(Vector4, Vector4) may be preferred when only the relative distance is needed and speed is of the essence.

    Distance(ref Vector4, ref Vector4, out Single)

    Calculates the distance between two vectors.

    Declaration
    public static void Distance(ref Vector4 value1, ref Vector4 value2, out float result)
    Parameters
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    System.Single result

    When the method completes, contains the distance between the two vectors.

    Remarks

    DistanceSquared(ref Vector4, ref Vector4, out Single) may be preferred when only the relative distance is needed and speed is of the essence.

    DistanceSquared(Vector4, Vector4)

    Calculates the squared distance between two vectors.

    Declaration
    public static float DistanceSquared(Vector4 value1, Vector4 value2)
    Parameters
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    System.Single

    The squared distance between the two vectors.

    DistanceSquared(ref Vector4, ref Vector4, out Single)

    Calculates the squared distance between two vectors.

    Declaration
    public static void DistanceSquared(ref Vector4 value1, ref Vector4 value2, out float result)
    Parameters
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    System.Single result

    When the method completes, contains the squared distance between the two vectors.

    Divide(Vector4, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector4 Divide(Vector4 value, float scale)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The scaled vector.

    Divide(ref Vector4, Single, out Vector4)

    Scales a vector by the given value.

    Declaration
    public static void Divide(ref Vector4 value, float scale, out Vector4 result)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Vector4 result

    When the method completes, contains the scaled vector.

    Divide(Single, Vector4)

    Scales a vector by the given value.

    Declaration
    public static Vector4 Divide(float scale, Vector4 value)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector4 value

    The vector to scale.

    Returns
    Vector4

    The scaled vector.

    Divide(Single, ref Vector4, out Vector4)

    Scales a vector by the given value.

    Declaration
    public static void Divide(float scale, ref Vector4 value, out Vector4 result)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector4 value

    The vector to scale.

    Vector4 result

    When the method completes, contains the scaled vector.

    Dot(Vector4, Vector4)

    Calculates the dot product of two vectors.

    Declaration
    public static float Dot(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    First source vector.

    Vector4 right

    Second source vector.

    Returns
    System.Single

    The dot product of the two vectors.

    Dot(ref Vector4, ref Vector4, out Single)

    Calculates the dot product of two vectors.

    Declaration
    public static void Dot(ref Vector4 left, ref Vector4 right, out float result)
    Parameters
    Vector4 left

    First source vector

    Vector4 right

    Second source vector.

    System.Single result

    When the method completes, contains the dot product of the two vectors.

    Equals(Vector4)

    Determines whether the specified Vector4 is equal to this instance.

    Declaration
    public bool Equals(Vector4 other)
    Parameters
    Vector4 other

    The Vector4 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Vector4 is equal to this instance; otherwise, false.

    Equals(ref Vector4)

    Determines whether the specified Vector4 is equal to this instance.

    Declaration
    public bool Equals(ref Vector4 other)
    Parameters
    Vector4 other

    The Vector4 to compare with this instance.

    Returns
    System.Boolean

    true if the specified Vector4 is equal to this instance; otherwise, false.

    Equals(Object)

    Determines whether the specified System.Object is equal to this instance.

    Declaration
    public override bool Equals(object value)
    Parameters
    System.Object value

    The System.Object to compare with this instance.

    Returns
    System.Boolean

    true if the specified System.Object is equal to this instance; otherwise, false.

    GetHashCode()

    Returns a hash code for this instance.

    Declaration
    public override int GetHashCode()
    Returns
    System.Int32

    Hermite(Vector4, Vector4, Vector4, Vector4, Single)

    Performs a Hermite spline interpolation.

    Declaration
    public static Vector4 Hermite(Vector4 value1, Vector4 tangent1, Vector4 value2, Vector4 tangent2, float amount)
    Parameters
    Vector4 value1

    First source position vector.

    Vector4 tangent1

    First source tangent vector.

    Vector4 value2

    Second source position vector.

    Vector4 tangent2

    Second source tangent vector.

    System.Single amount

    Weighting factor.

    Returns
    Vector4

    The result of the Hermite spline interpolation.

    Hermite(ref Vector4, ref Vector4, ref Vector4, ref Vector4, Single, out Vector4)

    Performs a Hermite spline interpolation.

    Declaration
    public static void Hermite(ref Vector4 value1, ref Vector4 tangent1, ref Vector4 value2, ref Vector4 tangent2, float amount, out Vector4 result)
    Parameters
    Vector4 value1

    First source position vector.

    Vector4 tangent1

    First source tangent vector.

    Vector4 value2

    Second source position vector.

    Vector4 tangent2

    Second source tangent vector.

    System.Single amount

    Weighting factor.

    Vector4 result

    When the method completes, contains the result of the Hermite spline interpolation.

    Lerp(Vector4, Vector4, Single)

    Performs a linear interpolation between two vectors.

    Declaration
    public static Vector4 Lerp(Vector4 start, Vector4 end, float amount)
    Parameters
    Vector4 start

    Start vector.

    Vector4 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Vector4

    The linear interpolation of the two vectors.

    Remarks

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

    Lerp(ref Vector4, ref Vector4, Single, out Vector4)

    Performs a linear interpolation between two vectors.

    Declaration
    public static void Lerp(ref Vector4 start, ref Vector4 end, float amount, out Vector4 result)
    Parameters
    Vector4 start

    Start vector.

    Vector4 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Vector4 result

    When the method completes, contains the linear interpolation of the two vectors.

    Remarks

    Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.

    Max(Vector4, Vector4)

    Returns a vector containing the largest components of the specified vectors.

    Declaration
    public static Vector4 Max(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first source vector.

    Vector4 right

    The second source vector.

    Returns
    Vector4

    A vector containing the largest components of the source vectors.

    Max(ref Vector4, ref Vector4, out Vector4)

    Returns a vector containing the largest components of the specified vectors.

    Declaration
    public static void Max(ref Vector4 left, ref Vector4 right, out Vector4 result)
    Parameters
    Vector4 left

    The first source vector.

    Vector4 right

    The second source vector.

    Vector4 result

    When the method completes, contains an new vector composed of the largest components of the source vectors.

    Min(Vector4, Vector4)

    Returns a vector containing the smallest components of the specified vectors.

    Declaration
    public static Vector4 Min(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first source vector.

    Vector4 right

    The second source vector.

    Returns
    Vector4

    A vector containing the smallest components of the source vectors.

    Min(ref Vector4, ref Vector4, out Vector4)

    Returns a vector containing the smallest components of the specified vectors.

    Declaration
    public static void Min(ref Vector4 left, ref Vector4 right, out Vector4 result)
    Parameters
    Vector4 left

    The first source vector.

    Vector4 right

    The second source vector.

    Vector4 result

    When the method completes, contains an new vector composed of the smallest components of the source vectors.

    Multiply(Vector4, Vector4)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static Vector4 Multiply(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first vector to multiply.

    Vector4 right

    The second vector to multiply.

    Returns
    Vector4

    The multiplied vector.

    Multiply(Vector4, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector4 Multiply(Vector4 value, float scale)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The scaled vector.

    Multiply(ref Vector4, ref Vector4, out Vector4)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static void Multiply(ref Vector4 left, ref Vector4 right, out Vector4 result)
    Parameters
    Vector4 left

    The first vector to multiply.

    Vector4 right

    The second vector to multiply.

    Vector4 result

    When the method completes, contains the multiplied vector.

    Multiply(ref Vector4, Single, out Vector4)

    Scales a vector by the given value.

    Declaration
    public static void Multiply(ref Vector4 value, float scale, out Vector4 result)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Vector4 result

    When the method completes, contains the scaled vector.

    NearEqual(Vector4, Vector4, Single)

    Tests whether one vector is near another vector.

    Declaration
    public static bool NearEqual(Vector4 left, Vector4 right, float epsilon = 1E-06F)
    Parameters
    Vector4 left

    The left vector.

    Vector4 right

    The right vector.

    System.Single epsilon

    The epsilon.

    Returns
    System.Boolean

    true if left and right are near another, false otherwise

    NearEqual(ref Vector4, ref Vector4, Single)

    Tests whether one vector is near another vector.

    Declaration
    public static bool NearEqual(ref Vector4 left, ref Vector4 right, float epsilon = 1E-06F)
    Parameters
    Vector4 left

    The left vector.

    Vector4 right

    The right vector.

    System.Single epsilon

    The epsilon.

    Returns
    System.Boolean

    true if left and right are near another, false otherwise

    Negate(Vector4)

    Reverses the direction of a given vector.

    Declaration
    public static Vector4 Negate(Vector4 value)
    Parameters
    Vector4 value

    The vector to negate.

    Returns
    Vector4

    A vector facing in the opposite direction.

    Negate(ref Vector4, out Vector4)

    Reverses the direction of a given vector.

    Declaration
    public static void Negate(ref Vector4 value, out Vector4 result)
    Parameters
    Vector4 value

    The vector to negate.

    Vector4 result

    When the method completes, contains a vector facing in the opposite direction.

    Normalize()

    Converts the vector into a unit vector.

    Declaration
    public void Normalize()

    Normalize(Vector4)

    Converts the vector into a unit vector.

    Declaration
    public static Vector4 Normalize(Vector4 value)
    Parameters
    Vector4 value

    The vector to normalize.

    Returns
    Vector4

    The normalized vector.

    Normalize(ref Vector4, out Vector4)

    Converts the vector into a unit vector.

    Declaration
    public static void Normalize(ref Vector4 value, out Vector4 result)
    Parameters
    Vector4 value

    The vector to normalize.

    Vector4 result

    When the method completes, contains the normalized vector.

    SmoothStep(Vector4, Vector4, Single)

    Performs a cubic interpolation between two vectors.

    Declaration
    public static Vector4 SmoothStep(Vector4 start, Vector4 end, float amount)
    Parameters
    Vector4 start

    Start vector.

    Vector4 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Returns
    Vector4

    The cubic interpolation of the two vectors.

    SmoothStep(ref Vector4, ref Vector4, Single, out Vector4)

    Performs a cubic interpolation between two vectors.

    Declaration
    public static void SmoothStep(ref Vector4 start, ref Vector4 end, float amount, out Vector4 result)
    Parameters
    Vector4 start

    Start vector.

    Vector4 end

    End vector.

    System.Single amount

    Value between 0 and 1 indicating the weight of end.

    Vector4 result

    When the method completes, contains the cubic interpolation of the two vectors.

    Subtract(Vector4, Vector4)

    Subtracts two vectors.

    Declaration
    public static Vector4 Subtract(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first vector to subtract.

    Vector4 right

    The second vector to subtract.

    Returns
    Vector4

    The difference of the two vectors.

    Subtract(Vector4, Single)

    Performs a component-wise subtraction.

    Declaration
    public static Vector4 Subtract(Vector4 left, float right)
    Parameters
    Vector4 left

    The input vector

    System.Single right

    The scalar value to be subtracted from elements

    Returns
    Vector4

    The vector with subtracted scalar for each element.

    Subtract(ref Vector4, ref Vector4, out Vector4)

    Subtracts two vectors.

    Declaration
    public static void Subtract(ref Vector4 left, ref Vector4 right, out Vector4 result)
    Parameters
    Vector4 left

    The first vector to subtract.

    Vector4 right

    The second vector to subtract.

    Vector4 result

    When the method completes, contains the difference of the two vectors.

    Subtract(ref Vector4, ref Single, out Vector4)

    Performs a component-wise subtraction.

    Declaration
    public static void Subtract(ref Vector4 left, ref float right, out Vector4 result)
    Parameters
    Vector4 left

    The input vector

    System.Single right

    The scalar value to be subtracted from elements

    Vector4 result

    The vector with subtracted scalar for each element.

    Subtract(Single, Vector4)

    Performs a component-wise subtraction.

    Declaration
    public static Vector4 Subtract(float left, Vector4 right)
    Parameters
    System.Single left

    The scalar value to be subtracted from elements

    Vector4 right

    The input vector.

    Returns
    Vector4

    The vector with subtracted scalar for each element.

    Subtract(ref Single, ref Vector4, out Vector4)

    Performs a component-wise subtraction.

    Declaration
    public static void Subtract(ref float left, ref Vector4 right, out Vector4 result)
    Parameters
    System.Single left

    The scalar value to be subtracted from elements

    Vector4 right

    The input vector.

    Vector4 result

    The vector with subtracted scalar for each element.

    ToArray()

    Creates an array containing the elements of the vector.

    Declaration
    public float[] ToArray()
    Returns
    System.Single[]

    A four-element array containing the components of the vector.

    ToString()

    Returns a System.String that represents this instance.

    Declaration
    public override string ToString()
    Returns
    System.String

    A System.String that represents this instance.

    ToString(IFormatProvider)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(IFormatProvider formatProvider)
    Parameters
    System.IFormatProvider formatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this instance.

    ToString(String)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(string format)
    Parameters
    System.String format

    The format.

    Returns
    System.String

    A System.String that represents this instance.

    ToString(String, IFormatProvider)

    Returns a System.String that represents this instance.

    Declaration
    public string ToString(string format, IFormatProvider formatProvider)
    Parameters
    System.String format

    The format.

    System.IFormatProvider formatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this instance.

    Transform(Vector4, Matrix)

    Transforms a 4D vector by the given Matrix.

    Declaration
    public static Vector4 Transform(Vector4 vector, Matrix transform)
    Parameters
    Vector4 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Returns
    Vector4

    The transformed Vector4.

    Transform(Vector4, Quaternion)

    Transforms a 4D vector by the given Quaternion rotation.

    Declaration
    public static Vector4 Transform(Vector4 vector, Quaternion rotation)
    Parameters
    Vector4 vector

    The vector to rotate.

    Quaternion rotation

    The Quaternion rotation to apply.

    Returns
    Vector4

    The transformed Vector4.

    Transform(ref Vector4, ref Matrix, out Vector4)

    Transforms a 4D vector by the given Matrix.

    Declaration
    public static void Transform(ref Vector4 vector, ref Matrix transform, out Vector4 result)
    Parameters
    Vector4 vector

    The source vector.

    Matrix transform

    The transformation Matrix.

    Vector4 result

    When the method completes, contains the transformed Vector4.

    Transform(ref Vector4, ref Quaternion, out Vector4)

    Transforms a 4D vector by the given Quaternion rotation.

    Declaration
    public static void Transform(ref Vector4 vector, ref Quaternion rotation, out Vector4 result)
    Parameters
    Vector4 vector

    The vector to rotate.

    Quaternion rotation

    The Quaternion rotation to apply.

    Vector4 result

    When the method completes, contains the transformed Vector4.

    Operators

    Addition(Float4, Vector4)

    Adds a vector to another by performing component-wise addition.

    Declaration
    public static Float4 operator +(Float4 left, Vector4 right)
    Parameters
    Float4 left

    The first vector to add.

    Vector4 right

    The second vector to add.

    Returns
    Float4

    The sum of the two vectors.

    Addition(Vector4, Float4)

    Adds a vector to another by performing component-wise addition.

    Declaration
    public static Vector4 operator +(Vector4 left, Float4 right)
    Parameters
    Vector4 left

    The first vector to add.

    Float4 right

    The second vector to add.

    Returns
    Vector4

    The sum of the two vectors.

    Addition(Vector4, Vector4)

    Adds two vectors.

    Declaration
    public static Vector4 operator +(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first vector to add.

    Vector4 right

    The second vector to add.

    Returns
    Vector4

    The sum of the two vectors.

    Addition(Vector4, Single)

    Performs a component-wise addition.

    Declaration
    public static Vector4 operator +(Vector4 value, float scalar)
    Parameters
    Vector4 value

    The input vector.

    System.Single scalar

    The scalar value to be added on elements

    Returns
    Vector4

    The vector with added scalar for each element.

    Addition(Single, Vector4)

    Performs a component-wise addition.

    Declaration
    public static Vector4 operator +(float scalar, Vector4 value)
    Parameters
    System.Single scalar

    The scalar value to be added on elements

    Vector4 value

    The input vector.

    Returns
    Vector4

    The vector with added scalar for each element.

    Division(Vector4, Vector4)

    Scales a vector by the given value.

    Declaration
    public static Vector4 operator /(Vector4 value, Vector4 scale)
    Parameters
    Vector4 value

    The vector to scale.

    Vector4 scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The scaled vector.

    Division(Vector4, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector4 operator /(Vector4 value, float scale)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The scaled vector.

    Division(Single, Vector4)

    Scales a vector by the given value.

    Declaration
    public static Vector4 operator /(float scale, Vector4 value)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector4 value

    The vector to scale.

    Returns
    Vector4

    The scaled vector.

    Equality(Vector4, Vector4)

    Tests for equality between two objects.

    Declaration
    public static bool operator ==(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first value to compare.

    Vector4 right

    The second value to compare.

    Returns
    System.Boolean

    true if left has the same value as right; otherwise, false.

    Explicit(Vector4 to Int4)

    Performs an explicit conversion from Vector4 to Int4.

    Declaration
    public static explicit operator Int4(Vector4 value)
    Parameters
    Vector4 value

    The value.

    Returns
    Int4

    The result of the conversion.

    Explicit(Vector4 to Vector2)

    Performs an explicit conversion from Vector4 to Vector2.

    Declaration
    public static explicit operator Vector2(Vector4 value)
    Parameters
    Vector4 value

    The value.

    Returns
    Vector2

    The result of the conversion.

    Explicit(Vector4 to Vector3)

    Performs an explicit conversion from Vector4 to Vector3.

    Declaration
    public static explicit operator Vector3(Vector4 value)
    Parameters
    Vector4 value

    The value.

    Returns
    Vector3

    The result of the conversion.

    Implicit(Vector4 to Double4)

    Performs an implicit conversion from Vector4 to Double4.

    Declaration
    public static implicit operator Double4(Vector4 value)
    Parameters
    Vector4 value

    The value.

    Returns
    Double4

    The result of the conversion.

    Implicit(Vector4 to Float4)

    Performs an implicit conversion from Vector4 to Float4.

    Declaration
    public static implicit operator Float4(Vector4 value)
    Parameters
    Vector4 value

    The value.

    Returns
    Float4

    The result of the conversion.

    Inequality(Vector4, Vector4)

    Tests for inequality between two objects.

    Declaration
    public static bool operator !=(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first value to compare.

    Vector4 right

    The second value to compare.

    Returns
    System.Boolean

    true if left has a different value than right; otherwise, false.

    Modulus(Vector4, Vector4)

    Remainder of value divided by scale.

    Declaration
    public static Vector4 operator %(Vector4 value, Vector4 scale)
    Parameters
    Vector4 value

    The vector to scale.

    Vector4 scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The remained vector.

    Modulus(Vector4, Single)

    Remainder of value divided by scale.

    Declaration
    public static Vector4 operator %(Vector4 value, float scale)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The remained vector.

    Modulus(Single, Vector4)

    Remainder of value divided by scale.

    Declaration
    public static Vector4 operator %(float value, Vector4 scale)
    Parameters
    System.Single value

    The amount by which to scale the vector.

    Vector4 scale

    The vector to scale.

    Returns
    Vector4

    The remained vector.

    Multiply(Float4, Vector4)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static Float4 operator *(Float4 left, Vector4 right)
    Parameters
    Float4 left

    The first vector to multiply.

    Vector4 right

    The second vector to multiply.

    Returns
    Float4

    The multiplication of the two vectors.

    Multiply(Vector4, Float4)

    Multiplies a vector with another by performing component-wise multiplication.

    Declaration
    public static Vector4 operator *(Vector4 left, Float4 right)
    Parameters
    Vector4 left

    The first vector to multiply.

    Float4 right

    The second vector to multiply.

    Returns
    Vector4

    The multiplication of the two vectors.

    Multiply(Vector4, Vector4)

    Multiplies a vector with another by performing component-wise multiplication equivalent to Multiply(ref Vector4, ref Vector4, out Vector4).

    Declaration
    public static Vector4 operator *(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first vector to multiply.

    Vector4 right

    The second vector to multiply.

    Returns
    Vector4

    The multiplication of the two vectors.

    Multiply(Vector4, Single)

    Scales a vector by the given value.

    Declaration
    public static Vector4 operator *(Vector4 value, float scale)
    Parameters
    Vector4 value

    The vector to scale.

    System.Single scale

    The amount by which to scale the vector.

    Returns
    Vector4

    The scaled vector.

    Multiply(Single, Vector4)

    Scales a vector by the given value.

    Declaration
    public static Vector4 operator *(float scale, Vector4 value)
    Parameters
    System.Single scale

    The amount by which to scale the vector.

    Vector4 value

    The vector to scale.

    Returns
    Vector4

    The scaled vector.

    Subtraction(Float4, Vector4)

    Subtracts a vector from another by performing component-wise subtraction.

    Declaration
    public static Float4 operator -(Float4 left, Vector4 right)
    Parameters
    Float4 left

    The first vector to add.

    Vector4 right

    The second vector to add.

    Returns
    Float4

    The sum of the two vectors.

    Subtraction(Vector4, Float4)

    Subtracts a vector from another by performing component-wise subtraction.

    Declaration
    public static Vector4 operator -(Vector4 left, Float4 right)
    Parameters
    Vector4 left

    The first vector to add.

    Float4 right

    The second vector to add.

    Returns
    Vector4

    The sum of the two vectors.

    Subtraction(Vector4, Vector4)

    Subtracts two vectors.

    Declaration
    public static Vector4 operator -(Vector4 left, Vector4 right)
    Parameters
    Vector4 left

    The first vector to subtract.

    Vector4 right

    The second vector to subtract.

    Returns
    Vector4

    The difference of the two vectors.

    Subtraction(Vector4, Single)

    Performs a component-wise subtraction.

    Declaration
    public static Vector4 operator -(Vector4 value, float scalar)
    Parameters
    Vector4 value

    The input vector.

    System.Single scalar

    The scalar value to be subtracted from elements

    Returns
    Vector4

    The vector with subtracted scalar from each element.

    Subtraction(Single, Vector4)

    Performs a component-wise subtraction.

    Declaration
    public static Vector4 operator -(float scalar, Vector4 value)
    Parameters
    System.Single scalar

    The scalar value to be subtracted from elements

    Vector4 value

    The input vector.

    Returns
    Vector4

    The vector with subtracted scalar from each element.

    UnaryNegation(Vector4)

    Reverses the direction of a given vector.

    Declaration
    public static Vector4 operator -(Vector4 value)
    Parameters
    Vector4 value

    The vector to negate.

    Returns
    Vector4

    A vector facing in the opposite direction.

    UnaryPlus(Vector4)

    Assert a vector (return it unchanged).

    Declaration
    public static Vector4 operator +(Vector4 value)
    Parameters
    Vector4 value

    The vector to assert (unchanged).

    Returns
    Vector4

    The asserted (unchanged) vector.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat