Show / Hide Table of Contents

Class Vector4

Defines a vector with four components.

Inheritance
System.Object
Vector4
Namespace: VRageMath
Assembly: VRage.Math.dll
Syntax
public sealed class Vector4 : ValueType, IEquatable<Vector4>

Constructors

Vector4(Single)

Creates a new instance of Vector4.

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

Value to initialize each component to.

Vector4(Single, Single, Single, Single)

Initializes a new instance of Vector4.

Declaration
public Vector4(float x, float y, float z, float w)
Parameters
Type Name Description
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(Vector2, Single, Single)

Initializes a new instance of Vector4.

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

A vector containing the values to initialize x and y components with.

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

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

A vector containing the values to initialize x, y, and z components with.

System.Single w

Initial value for the w-component of the vector.

Fields

One

Declaration
public static Vector4 One
Field Value
Type Description
Vector4

UnitW

Declaration
public static Vector4 UnitW
Field Value
Type Description
Vector4

UnitX

Declaration
public static Vector4 UnitX
Field Value
Type Description
Vector4

UnitY

Declaration
public static Vector4 UnitY
Field Value
Type Description
Vector4

UnitZ

Declaration
public static Vector4 UnitZ
Field Value
Type Description
Vector4

W

Gets or sets the w-component of the vector.

Declaration
public float W
Field Value
Type Description
System.Single

X

Gets or sets the x-component of the vector.

Declaration
public float X
Field Value
Type Description
System.Single

Y

Gets or sets the y-component of the vector.

Declaration
public float Y
Field Value
Type Description
System.Single

Z

Gets or sets the z-component of the vector.

Declaration
public float Z
Field Value
Type Description
System.Single

Zero

Declaration
public static Vector4 Zero
Field Value
Type Description
Vector4

Properties

Item[Int32]

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

Methods

Add(Vector4, Vector4)

Adds two vectors.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Add(ref Vector4, ref Vector4, out Vector4)

Adds two vectors.

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

Source vector.

Vector4 value2

Source vector.

Vector4 result

[OutAttribute] Sum of the source vectors.

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

Returns a Vector4 containing the 4D Cartesian coordinates of a point specified in barycentric (areal) coordinates relative to a 4D triangle.

Declaration
public static Vector4 Barycentric(Vector4 value1, Vector4 value2, Vector4 value3, float amount1, float amount2)
Parameters
Type Name Description
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
Type Description
Vector4

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 (areal) 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
Type Name Description
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

[OutAttribute] The 4D Cartesian coordinates of the specified point are placed in this Vector4 on exit.

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
Type Name Description
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
Type Description
Vector4

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
Type Name Description
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

[OutAttribute] A vector that is 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 value1, Vector4 min, Vector4 max)
Parameters
Type Name Description
Vector4 value1

The value to clamp.

Vector4 min

The minimum value.

Vector4 max

The maximum value.

Returns
Type Description
Vector4

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 value1, ref Vector4 min, ref Vector4 max, out Vector4 result)
Parameters
Type Name Description
Vector4 value1

The value to clamp.

Vector4 min

The minimum value.

Vector4 max

The maximum value.

Vector4 result

[OutAttribute] The clamped value.

Distance(Vector4, Vector4)

Calculates the distance between two vectors.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
System.Single

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
Type Name Description
Vector4 value1

Source vector.

Vector4 value2

Source vector.

System.Single result

[OutAttribute] The distance between the vectors.

DistanceSquared(Vector4, Vector4)

Calculates the distance between two vectors squared.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
System.Single

DistanceSquared(ref Vector4, ref Vector4, out Single)

Calculates the distance between two vectors squared.

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

Source vector.

Vector4 value2

Source vector.

System.Single result

[OutAttribute] The distance between the two vectors squared.

Divide(Vector4, Single)

Divides a vector by a scalar value.

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

Source vector.

System.Single divider

The divisor.

Returns
Type Description
Vector4

Divide(Vector4, Vector4)

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

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

Source vector.

Vector4 value2

Divisor vector.

Returns
Type Description
Vector4

Divide(ref Vector4, Single, out Vector4)

Divides a vector by a scalar value.

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

Source vector.

System.Single divider

The divisor.

Vector4 result

[OutAttribute] The result of the division.

Divide(ref Vector4, ref Vector4, out Vector4)

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

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

Source vector.

Vector4 value2

The divisor.

Vector4 result

[OutAttribute] The result of the division.

Dot(Vector4, Vector4)

Calculates the dot product of two vectors.

Declaration
public static float Dot(Vector4 vector1, Vector4 vector2)
Parameters
Type Name Description
Vector4 vector1

Source vector.

Vector4 vector2

Source vector.

Returns
Type Description
System.Single

Dot(ref Vector4, ref Vector4, out Single)

Calculates the dot product of two vectors.

Declaration
public static void Dot(ref Vector4 vector1, ref Vector4 vector2, out float result)
Parameters
Type Name Description
Vector4 vector1

Source vector.

Vector4 vector2

Source vector.

System.Single result

[OutAttribute] The dot product of the two vectors.

Equals(Object)

Returns a value that indicates whether the current instance is equal to a specified object.

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

Object with which to make the comparison.

Returns
Type Description
System.Boolean

Equals(Vector4)

Determines whether the specified Object is equal to the Vector4.

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

The Vector4 to compare with the current Vector4.

Returns
Type Description
System.Boolean

GetHashCode()

Gets the hash code of this object.

Declaration
public override int GetHashCode()
Returns
Type Description
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
Type Name Description
Vector4 value1

Source position vector.

Vector4 tangent1

Source tangent vector.

Vector4 value2

Source position vector.

Vector4 tangent2

Source tangent vector.

System.Single amount

Weighting factor.

Returns
Type Description
Vector4

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
Type Name Description
Vector4 value1

Source position vector.

Vector4 tangent1

Source tangent vector.

Vector4 value2

Source position vector.

Vector4 tangent2

Source tangent vector.

System.Single amount

Weighting factor.

Vector4 result

[OutAttribute] The result of the Hermite spline interpolation.

Length()

Calculates the length of the vector.

Declaration
public float Length()
Returns
Type Description
System.Single

LengthSquared()

Calculates the length of the vector squared.

Declaration
public float LengthSquared()
Returns
Type Description
System.Single

Lerp(Vector4, Vector4, Single)

Performs a linear interpolation between two vectors.

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

Source vector.

Vector4 value2

Source vector.

System.Single amount

Value between 0 and 1 indicating the weight of value2.

Returns
Type Description
Vector4

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

Performs a linear interpolation between two vectors.

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

Source vector.

Vector4 value2

Source vector.

System.Single amount

Value between 0 and 1 indicating the weight of value2.

Vector4 result

[OutAttribute] The result of the interpolation.

Max(Vector4, Vector4)

Returns a vector that contains the highest value from each matching pair of components.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Max(ref Vector4, ref Vector4, out Vector4)

Returns a vector that contains the highest value from each matching pair of components.

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

Source vector.

Vector4 value2

Source vector.

Vector4 result

[OutAttribute] The maximized vector.

Min(Vector4, Vector4)

Returns a vector that contains the lowest value from each matching pair of components.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Min(ref Vector4, ref Vector4, out Vector4)

Returns a vector that contains the lowest value from each matching pair of components.

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

Source vector.

Vector4 value2

Source vector.

Vector4 result

[OutAttribute] The minimized vector.

Multiply(Vector4, Single)

Multiplies a vector by a scalar.

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

Source vector.

System.Single scaleFactor

Scalar value.

Returns
Type Description
Vector4

Multiply(Vector4, Vector4)

Multiplies the components of two vectors by each other.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Multiply(ref Vector4, Single, out Vector4)

Multiplies a vector by a scalar value.

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

Source vector.

System.Single scaleFactor

Scalar value.

Vector4 result

[OutAttribute] The result of the multiplication.

Multiply(ref Vector4, ref Vector4, out Vector4)

Multiplies the components of two vectors by each other.

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

Source vector.

Vector4 value2

Source vector.

Vector4 result

[OutAttribute] The result of the multiplication.

Negate(Vector4)

Returns a vector pointing in the opposite direction.

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

Source vector.

Returns
Type Description
Vector4

Negate(ref Vector4, out Vector4)

Returns a vector pointing in the opposite direction.

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

Source vector.

Vector4 result

[OutAttribute] Vector pointing in the opposite direction.

Normalize()

Turns the current vector into a unit vector.

Declaration
public void Normalize()

Normalize(Vector4)

Creates a unit vector from the specified vector.

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

The source Vector4.

Returns
Type Description
Vector4

Normalize(ref Vector4, out Vector4)

Returns a normalized version of the specified vector.

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

Source vector.

Vector4 result

[OutAttribute] The normalized vector.

PackOrthoMatrix(ref Matrix)

Declaration
public static Vector4 PackOrthoMatrix(ref Matrix matrix)
Parameters
Type Name Description
Matrix matrix
Returns
Type Description
Vector4

PackOrthoMatrix(Vector3, Vector3, Vector3)

Declaration
public static Vector4 PackOrthoMatrix(Vector3 position, Vector3 forward, Vector3 up)
Parameters
Type Name Description
Vector3 position
Vector3 forward
Vector3 up
Returns
Type Description
Vector4

SmoothStep(Vector4, Vector4, Single)

Interpolates between two values using a cubic equation.

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

Source value.

Vector4 value2

Source value.

System.Single amount

Weighting value.

Returns
Type Description
Vector4

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

Interpolates between two values using a cubic equation.

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

Source vector.

Vector4 value2

Source vector.

System.Single amount

Weighting factor.

Vector4 result

[OutAttribute] The interpolated value.

Subtract(Vector4, Vector4)

Subtracts a vector from a vector.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Subtract(ref Vector4, ref Vector4, out Vector4)

Subtracts a vector from a vector.

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

Source vector.

Vector4 value2

Source vector.

Vector4 result

[OutAttribute] The result of the subtraction.

ToString()

Retrieves a string representation of the current object.

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

Transform(Vector2, Matrix)

Transforms a Vector2 by the given Matrix.

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

The source Vector2.

Matrix matrix

The transformation Matrix.

Returns
Type Description
Vector4

Transform(Vector2, Quaternion)

Transforms a Vector2 by a specified Quaternion into a Vector4.

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

The Vector2 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Returns
Type Description
Vector4

Transform(ref Vector2, ref Matrix, out Vector4)

Transforms a Vector2 by the given Matrix.

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

The source Vector2.

Matrix matrix

The transformation Matrix.

Vector4 result

[OutAttribute] The Vector4 resulting from the transformation.

Transform(ref Vector2, ref Quaternion, out Vector4)

Transforms a Vector2 by a specified Quaternion into a Vector4.

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

The Vector2 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Vector4 result

[OutAttribute] The Vector4 resulting from the transformation.

Transform(Vector3, Matrix)

Transforms a Vector3 by the given Matrix.

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

The source Vector3.

Matrix matrix

The transformation Matrix.

Returns
Type Description
Vector4

Transform(Vector3, Quaternion)

Transforms a Vector3 by a specified Quaternion into a Vector4.

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

The Vector3 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Returns
Type Description
Vector4

Transform(ref Vector3, ref Matrix, out Vector4)

Transforms a Vector3 by the given Matrix.

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

The source Vector3.

Matrix matrix

The transformation Matrix.

Vector4 result

[OutAttribute] The Vector4 resulting from the transformation.

Transform(ref Vector3, ref Quaternion, out Vector4)

Transforms a Vector3 by a specified Quaternion into a Vector4.

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

The Vector3 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Vector4 result

[OutAttribute] The Vector4 resulting from the transformation.

Transform(Vector4, Matrix)

Transforms a Vector4 by the specified Matrix.

Declaration
public static Vector4 Transform(Vector4 vector, Matrix matrix)
Parameters
Type Name Description
Vector4 vector

The source Vector4.

Matrix matrix

The transformation Matrix.

Returns
Type Description
Vector4

Transform(Vector4, Quaternion)

Transforms a Vector4 by a specified Quaternion.

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

The Vector4 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Returns
Type Description
Vector4

Transform(ref Vector4, ref Matrix, out Vector4)

Transforms a Vector4 by the given Matrix.

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

The source Vector4.

Matrix matrix

The transformation Matrix.

Vector4 result

[OutAttribute] The Vector4 resulting from the transformation.

Transform(ref Vector4, ref Quaternion, out Vector4)

Transforms a Vector4 by a specified Quaternion.

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

The Vector4 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Vector4 result

[OutAttribute] The Vector4 resulting from the transformation.

Transform(Vector4[], Int32, ref Matrix, Vector4[], Int32, Int32)

Transforms a specified range in an array of Vector4s by a specified Matrix into a specified range in a destination array.

Declaration
public static void Transform(Vector4[] sourceArray, int sourceIndex, ref Matrix matrix, Vector4[] destinationArray, int destinationIndex, int length)
Parameters
Type Name Description
Vector4[] sourceArray

The array of Vector4s containing the range to transform.

System.Int32 sourceIndex

The index in the source array of the first Vector4 to transform.

Matrix matrix

The transform Matrix to apply.

Vector4[] destinationArray

The existing destination array of Vector4s into which to write the results.

System.Int32 destinationIndex

The index in the destination array of the first result Vector4 to write.

System.Int32 length

The number of Vector4s to transform.

Transform(Vector4[], Int32, ref Quaternion, Vector4[], Int32, Int32)

Transforms a specified range in an array of Vector4s by a specified Quaternion into a specified range in a destination array.

Declaration
public static void Transform(Vector4[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector4[] destinationArray, int destinationIndex, int length)
Parameters
Type Name Description
Vector4[] sourceArray

The array of Vector4s containing the range to transform.

System.Int32 sourceIndex

The index in the source array of the first Vector4 to transform.

Quaternion rotation

The Quaternion rotation to apply.

Vector4[] destinationArray

The existing destination array of Vector4s into which to write the results.

System.Int32 destinationIndex

The index in the destination array of the first result Vector4 to write.

System.Int32 length

The number of Vector4s to transform.

Transform(Vector4[], ref Matrix, Vector4[])

Transforms an array of Vector4s by a specified Matrix.

Declaration
public static void Transform(Vector4[] sourceArray, ref Matrix matrix, Vector4[] destinationArray)
Parameters
Type Name Description
Vector4[] sourceArray

The array of Vector4s to transform.

Matrix matrix

The transform Matrix to apply.

Vector4[] destinationArray

The existing destination array into which the transformed Vector4s are written.

Transform(Vector4[], ref Quaternion, Vector4[])

Transforms an array of Vector4s by a specified Quaternion.

Declaration
public static void Transform(Vector4[] sourceArray, ref Quaternion rotation, Vector4[] destinationArray)
Parameters
Type Name Description
Vector4[] sourceArray

The array of Vector4s to transform.

Quaternion rotation

The Quaternion rotation to apply.

Vector4[] destinationArray

The existing destination array into which the transformed Vector4s are written.

UnpackOrthoMatrix(ref Vector4)

Declaration
public static Matrix UnpackOrthoMatrix(ref Vector4 packed)
Parameters
Type Name Description
Vector4 packed
Returns
Type Description
Matrix

UnpackOrthoMatrix(ref Vector4, out Matrix)

Declaration
public static void UnpackOrthoMatrix(ref Vector4 packed, out Matrix matrix)
Parameters
Type Name Description
Vector4 packed
Matrix matrix

Operators

Addition(Vector4, Vector4)

Adds two vectors.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Division(Single, Vector4)

Divides a vector by a scalar value.

Declaration
public static Vector4 operator /(float lhs, Vector4 rhs)
Parameters
Type Name Description
System.Single lhs
Vector4 rhs
Returns
Type Description
Vector4

Division(Vector4, Single)

Divides a vector by a scalar value.

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

Source vector.

System.Single divider

The divisor.

Returns
Type Description
Vector4

Division(Vector4, Vector4)

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

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

Source vector.

Vector4 value2

Divisor vector.

Returns
Type Description
Vector4

Equality(Vector4, Vector4)

Tests vectors for equality.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
System.Boolean

Inequality(Vector4, Vector4)

Tests vectors for inequality.

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

Vector to compare.

Vector4 value2

Vector to compare.

Returns
Type Description
System.Boolean

Multiply(Single, Vector4)

Multiplies a vector by a scalar.

Declaration
public static Vector4 operator *(float scaleFactor, Vector4 value1)
Parameters
Type Name Description
System.Single scaleFactor

Scalar value.

Vector4 value1

Source vector.

Returns
Type Description
Vector4

Multiply(Vector4, Single)

Multiplies a vector by a scalar.

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

Source vector.

System.Single scaleFactor

Scalar value.

Returns
Type Description
Vector4

Multiply(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 vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

Subtraction(Vector4, Vector4)

Subtracts a vector from a vector.

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

Source vector.

Vector4 value2

Source vector.

Returns
Type Description
Vector4

UnaryNegation(Vector4)

Returns a vector pointing in the opposite direction.

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

Source vector.

Returns
Type Description
Vector4

Extension Methods

ColorExtensions.UnmultiplyColor(Vector4)
ColorExtensions.PremultiplyColor(Vector4)
ColorExtensions.ToSRGB(Vector4)
ColorExtensions.ToLinearRGB(Vector4)
ColorExtensions.ToGray(Vector4)
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾