Search Results for

    Show / Hide Table of Contents

    Struct Vector4

    Represents a vector in a 4D coordinate system.

    Implements
    IEquatable<Vector4>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Evergine.Mathematics
    Assembly: Evergine.Mathematics.dll
    Syntax
    public struct Vector4 : IEquatable<Vector4>

    Constructors

    Vector4(Vector2, float, float)

    Initializes a new instance of the Vector4 struct.

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

    The Vector2 vector with coordinates x and y.

    float z

    The z coordinate in 4D space.

    float w

    The w coordinate in 4D space.

    Vector4(Vector3, float)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(Vector3 value, float w)
    Parameters
    Type Name Description
    Vector3 value

    The Vector3 vector with coordinates x, y and z.

    float w

    The w coordinate in 4D space.

    Vector4(float)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(float value)
    Parameters
    Type Name Description
    float value

    The x, y, z and w coordinates in 4D space.

    Vector4(float, float, float, float)

    Initializes a new instance of the Vector4 struct.

    Declaration
    public Vector4(float x, float y, float z, float w)
    Parameters
    Type Name Description
    float x

    The x coordinate in 4D space.

    float y

    The y coordinate in 4D space.

    float z

    The z coordinate in 4D space.

    float w

    The w coordinate in 4D space.

    Fields

    W

    The w coordinate of this Vector4.

    Declaration
    public float W
    Field Value
    Type Description
    float

    X

    The x coordinate of this Vector4.

    Declaration
    public float X
    Field Value
    Type Description
    float

    Y

    The y coordinate of this Vector4.

    Declaration
    public float Y
    Field Value
    Type Description
    float

    Z

    The z coordinate of this Vector4.

    Declaration
    public float Z
    Field Value
    Type Description
    float

    Properties

    this[int]

    Gets or sets the component at the specified index.

    Declaration
    public float this[int index] { get; set; }
    Parameters
    Type Name Description
    int 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
    Type Description
    float

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

    One

    Gets a Vector4 with components 1, 1, 1, 1.

    Declaration
    public static Vector4 One { get; }
    Property Value
    Type Description
    Vector4

    UnitW

    Gets a Vector4 with components 0, 0, 0, 1.

    Declaration
    public static Vector4 UnitW { get; }
    Property Value
    Type Description
    Vector4

    UnitX

    Gets a Vector4 with components 1, 0, 0, 0.

    Declaration
    public static Vector4 UnitX { get; }
    Property Value
    Type Description
    Vector4

    UnitY

    Gets a Vector4 with components 0, 1, 0, 0.

    Declaration
    public static Vector4 UnitY { get; }
    Property Value
    Type Description
    Vector4

    UnitZ

    Gets a Vector4 with components 0, 0, 1, 0.

    Declaration
    public static Vector4 UnitZ { get; }
    Property Value
    Type Description
    Vector4

    Zero

    Gets a Vector4 with components 0, 0, 0, 0.

    Declaration
    public static Vector4 Zero { get; }
    Property Value
    Type Description
    Vector4

    Methods

    Abs(Vector4)

    Creates a new Vector4 that contains the absolute values from the a vector.

    Declaration
    public static Vector4 Abs(Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    The vector.

    Returns
    Type Description
    Vector4

    The Vector4 with absolute values from the a vector.

    Abs(ref Vector4, out Vector4)

    Creates a new Vector4 that contains the absolute values from the a vector.

    Declaration
    public static void Abs(ref Vector4 value, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value

    The vector.

    Vector4 result

    The Vector4 with absolute values from the a vector as an output parameter.

    Add(Vector4, Vector4)

    Performs vector addition on value1 and value2.

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

    The first vector to add.

    Vector4 value2

    The second vector to add.

    Returns
    Type Description
    Vector4

    The result of the vector addition.

    Add(ref Vector4, ref Vector4, out Vector4)

    Performs vector addition on value1 and value2, storing the result of the addition in result.

    Declaration
    public static void Add(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector to add.

    Vector4 value2

    The second vector to add.

    Vector4 result

    The result of the vector addition as an ouput parameter.

    Barycentric(Vector4, Vector4, Vector4, float, float)

    Creates a new Vector4 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 4D triangle.

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

    The first vector of 4D triangle.

    Vector4 value2

    The second vector of 4D triangle.

    Vector4 value3

    The third vector of 4D triangle.

    float amount1

    Barycentric scalar b2 which represents a weighting factor towards second vector of 4D triangle.

    float amount2

    Barycentric scalar b3 which represents a weighting factor towards third vector of 4D triangle.

    Returns
    Type Description
    Vector4

    The cartesian translation of barycentric coordinates.

    Barycentric(ref Vector4, ref Vector4, ref Vector4, float, float, out Vector4)

    Creates a new Vector4 that contains the cartesian coordinates of a vector specified in barycentric coordinates and relative to 4D triangle.

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

    The first vector of 4D triangle.

    Vector4 value2

    The second vector of 4D triangle.

    Vector4 value3

    The third vector of 4D triangle.

    float amount1

    Barycentric scalar b2 which represents a weighting factor towards second vector of 4D triangle.

    float amount2

    Barycentric scalar b3 which represents a weighting factor towards third vector of 4D triangle.

    Vector4 result

    The cartesian translation of barycentric coordinates as an output parameter.

    CatmullRom(Vector4, Vector4, Vector4, Vector4, float)

    Creates a new Vector4 that contains CatmullRom interpolation of the specified vectors.

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

    The first vector in interpolation.

    Vector4 value2

    The second vector in interpolation.

    Vector4 value3

    The third vector in interpolation.

    Vector4 value4

    The fourth vector in interpolation.

    float amount

    Weighting factor.

    Returns
    Type Description
    Vector4

    The result of CatmullRom interpolation.

    CatmullRom(ref Vector4, ref Vector4, ref Vector4, ref Vector4, float, out Vector4)

    Creates a new Vector4 that contains CatmullRom interpolation of the specified vectors.

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

    The first vector in interpolation.

    Vector4 value2

    The second vector in interpolation.

    Vector4 value3

    The third vector in interpolation.

    Vector4 value4

    The fourth vector in interpolation.

    float amount

    Weighting factor.

    Vector4 result

    The result of CatmullRom interpolation as an output parameter.

    Clamp(Vector4, Vector4, Vector4)

    Restricts a vector between a min and max value.

    Declaration
    public static Vector4 Clamp(Vector4 value1, Vector4 min, Vector4 max)
    Parameters
    Type Name Description
    Vector4 value1

    The source vector.

    Vector4 min

    The minimum value.

    Vector4 max

    The maximum value.

    Returns
    Type Description
    Vector4

    The restricted vector.

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

    Restricts a vector between a min and max value.

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

    The source vector.

    Vector4 min

    The minimum value.

    Vector4 max

    The maximum value.

    Vector4 result

    The restricted vector.

    ClampMagnitude(Vector4, float)

    Returns a vector with its magnitude clamped to maxLength.

    Declaration
    public static Vector4 ClampMagnitude(Vector4 vector, float maxLength)
    Parameters
    Type Name Description
    Vector4 vector

    The vector.

    float maxLength

    The max length.

    Returns
    Type Description
    Vector4

    The clamped vector.

    Distance(Vector4, Vector4)

    Returns the distance between two vectors.

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

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    Type Description
    float

    The distance between two vectors.

    Distance(ref Vector4, ref Vector4, out float)

    Returns the distance between two vectors.

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

    The first vector.

    Vector4 value2

    The second vector.

    float result

    The distance between two vectors as an output parameter.

    DistanceSquared(Vector4, Vector4)

    Returns the Euclidean distance squared between the two given points.

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

    The first point.

    Vector4 value2

    The second point.

    Returns
    Type Description
    float

    The distance squared.

    DistanceSquared(ref Vector4, ref Vector4, out float)

    Returns the Euclidean distance squared between the two given points.

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

    The first point.

    Vector4 value2

    The second point.

    float result

    The distance squared.

    Divide(Vector4, Vector4)

    Divides the components of a Vector4 by the components of another Vector4.

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

    Source Vector4.

    Vector4 value2

    Divisor Vector4.

    Returns
    Type Description
    Vector4

    The result of dividing the vectors.

    Divide(Vector4, float)

    Divides the components of a Vector4 by a scalar.

    Declaration
    public static Vector4 Divide(Vector4 value1, float divider)
    Parameters
    Type Name Description
    Vector4 value1

    Source Vector4.

    float divider

    Divisor scalar.

    Returns
    Type Description
    Vector4

    The result of dividing a vector by a scalar.

    Divide(ref Vector4, ref Vector4, out Vector4)

    Divides the components of a Vector4 by the components of another Vector4.

    Declaration
    public static void Divide(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    Source Vector4.

    Vector4 value2

    Divisor Vector4.

    Vector4 result

    The result of dividing the vectors as an output parameter.

    Divide(ref Vector4, float, out Vector4)

    Divides the components of a Vector4 by a scalar.

    Declaration
    public static void Divide(ref Vector4 value1, float divider, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    Source Vector4.

    float divider

    Divisor scalar.

    Vector4 result

    The result of dividing a vector by a scalar as an output parameter.

    Dot(Vector4, Vector4)

    Returns the dot product of two vectors.

    Declaration
    public static float Dot(Vector4 value1, Vector4 value2)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    Type Description
    float

    The dot product of two vectors.

    Dot(ref Vector4, ref Vector4)

    Returns a dot product of two vectors.

    Declaration
    public static float Dot(ref Vector4 value1, ref Vector4 value2)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    Type Description
    float

    The dot product of two vectors as an output parameter.

    Equals(Vector4)

    Declaration
    public bool Equals(Vector4 other)
    Parameters
    Type Name Description
    Vector4 other
    Returns
    Type Description
    bool

    Equals(ref Vector4)

    Indicates whether this instance and a specified Vector4 are equal.

    Declaration
    public bool Equals(ref Vector4 other)
    Parameters
    Type Name Description
    Vector4 other

    The vector to compare with the current instance.

    Returns
    Type Description
    bool

    true if other and this instance are the same type and represent the same value; otherwise, false.

    Equals(object)

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj
    Returns
    Type Description
    bool
    Overrides
    ValueType.Equals(object)

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int
    Overrides
    ValueType.GetHashCode()

    Hermite(Vector4, Vector4, Vector4, Vector4, float)

    Creates a new Vector4 that contains hermite spline interpolation.

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

    The first position vector.

    Vector4 tangent1

    The first tangent vector.

    Vector4 value2

    The second position vector.

    Vector4 tangent2

    The second tangent vector.

    float amount

    Weighting factor.

    Returns
    Type Description
    Vector4

    The hermite spline interpolation vector.

    Hermite(ref Vector4, ref Vector4, ref Vector4, ref Vector4, float, out Vector4)

    Creates a new Vector4 that contains 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
    Type Name Description
    Vector4 value1

    The first position vector.

    Vector4 tangent1

    The first tangent vector.

    Vector4 value2

    The second position vector.

    Vector4 tangent2

    The second tangent vector.

    float amount

    Weighting factor.

    Vector4 result

    The hermite spline interpolation vector as an output parameter.

    Length()

    Returns the length of this Vector4.

    Declaration
    public float Length()
    Returns
    Type Description
    float

    The length of this Vector4.

    LengthSquared()

    Returns the squared length of this Vector4.

    Declaration
    public float LengthSquared()
    Returns
    Type Description
    float

    The squared length of this Vector4.

    Lerp(Vector4, Vector4, float)

    Creates a new Vector4 that contains linear interpolation of the specified vectors.

    Declaration
    public static Vector4 Lerp(Vector4 value1, Vector4 value2, float amount)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    float amount

    Weighting value(between 0.0 and 1.0).

    Returns
    Type Description
    Vector4

    The result of linear interpolation of the specified vectors.

    Lerp(ref Vector4, ref Vector4, float, out Vector4)

    Creates a new Vector4 that contains linear interpolation of the specified vectors.

    Declaration
    public static void Lerp(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    float amount

    Weighting value(between 0.0 and 1.0).

    Vector4 result

    The result of linear interpolation of the specified vectors as an output parameter.

    Max(Vector4, Vector4)

    Creates a new Vector4 that contains a maximal values from the two vectors.

    Declaration
    public static Vector4 Max(Vector4 value1, Vector4 value2)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    Type Description
    Vector4

    The Vector4 with maximal values from the two vectors.

    Max(ref Vector4, ref Vector4, out Vector4)

    Creates a new Vector4 that contains a maximal values from the two vectors.

    Declaration
    public static void Max(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Vector4 result

    The Vector4 with maximal values from the two vectors as an output parameter.

    Min(Vector4, Vector4)

    Creates a new Vector4 that contains a minimal values from the two vectors.

    Declaration
    public static Vector4 Min(Vector4 value1, Vector4 value2)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Returns
    Type Description
    Vector4

    The Vector4 with minimal values from the two vectors.

    Min(ref Vector4, ref Vector4, out Vector4)

    Creates a new Vector4 that contains a minimal values from the two vectors.

    Declaration
    public static void Min(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    Vector4 result

    The Vector4 with minimal values from the two vectors as an output parameter.

    Multiply(Vector4, Vector4)

    Creates a new Vector4 that contains a multiplication of two vectors.

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

    The first vector to multiply.

    Vector4 value2

    The second vector to multiply.

    Returns
    Type Description
    Vector4

    The result of the vector multiplication.

    Multiply(Vector4, float)

    Creates a new Vector4 that contains a multiplication of Vector4 and a scalar.

    Declaration
    public static Vector4 Multiply(Vector4 value1, float scaleFactor)
    Parameters
    Type Name Description
    Vector4 value1

    Source Vector3.

    float scaleFactor

    Scalar value.

    Returns
    Type Description
    Vector4

    The result of the vector multiplication with a scalar.

    Multiply(ref Vector4, ref Vector4, out Vector4)

    Creates a new Vector4 that contains a multiplication of two vectors.

    Declaration
    public static void Multiply(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector to multiply.

    Vector4 value2

    The second vector to multiply.

    Vector4 result

    The result of the vector multiplication as an output parameter.

    Multiply(ref Vector4, float, out Vector4)

    Creates a new Vector4 that contains a multiplication of Vector4 and a scalar.

    Declaration
    public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    Source Vector4.

    float scaleFactor

    Scalar value.

    Vector4 result

    The result of the multiplication with a scalar as an output parameter.

    Negate(Vector4)

    Creates a new Vector4 that contains the specified vector inversion.

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

    Source Vector4.

    Returns
    Type Description
    Vector4

    The result of the vector inversion.

    Negate(ref Vector4, out Vector4)

    Creates a new Vector4 that contains the specified vector inversion.

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

    Source Vector4.

    Vector4 result

    The result of the vector inversion as an output parameter.

    Normalize()

    Turns this Vector4 to a unit vector with the same direction.

    Declaration
    public float Normalize()
    Returns
    Type Description
    float

    The previous vector length.

    Normalize(Vector4)

    Creates a new Vector4 that contains a normalized values from another vector.

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

    Source Vector4.

    Returns
    Type Description
    Vector4

    Unit vector.

    Normalize(ref Vector4, out Vector4)

    Creates a new Vector4 that contains a normalized values from another vector.

    Declaration
    public static float Normalize(ref Vector4 value, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value

    Source Vector4.

    Vector4 result

    Unit vector as an output parameter.

    Returns
    Type Description
    float

    The previous vector length.

    Project(Vector4, Vector4)

    Projects a Vector4 onto another Vector4.

    Declaration
    public static Vector4 Project(Vector4 vector, Vector4 onVector)
    Parameters
    Type Name Description
    Vector4 vector

    The Vector4 to project.

    Vector4 onVector

    The Vector4 to project vector on.

    Returns
    Type Description
    Vector4

    The Vector4 obtained by projecting vector onto onVector.

    Remarks

    The returned vector is parallel to onVector. The function will return a zero vector if onVector is almost zero.

    Project(ref Vector4, ref Vector4, out Vector4)

    Projects a Vector4 onto another Vector4.

    Declaration
    public static void Project(ref Vector4 vector, ref Vector4 onVector, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 vector

    The Vector4 to project.

    Vector4 onVector

    The Vector4 to project vector on.

    Vector4 result

    The Vector4 obtained by projecting vector onto onVector.

    Remarks

    The result vector is parallel to onVector. The function will return a zero vector if onVector is almost zero.

    SmoothStep(Vector4, Vector4, float)

    Creates a new Vector4 that contains cubic interpolation of the specified vectors.

    Declaration
    public static Vector4 SmoothStep(Vector4 value1, Vector4 value2, float amount)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    float amount

    Weighting value.

    Returns
    Type Description
    Vector4

    Cubic interpolation of the specified vectors.

    SmoothStep(ref Vector4, ref Vector4, float, out Vector4)

    Creates a new Vector4 that contains cubic interpolation of the specified vectors.

    Declaration
    public static void SmoothStep(ref Vector4 value1, ref Vector4 value2, float amount, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector.

    Vector4 value2

    The second vector.

    float amount

    Weighting value.

    Vector4 result

    Cubic interpolation of the specified vectors as an output parameter.

    SquareRoot(Vector4)

    Returns a vector whose elements are the square root of each of the source vector's elements.

    Declaration
    public static Vector4 SquareRoot(Vector4 value)
    Parameters
    Type Name Description
    Vector4 value

    The source vector.

    Returns
    Type Description
    Vector4

    The square root vector.

    SquareRoot(ref Vector4, out Vector4)

    Returns a vector whose elements are the square root of each of the source vector's elements.

    Declaration
    public static void SquareRoot(ref Vector4 value, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value

    The source vector.

    Vector4 result

    The square root vector.

    Subtract(Vector4, Vector4)

    Creates a new Vector4 that contains subtraction of on Vector4 from a another.

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

    The first vector to substract.

    Vector4 value2

    The second vector to substract.

    Returns
    Type Description
    Vector4

    The result of the vector subtraction.

    Subtract(ref Vector4, ref Vector4, out Vector4)

    Creates a new Vector4 that contains subtraction of on Vector4 from a another.

    Declaration
    public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value1

    The first vector to substract.

    Vector4 value2

    The second vector to substract.

    Vector4 result

    The result of the vector subtraction as an ouput parameter.

    ToString()

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

    ToVector2()

    Convert a Vector4 to Vector2.

    Declaration
    public Vector2 ToVector2()
    Returns
    Type Description
    Vector2

    The Vector2 with the x and y components.

    ToVector2(out Vector2)

    Convert a Vector4 to Vector2.

    Declaration
    public void ToVector2(out Vector2 result)
    Parameters
    Type Name Description
    Vector2 result

    The Vector2 with the x and y components as an output parameter.

    ToVector3()

    Convert a Vector4 to Vector3.

    Declaration
    public Vector3 ToVector3()
    Returns
    Type Description
    Vector3

    The Vector3 with the x, y and z components.

    ToVector3(out Vector3)

    Convert a Vector4 to Vector3.

    Declaration
    public void ToVector3(out Vector3 result)
    Parameters
    Type Name Description
    Vector3 result

    The Vector3 with the x, y and z components as an output parameter.

    Transform(Vector2, Matrix4x4)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static Vector4 Transform(Vector2 position, Matrix4x4 matrix)
    Parameters
    Type Name Description
    Vector2 position

    Source Vector2.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Returns
    Type Description
    Vector4

    Transformed Vector4.

    Transform(Vector2, Quaternion)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static Vector4 Transform(Vector2 value, Quaternion rotation)
    Parameters
    Type Name Description
    Vector2 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Returns
    Type Description
    Vector4

    The transformed vector.

    Transform(ref Vector2, ref Matrix4x4, out Vector4)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static void Transform(ref Vector2 position, ref Matrix4x4 matrix, out Vector4 result)
    Parameters
    Type Name Description
    Vector2 position

    Source Vector2.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Vector4 result

    Transformed Vector4 as an output parameter.

    Transform(ref Vector2, ref Quaternion, out Vector4)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector4 result)
    Parameters
    Type Name Description
    Vector2 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Vector4 result

    The transformed vector.

    Transform(Vector3, Matrix4x4)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static Vector4 Transform(Vector3 position, Matrix4x4 matrix)
    Parameters
    Type Name Description
    Vector3 position

    Source Vector3.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Returns
    Type Description
    Vector4

    Transformed Vector4.

    Transform(Vector3, Quaternion)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static Vector4 Transform(Vector3 value, Quaternion rotation)
    Parameters
    Type Name Description
    Vector3 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Returns
    Type Description
    Vector4

    The transformed vector.

    Transform(ref Vector3, ref Matrix4x4, out Vector4)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static void Transform(ref Vector3 position, ref Matrix4x4 matrix, out Vector4 result)
    Parameters
    Type Name Description
    Vector3 position

    Source Vector3.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Vector4 result

    Transformed Vector4 as an output parameter.

    Transform(ref Vector3, ref Quaternion, out Vector4)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static void Transform(ref Vector3 value, ref Quaternion rotation, out Vector4 result)
    Parameters
    Type Name Description
    Vector3 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Vector4 result

    The transformed vector.

    Transform(Vector4*, ref Matrix4x4, Vector4*)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static void Transform(Vector4* position, ref Matrix4x4 matrix, Vector4* result)
    Parameters
    Type Name Description
    Vector4* position

    Source Vector4.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Vector4* result

    Transformed Vector4 as an output parameter.

    Transform(Vector4, Matrix4x4)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static Vector4 Transform(Vector4 position, Matrix4x4 matrix)
    Parameters
    Type Name Description
    Vector4 position

    Source Vector4.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Returns
    Type Description
    Vector4

    Transformed Vector4.

    Transform(Vector4, Quaternion)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static Vector4 Transform(Vector4 value, Quaternion rotation)
    Parameters
    Type Name Description
    Vector4 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Returns
    Type Description
    Vector4

    The transformed vector.

    Transform(ref Vector4, ref Matrix4x4, out Vector4)

    Creates a new Vector4 that contains a transformation of 4D vector by the specified Matrix4x4.

    Declaration
    public static void Transform(ref Vector4 position, ref Matrix4x4 matrix, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 position

    Source Vector4.

    Matrix4x4 matrix

    The transformation Matrix4x4.

    Vector4 result

    Transformed Vector4 as an output parameter.

    Transform(ref Vector4, ref Quaternion, out Vector4)

    Transforms a vector by the given Quaternion rotation value.

    Declaration
    public static void Transform(ref Vector4 value, ref Quaternion rotation, out Vector4 result)
    Parameters
    Type Name Description
    Vector4 value

    The source vector to be rotated.

    Quaternion rotation

    The rotation to apply.

    Vector4 result

    The transformed vector.

    Operators

    operator +(Vector4, Vector4)

    Adds two vectors.

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

    Source Vector4 on the left of the add sign.

    Vector4 value2

    Source Vector4 on the right of the add sign.

    Returns
    Type Description
    Vector4

    Sum of the vectors.

    operator /(Vector4, Vector4)

    Divides the components of a Vector4 by the components of another Vector4.

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

    Source Vector4 on the left of the div sign.

    Vector4 value2

    Divisor Vector4 on the right of the div sign.

    Returns
    Type Description
    Vector4

    The result of dividing the vectors.

    operator /(Vector4, float)

    Divides the components of a Vector4 by a scalar.

    Declaration
    public static Vector4 operator /(Vector4 value1, float divider)
    Parameters
    Type Name Description
    Vector4 value1

    Source Vector4 on the left of the div sign.

    float divider

    Divisor scalar on the right of the div sign.

    Returns
    Type Description
    Vector4

    The result of dividing a vector by a scalar.

    operator ==(Vector4, Vector4)

    Compares whether two Vector4 instances are equal.

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

    Vector4 instance on the left of the equal sign.

    Vector4 value2

    Vector4 instance on the right of the equal sign.

    Returns
    Type Description
    bool

    true if the instances are equal; false otherwise.

    operator !=(Vector4, Vector4)

    Compares whether two Vector4 instances are not equal.

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

    Vector4 instance on the left of the not equal sign.

    Vector4 value2

    Vector4 instance on the right of the not equal sign.

    Returns
    Type Description
    bool

    true if the instances are not equal; false otherwise.

    operator *(Vector4, Vector4)

    Multiplies the components of two vectors by each other.

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

    Source Vector4 on the left of the mul sign.

    Vector4 value2

    Source Vector4 on the right of the mul sign.

    Returns
    Type Description
    Vector4

    Result of the vector multiplication.

    operator *(Vector4, float)

    Multiplies the components of vector by a scalar.

    Declaration
    public static Vector4 operator *(Vector4 value, float scaleFactor)
    Parameters
    Type Name Description
    Vector4 value

    Source Vector4 on the left of the mul sign.

    float scaleFactor

    Scalar value on the right of the mul sign.

    Returns
    Type Description
    Vector4

    Result of the vector multiplication with a scalar.

    operator *(float, Vector4)

    Multiplies the components of vector by a scalar.

    Declaration
    public static Vector4 operator *(float scaleFactor, Vector4 value)
    Parameters
    Type Name Description
    float scaleFactor

    Scalar value on the left of the mul sign.

    Vector4 value

    Source Vector4 on the right of the mul sign.

    Returns
    Type Description
    Vector4

    Result of the vector multiplication with a scalar.

    operator -(Vector4, Vector4)

    Subtracts a Vector4 from a Vector4.

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

    Source Vector4 on the left of the sub sign.

    Vector4 value2

    Source Vector4 on the right of the sub sign.

    Returns
    Type Description
    Vector4

    Result of the vector subtraction.

    operator -(Vector4)

    Inverts values in the specified Vector4.

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

    Source Vector4 on the right of the sub sign.

    Returns
    Type Description
    Vector4

    Result of the inversion.

    Implements

    IEquatable<T>

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In This Article
    Back to top
    Generated by DocFX