Struct Vector4
Represents a vector in a 4D coordinate system.
Namespace: Evergine.Mathematics
Assembly: Evergine.Mathematics.dll
Syntax
public struct 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 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 a vector. |
Abs(ref Vector4, out Vector4)
Creates a new Vector4 that contains the absolute values from 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 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 output 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 a 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 the 4D triangle. |
| Vector4 | value2 | The second vector of the 4D triangle. |
| Vector4 | value3 | The third vector of the 4D triangle. |
| float | amount1 | Barycentric scalar |
| float | amount2 | Barycentric scalar |
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 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 | The first vector of the 4D triangle. |
| Vector4 | value2 | The second vector of the 4D triangle. |
| Vector4 | value3 | The third vector of the 4D triangle. |
| float | amount1 | Barycentric scalar |
| float | amount2 | Barycentric scalar |
| 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 the interpolation. |
| Vector4 | value2 | The second vector in the interpolation. |
| Vector4 | value3 | The third vector in the interpolation. |
| Vector4 | value4 | The fourth vector in the 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 the interpolation. |
| Vector4 | value2 | The second vector in the interpolation. |
| Vector4 | value3 | The third vector in the interpolation. |
| Vector4 | value4 | The fourth vector in the interpolation. |
| float | amount | The weighting factor. |
| Vector4 | result | The result of the CatmullRom interpolation as an output parameter. |
Clamp(Vector4, Vector4, Vector4)
Restricts a vector between a minimum and maximum 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 maximum 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 the 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 the 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 squared distance. |
Divide(Vector4, 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 the vector by a scalar. |
Divide(ref Vector4, ref Vector4, out 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 the vector by the 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 the two vectors. |
Dot(ref Vector4, ref Vector4)
Returns the 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)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(Vector4 other)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
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 |
|
Equals(object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current instance. |
Returns
| Type | Description |
|---|---|
| bool | true if |
Overrides
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
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 the linear interpolation of the specified vectors as an output parameter. |
Max(Vector4, Vector4)
Creates a new Vector4 that contains the maximum 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 the maximum values from the two vectors. |
Max(ref Vector4, ref Vector4, out Vector4)
Creates a new Vector4 that contains the 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 the maximal values from the two vectors as an output parameter. |
Min(Vector4, Vector4)
Creates a new Vector4 that contains the minimum 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 the minimum values from the two vectors. |
Min(ref Vector4, ref Vector4, out Vector4)
Creates a new Vector4 that contains the minimum 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 minimum 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)
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)
Declaration
public static void Multiply(ref Vector4 value1, float scaleFactor, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | value1 | The source Vector4. |
| float | scaleFactor | The 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 into 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 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 containing 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)
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 |
Returns
| Type | Description |
|---|---|
| Vector4 | The Vector4 obtained by projecting |
Remarks
The returned vector is parallel to onVector. The function will return a zero vector if onVector is nearly zero.
Project(ref Vector4, ref Vector4, out 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 |
| Vector4 | result | The Vector4 obtained by projecting |
Remarks
The result vector is parallel to onVector. The function will return a zero vector if onVector is nearly 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 | The 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 | Weight 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)
Declaration
public static Vector4 Subtract(Vector4 value1, Vector4 value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | value1 | The first vector to subtract. |
| Vector4 | value2 | The second vector to subtract. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the vector subtraction. |
Subtract(ref Vector4, ref Vector4, out Vector4)
Declaration
public static void Subtract(ref Vector4 value1, ref Vector4 value2, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | value1 | The first vector to subtract. |
| Vector4 | value2 | The second vector to subtract. |
| Vector4 | result | The result of the vector subtraction as an output parameter. |
ToString()
Returns the fully qualified type name of this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string | The fully qualified type name. |
Overrides
ToVector2()
Declaration
public Vector2 ToVector2()
Returns
| Type | Description |
|---|---|
| Vector2 | The Vector2 with the x and y components. |
ToVector2(out 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()
Declaration
public Vector3 ToVector3()
Returns
| Type | Description |
|---|---|
| Vector3 | The Vector3 with the x, y, and z components. |
ToVector3(out 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)
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)
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)
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)
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.
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*)
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)
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)
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 addition sign. |
| Vector4 | value2 | Source Vector4 on the right of the addition sign. |
Returns
| Type | Description |
|---|---|
| Vector4 | Sum of the vectors. |
operator /(Vector4, Vector4)
Declaration
public static Vector4 operator /(Vector4 value1, Vector4 value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | value1 | Source Vector4 on the left of the division sign. |
| Vector4 | value2 | Divisor Vector4 on the right of the division 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 division sign. |
| float | divider | Divisor scalar on the right of the division 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 |
|
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 |
|
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 multiply sign. |
| Vector4 | value2 | Source Vector4 on the right of the multiply sign. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the vector multiplication. |
operator *(Vector4, float)
Multiplies the components of the 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 multiplication sign. |
| float | scaleFactor | Scalar value on the right of the multiplication sign. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the vector multiplication with a scalar. |
operator *(float, Vector4)
Multiplies the components of a 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 multiplication sign. |
| Vector4 | value | Source Vector4 on the right of the multiplication sign. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the vector multiplication with a scalar. |
operator -(Vector4, Vector4)
Declaration
public static Vector4 operator -(Vector4 value1, Vector4 value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | value1 | Source Vector4 on the left of the subtraction sign. |
| Vector4 | value2 | Source Vector4 on the right of the subtraction 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 subtraction sign. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the inversion. |