Struct Vector4
Represents a 4D vector using four single-precision floating-point numbers.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector4 : IEquatable<Vector4>, IFormattable
Remarks
The Vector4 structure is suitable for interoperation with unmanaged code requiring four consecutive floats.
Constructors
Vector4(Vector2)
Initializes a new instance of the Vector4 struct.
Declaration
public Vector4(Vector2 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector2 | v | The Vector2 to copy components from. |
Vector4(Vector3, float)
Initializes a new instance of the Vector4 struct.
Declaration
public Vector4(Vector3 v, float w)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | v | The Vector3 to copy components from. |
| float | w | The w component of the new Vector4. |
Vector4(Vector3)
Initializes a new instance of the Vector4 struct.
Declaration
public Vector4(Vector3 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | v | The Vector3 to copy components from. |
Remarks
Vector4(Vector4)
Initializes a new instance of the Vector4 struct.
Declaration
public Vector4(Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | v | The Vector4 to copy components from. |
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 component of the Vector4. |
| float | y | The y component of the Vector4. |
| float | z | The z component of the Vector4. |
| float | w | The w component of the Vector4. |
Vector4(float)
Initializes a new instance of the Vector4 struct.
Declaration
public Vector4(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| float | value | The value that will initialize this instance. |
Fields
NegativeInfinity
Defines an instance with all components set to negative infinity.
Declaration
public static readonly Vector4 NegativeInfinity
Field Value
| Type | Description |
|---|---|
| Vector4 |
One
Defines an instance with all components set to 1.
Declaration
public static readonly Vector4 One
Field Value
| Type | Description |
|---|---|
| Vector4 |
PositiveInfinity
Defines an instance with all components set to positive infinity.
Declaration
public static readonly Vector4 PositiveInfinity
Field Value
| Type | Description |
|---|---|
| Vector4 |
SizeInBytes
Defines the size of the Vector4 struct in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
| Type | Description |
|---|---|
| int |
UnitW
Defines a unit-length Vector4 that points towards the W-axis.
Declaration
public static readonly Vector4 UnitW
Field Value
| Type | Description |
|---|---|
| Vector4 |
UnitX
Defines a unit-length Vector4 that points towards the X-axis.
Declaration
public static readonly Vector4 UnitX
Field Value
| Type | Description |
|---|---|
| Vector4 |
UnitY
Defines a unit-length Vector4 that points towards the Y-axis.
Declaration
public static readonly Vector4 UnitY
Field Value
| Type | Description |
|---|---|
| Vector4 |
UnitZ
Defines a unit-length Vector4 that points towards the Z-axis.
Declaration
public static readonly Vector4 UnitZ
Field Value
| Type | Description |
|---|---|
| Vector4 |
W
The W component of the Vector4.
Declaration
public float W
Field Value
| Type | Description |
|---|---|
| float |
X
The X component of the Vector4.
Declaration
public float X
Field Value
| Type | Description |
|---|---|
| float |
Y
The Y component of the Vector4.
Declaration
public float Y
Field Value
| Type | Description |
|---|---|
| float |
Z
The Z component of the Vector4.
Declaration
public float Z
Field Value
| Type | Description |
|---|---|
| float |
Zero
Defines an instance with all components set to 0.
Declaration
public static readonly Vector4 Zero
Field Value
| Type | Description |
|---|---|
| Vector4 |
Properties
this[int]
Gets or sets the value at the index of the Vector.
Declaration
public float this[int index] { readonly get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The index of the component from the Vector. |
Property Value
| Type | Description |
|---|---|
| float |
Exceptions
| Type | Condition |
|---|---|
| IndexOutOfRangeException | Thrown if the index is less than 0 or greater than 3. |
Length
Gets the length (magnitude) of the vector.
Declaration
public readonly float Length { get; }
Property Value
| Type | Description |
|---|---|
| float |
See Also
LengthFast
Gets an approximation of the vector length (magnitude).
Declaration
public readonly float LengthFast { get; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
This property uses an approximation of the square root function to calculate vector magnitude, with an upper error bound of 0.001.
See Also
LengthSquared
Gets the square of the vector length (magnitude).
Declaration
public readonly float LengthSquared { get; }
Property Value
| Type | Description |
|---|---|
| float |
Remarks
This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.
See Also
ReciprocalLengthFast
Gets an approximation of 1 over the length (magnitude) of the vector.
Declaration
public readonly float ReciprocalLengthFast { get; }
Property Value
| Type | Description |
|---|---|
| float |
Wx
Gets or sets an OpenTK.Vector2 with the W and X components of this instance.
Declaration
public Vector2 Wx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Wxy
Gets or sets an OpenTK.Vector3 with the W, X, and Y components of this instance.
Declaration
public Vector3 Wxy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Wxyz
Gets or sets an OpenTK.Vector4 with the W, X, Y, and Z components of this instance.
Declaration
public Vector4 Wxyz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Wxz
Gets or sets an OpenTK.Vector3 with the W, X, and Z components of this instance.
Declaration
public Vector3 Wxz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Wxzy
Gets or sets an OpenTK.Vector4 with the W, X, Z, and Y components of this instance.
Declaration
public Vector4 Wxzy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Wy
Gets or sets an OpenTK.Vector2 with the W and Y components of this instance.
Declaration
public Vector2 Wy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Wyx
Gets or sets an OpenTK.Vector3 with the W, Y, and X components of this instance.
Declaration
public Vector3 Wyx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Wyxz
Gets or sets an OpenTK.Vector4 with the W, Y, X, and Z components of this instance.
Declaration
public Vector4 Wyxz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Wyz
Gets or sets an OpenTK.Vector3 with the W, Y, and Z components of this instance.
Declaration
public Vector3 Wyz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Wyzx
Gets or sets an OpenTK.Vector4 with the W, Y, Z, and X components of this instance.
Declaration
public Vector4 Wyzx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Wz
Gets or sets an OpenTK.Vector2 with the W and Z components of this instance.
Declaration
public Vector2 Wz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Wzx
Gets or sets an OpenTK.Vector3 with the W, Z, and X components of this instance.
Declaration
public Vector3 Wzx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Wzxy
Gets or sets an OpenTK.Vector4 with the W, Z, X, and Y components of this instance.
Declaration
public Vector4 Wzxy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Wzy
Gets or sets an OpenTK.Vector3 with the W, Z, and Y components of this instance.
Declaration
public Vector3 Wzy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Wzyw
Gets or sets an OpenTK.Vector4 with the W, Z, Y, and W components of this instance.
Declaration
public Vector4 Wzyw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Wzyx
Gets or sets an OpenTK.Vector4 with the W, Z, Y, and X components of this instance.
Declaration
public Vector4 Wzyx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Xw
Gets or sets an OpenTK.Vector2 with the X and W components of this instance.
Declaration
public Vector2 Xw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Xwy
Gets or sets an OpenTK.Vector3 with the X, W, and Y components of this instance.
Declaration
public Vector3 Xwy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Xwyz
Gets or sets an OpenTK.Vector4 with the X, W, Y, and Z components of this instance.
Declaration
public Vector4 Xwyz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Xwz
Gets or sets an OpenTK.Vector3 with the X, W, and Z components of this instance.
Declaration
public Vector3 Xwz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Xwzy
Gets or sets an OpenTK.Vector4 with the X, W, Z, and Y components of this instance.
Declaration
public Vector4 Xwzy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Xy
Gets or sets an OpenTK.Vector2 with the X and Y components of this instance.
Declaration
public Vector2 Xy { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Xyw
Gets or sets an OpenTK.Vector3 with the X, Y, and Z components of this instance.
Declaration
public Vector3 Xyw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Xywz
Gets or sets an OpenTK.Vector4 with the X, Y, W, and Z components of this instance.
Declaration
public Vector4 Xywz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Xyz
Gets or sets an OpenTK.Vector3 with the X, Y, and Z components of this instance.
Declaration
public Vector3 Xyz { get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Xz
Gets or sets an OpenTK.Vector2 with the X and Z components of this instance.
Declaration
public Vector2 Xz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Xzw
Gets or sets an OpenTK.Vector3 with the X, Z, and W components of this instance.
Declaration
public Vector3 Xzw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Xzwy
Gets or sets an OpenTK.Vector4 with the X, Z, W, and Y components of this instance.
Declaration
public Vector4 Xzwy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Xzy
Gets or sets an OpenTK.Vector3 with the X, Z, and Y components of this instance.
Declaration
public Vector3 Xzy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Xzyw
Gets or sets an OpenTK.Vector4 with the X, Z, Y, and W components of this instance.
Declaration
public Vector4 Xzyw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yw
Gets or sets an OpenTK.Vector2 with the Y and W components of this instance.
Declaration
public Vector2 Yw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Ywx
Gets or sets an OpenTK.Vector3 with the Y, W, and X components of this instance.
Declaration
public Vector3 Ywx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Ywxz
Gets or sets an OpenTK.Vector4 with the Y, W, X, and Z components of this instance.
Declaration
public Vector4 Ywxz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Ywz
Gets or sets an OpenTK.Vector3 with the Y, W, and Z components of this instance.
Declaration
public Vector3 Ywz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Ywzx
Gets or sets an OpenTK.Vector4 with the Y, W, Z, and X components of this instance.
Declaration
public Vector4 Ywzx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yx
Gets or sets an OpenTK.Vector2 with the Y and X components of this instance.
Declaration
public Vector2 Yx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Yxw
Gets or sets an OpenTK.Vector3 with the Y, X, and W components of this instance.
Declaration
public Vector3 Yxw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Yxwz
Gets or sets an OpenTK.Vector4 with the Y, X, W, and Z components of this instance.
Declaration
public Vector4 Yxwz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yxz
Gets or sets an OpenTK.Vector3 with the Y, X, and Z components of this instance.
Declaration
public Vector3 Yxz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Yxzw
Gets or sets an OpenTK.Vector4 with the Y, X, Z, and W components of this instance.
Declaration
public Vector4 Yxzw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yywz
Gets or sets an OpenTK.Vector4 with the Y, Y, W, and Z components of this instance.
Declaration
public Vector4 Yywz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yyzw
Gets or sets an OpenTK.Vector4 with the Y, Y, Z, and W components of this instance.
Declaration
public Vector4 Yyzw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yz
Gets or sets an OpenTK.Vector2 with the Y and Z components of this instance.
Declaration
public Vector2 Yz { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Yzw
Gets or sets an OpenTK.Vector3 with the Y, Z, and W components of this instance.
Declaration
public Vector3 Yzw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Yzwx
Gets or sets an OpenTK.Vector4 with the Y, Z, W, and X components of this instance.
Declaration
public Vector4 Yzwx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Yzx
Gets or sets an OpenTK.Vector3 with the Y, Z, and X components of this instance.
Declaration
public Vector3 Yzx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Yzxw
Gets or sets an OpenTK.Vector4 with the Y, Z, X, and W components of this instance.
Declaration
public Vector4 Yzxw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zw
Gets or sets an OpenTK.Vector2 with the Z and W components of this instance.
Declaration
public Vector2 Zw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Zwx
Gets or sets an OpenTK.Vector3 with the Z, W, and X components of this instance.
Declaration
public Vector3 Zwx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Zwxy
Gets or sets an OpenTK.Vector4 with the Z, W, X, and Y components of this instance.
Declaration
public Vector4 Zwxy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zwy
Gets or sets an OpenTK.Vector3 with the Z, W, and Y components of this instance.
Declaration
public Vector3 Zwy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Zwyx
Gets or sets an OpenTK.Vector4 with the Z, W, Y, and X components of this instance.
Declaration
public Vector4 Zwyx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zwzy
Gets or sets an OpenTK.Vector4 with the Z, W, Z, and Y components of this instance.
Declaration
public Vector4 Zwzy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zx
Gets or sets an OpenTK.Vector2 with the Z and X components of this instance.
Declaration
public Vector2 Zx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Zxw
Gets or sets an OpenTK.Vector3 with the Z, X, and W components of this instance.
Declaration
public Vector3 Zxw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Zxwy
Gets or sets an OpenTK.Vector4 with the Z, X, W, and Y components of this instance.
Declaration
public Vector4 Zxwy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zxy
Gets or sets an OpenTK.Vector3 with the Z, X, and Y components of this instance.
Declaration
public Vector3 Zxy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Zxyw
Gets or sets an OpenTK.Vector4 with the Z, X, Y, and Z components of this instance.
Declaration
public Vector4 Zxyw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zy
Gets or sets an OpenTK.Vector2 with the Z and Y components of this instance.
Declaration
public Vector2 Zy { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
Zyw
Gets or sets an OpenTK.Vector3 with the Z, Y, and W components of this instance.
Declaration
public Vector3 Zyw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Zywx
Gets or sets an OpenTK.Vector4 with the Z, Y, W, and X components of this instance.
Declaration
public Vector4 Zywx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Zyx
Gets or sets an OpenTK.Vector3 with the Z, Y, and X components of this instance.
Declaration
public Vector3 Zyx { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector3 |
Zyxw
Gets or sets an OpenTK.Vector4 with the Z, Y, X, and W components of this instance.
Declaration
public Vector4 Zyxw { readonly get; set; }
Property Value
| Type | Description |
|---|---|
| Vector4 |
Methods
Abs()
Returns a new vector that is the component-wise absolute value of the vector.
Declaration
public readonly Vector4 Abs()
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise absolute value vector. |
Abs(Vector4)
Take the component-wise absolute value of a vector.
Declaration
public static Vector4 Abs(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to apply component-wise absolute value to. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise absolute value vector. |
Abs(in Vector4, out Vector4)
Take the component-wise absolute value of a vector.
Declaration
public static void Abs(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to apply component-wise absolute value to. |
| Vector4 | result | The component-wise absolute value vector. |
Add(Vector4, Vector4)
Adds two vectors.
Declaration
[Pure]
public static Vector4 Add(Vector4 a, Vector4 b)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | Left operand. |
| Vector4 | b | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of operation. |
Add(in Vector4, in Vector4, out Vector4)
Adds two vectors.
Declaration
public static void Add(in Vector4 a, in Vector4 b, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | Left operand. |
| Vector4 | b | Right operand. |
| Vector4 | result | Result of operation. |
BaryCentric(Vector4, Vector4, Vector4, float, float)
Interpolate 3 Vectors using Barycentric coordinates.
Declaration
[Pure]
public static Vector4 BaryCentric(Vector4 a, Vector4 b, Vector4 c, float u, float v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First input Vector. |
| Vector4 | b | Second input Vector. |
| Vector4 | c | Third input Vector. |
| float | u | First Barycentric Coordinate. |
| float | v | Second Barycentric Coordinate. |
Returns
| Type | Description |
|---|---|
| Vector4 | a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise. |
BaryCentric(in Vector4, in Vector4, in Vector4, float, float, out Vector4)
Interpolate 3 Vectors using Barycentric coordinates.
Declaration
public static void BaryCentric(in Vector4 a, in Vector4 b, in Vector4 c, float u, float v, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First input Vector. |
| Vector4 | b | Second input Vector. |
| Vector4 | c | Third input Vector. |
| float | u | First Barycentric Coordinate. |
| float | v | Second Barycentric Coordinate. |
| Vector4 | result | Output Vector. a when u=v=0, b when u=1,v=0, c when u=0,v=1, and a linear combination of a,b,c otherwise. |
Ceiling()
Returns a new vector were a component-wise ceiling operation has been applied. Equivalent to calling Ceiling(float) on each component.
Declaration
public readonly Vector4 Ceiling()
Returns
| Type | Description |
|---|---|
| Vector4 | The ceiled vector. |
Ceiling(Vector4)
Component-wise ceiling operation. Equivalent to calling Ceiling(float) on each component.
Declaration
[Pure]
public static Vector4 Ceiling(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to take the ceiling of. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise ceiling vector. |
Ceiling(in Vector4, out Vector4)
Component-wise ceiling operation. Equivalent to calling Ceiling(float) on each component.
Declaration
public static void Ceiling(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to take the ceiling of. |
| Vector4 | result | The component-wise ceiling vector. |
Clamp(Vector4, Vector4, Vector4)
Clamp a vector to the given minimum and maximum vectors.
Declaration
[Pure]
public static Vector4 Clamp(Vector4 vec, Vector4 min, Vector4 max)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | Input vector. |
| Vector4 | min | Minimum vector. |
| Vector4 | max | Maximum vector. |
Returns
| Type | Description |
|---|---|
| Vector4 | The clamped vector. |
Clamp(in Vector4, in Vector4, in Vector4, out Vector4)
Clamp a vector to the given minimum and maximum vectors.
Declaration
public static void Clamp(in Vector4 vec, in Vector4 min, in Vector4 max, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | Input vector. |
| Vector4 | min | Minimum vector. |
| Vector4 | max | Maximum vector. |
| Vector4 | result | The clamped vector. |
ComponentMax(Vector4, Vector4)
Returns a vector created from the largest of the corresponding components of the given vectors.
Declaration
[Pure]
public static Vector4 ComponentMax(Vector4 a, Vector4 b)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First operand. |
| Vector4 | b | Second operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise maximum. |
ComponentMax(in Vector4, in Vector4, out Vector4)
Returns a vector created from the largest of the corresponding components of the given vectors.
Declaration
public static void ComponentMax(in Vector4 a, in Vector4 b, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First operand. |
| Vector4 | b | Second operand. |
| Vector4 | result | The component-wise maximum. |
ComponentMin(Vector4, Vector4)
Returns a vector created from the smallest of the corresponding components of the given vectors.
Declaration
[Pure]
public static Vector4 ComponentMin(Vector4 a, Vector4 b)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First operand. |
| Vector4 | b | Second operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise minimum. |
ComponentMin(in Vector4, in Vector4, out Vector4)
Returns a vector created from the smallest of the corresponding components of the given vectors.
Declaration
public static void ComponentMin(in Vector4 a, in Vector4 b, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First operand. |
| Vector4 | b | Second operand. |
| Vector4 | result | The component-wise minimum. |
Deconstruct(out float, out float, out float, out float)
Deconstructs the vector into it's individual components.
Declaration
[Pure]
public readonly void Deconstruct(out float x, out float y, out float z, out float w)
Parameters
| Type | Name | Description |
|---|---|---|
| float | x | The X component of the vector. |
| float | y | The Y component of the vector. |
| float | z | The Z component of the vector. |
| float | w | The W component of the vector. |
Distance(Vector4, Vector4)
Compute the euclidean distance between two vectors.
Declaration
[Pure]
public static float Distance(Vector4 vec1, Vector4 vec2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec1 | The first vector. |
| Vector4 | vec2 | The second vector. |
Returns
| Type | Description |
|---|---|
| float | The distance. |
Distance(in Vector4, in Vector4, out float)
Compute the euclidean distance between two vectors.
Declaration
public static void Distance(in Vector4 vec1, in Vector4 vec2, out float result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec1 | The first vector. |
| Vector4 | vec2 | The second vector. |
| float | result | The distance. |
DistanceSquared(Vector4, Vector4)
Compute the squared euclidean distance between two vectors.
Declaration
[Pure]
public static float DistanceSquared(Vector4 vec1, Vector4 vec2)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec1 | The first vector. |
| Vector4 | vec2 | The second vector. |
Returns
| Type | Description |
|---|---|
| float | The squared distance. |
DistanceSquared(in Vector4, in Vector4, out float)
Compute the squared euclidean distance between two vectors.
Declaration
public static void DistanceSquared(in Vector4 vec1, in Vector4 vec2, out float result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec1 | The first vector. |
| Vector4 | vec2 | The second vector. |
| float | result | The squared distance. |
Divide(Vector4, Vector4)
Divides a vector by the components of a vector (scale).
Declaration
[Pure]
public static Vector4 Divide(Vector4 vector, Vector4 scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| Vector4 | scale | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the operation. |
Divide(Vector4, float)
Divides a vector by a scalar.
Declaration
[Pure]
public static Vector4 Divide(Vector4 vector, float scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| float | scale | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the operation. |
Divide(in Vector4, in Vector4, out Vector4)
Divide a vector by the components of a vector (scale).
Declaration
public static void Divide(in Vector4 vector, in Vector4 scale, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| Vector4 | scale | Right operand. |
| Vector4 | result | Result of the operation. |
Divide(in Vector4, float, out Vector4)
Divides a vector by a scalar.
Declaration
public static void Divide(in Vector4 vector, float scale, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| float | scale | Right operand. |
| Vector4 | result | Result of the operation. |
Dot(Vector4, Vector4)
Calculate the dot product of two vectors.
Declaration
[Pure]
public static float Dot(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | First operand. |
| Vector4 | right | Second operand. |
Returns
| Type | Description |
|---|---|
| float | The dot product of the two inputs. |
Dot(in Vector4, in Vector4, out float)
Calculate the dot product of two vectors.
Declaration
public static void Dot(in Vector4 left, in Vector4 right, out float result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | First operand. |
| Vector4 | right | Second operand. |
| float | result | The dot product of the two inputs. |
Elerp(Vector4, Vector4, float)
Returns a new vector that is the exponential interpolation of the two vectors.
Equivalent to a * pow(b/a, t).
Declaration
public static Vector4 Elerp(Vector4 a, Vector4 b, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | The starting value. Must be non-negative. |
| Vector4 | b | The end value. Must be non-negative. |
| float | t | The blend factor. |
Returns
| Type | Description |
|---|---|
| Vector4 | The exponential interpolation between |
See Also
Elerp(in Vector4, in Vector4, float, out Vector4)
Returns a new vector that is the exponential interpolation of the two vectors.
Equivalent to a * pow(b/a, t).
Declaration
public static void Elerp(in Vector4 a, in Vector4 b, float t, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | The starting value. Must be non-negative. |
| Vector4 | b | The end value. Must be non-negative. |
| float | t | The blend factor. |
| Vector4 | result | The exponential interpolation between |
See Also
Equals(Vector4)
Declaration
public readonly bool Equals(Vector4 other)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | other |
Returns
| Type | Description |
|---|---|
| bool |
Equals(object)
Declaration
public override readonly bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
Floor()
Returns a new vector were a component-wise floor operation has been applied. Equivalent to calling Floor(float) on each component.
Declaration
public readonly Vector4 Floor()
Returns
| Type | Description |
|---|---|
| Vector4 | The floored vector. |
Floor(Vector4)
Component-wise floor operation. Equivalent to calling Floor(float) on each component.
Declaration
[Pure]
public static Vector4 Floor(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to take the floor of. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise floored vector. |
Floor(in Vector4, out Vector4)
Component-wise floor operation. Equivalent to calling Floor(float) on each component.
Declaration
public static void Floor(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to take the floor of. |
| Vector4 | result | The component-wise floored vector. |
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
Lerp(Vector4, Vector4, Vector4)
Returns a new vector that is the component-wise linear blend of the 2 given vectors.
Declaration
[Pure]
public static Vector4 Lerp(Vector4 a, Vector4 b, Vector4 blend)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First input vector. |
| Vector4 | b | Second input vector. |
| Vector4 | blend | The blend factor. |
Returns
| Type | Description |
|---|---|
| Vector4 | a when blend=0, b when blend=1, and a component-wise linear combination otherwise. |
Lerp(Vector4, Vector4, float)
Returns a new vector that is the linear blend of the 2 given vectors.
Declaration
[Pure]
public static Vector4 Lerp(Vector4 a, Vector4 b, float blend)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First input vector. |
| Vector4 | b | Second input vector. |
| float | blend | The blend factor. |
Returns
| Type | Description |
|---|---|
| Vector4 | a when blend=0, b when blend=1, and a linear combination otherwise. |
Lerp(in Vector4, in Vector4, Vector4, out Vector4)
Returns a new vector that is the component-wise linear blend of the 2 given vectors.
Declaration
public static void Lerp(in Vector4 a, in Vector4 b, Vector4 blend, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First input vector. |
| Vector4 | b | Second input vector. |
| Vector4 | blend | The blend factor. |
| Vector4 | result | a when blend=0, b when blend=1, and a component-wise linear combination otherwise. |
Lerp(in Vector4, in Vector4, float, out Vector4)
Returns a new vector that is the linear blend of the 2 given vectors.
Declaration
public static void Lerp(in Vector4 a, in Vector4 b, float blend, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First input vector. |
| Vector4 | b | Second input vector. |
| float | blend | The blend factor. |
| Vector4 | result | a when blend=0, b when blend=1, and a linear combination otherwise. |
MagnitudeMax(Vector4, Vector4)
Returns the Vector4 with the maximum magnitude. If the magnitudes are equal, the first vector is selected.
Declaration
[Pure]
public static Vector4 MagnitudeMax(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | Left operand. |
| Vector4 | right | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | The maximum Vector4. |
MagnitudeMax(in Vector4, in Vector4, out Vector4)
Returns the Vector4 with the maximum magnitude. If the magnitudes are equal, the first vector is selected.
Declaration
public static void MagnitudeMax(in Vector4 left, in Vector4 right, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | Left operand. |
| Vector4 | right | Right operand. |
| Vector4 | result | The magnitude-wise maximum. |
MagnitudeMin(Vector4, Vector4)
Returns the Vector4 with the minimum magnitude. If the magnitudes are equal, the second vector is selected.
Declaration
[Pure]
public static Vector4 MagnitudeMin(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | Left operand. |
| Vector4 | right | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | The minimum Vector4. |
MagnitudeMin(in Vector4, in Vector4, out Vector4)
Returns the Vector4 with the minimum magnitude. If the magnitudes are equal, the second vector is selected.
Declaration
public static void MagnitudeMin(in Vector4 left, in Vector4 right, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | Left operand. |
| Vector4 | right | Right operand. |
| Vector4 | result | The magnitude-wise minimum. |
Multiply(Vector4, Vector4)
Multiplies a vector by the components a vector (scale).
Declaration
[Pure]
public static Vector4 Multiply(Vector4 vector, Vector4 scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| Vector4 | scale | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the operation. |
Multiply(Vector4, float)
Multiplies a vector by a scalar.
Declaration
[Pure]
public static Vector4 Multiply(Vector4 vector, float scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| float | scale | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the operation. |
Multiply(in Vector4, in Vector4, out Vector4)
Multiplies a vector by the components of a vector (scale).
Declaration
public static void Multiply(in Vector4 vector, in Vector4 scale, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| Vector4 | scale | Right operand. |
| Vector4 | result | Result of the operation. |
Multiply(in Vector4, float, out Vector4)
Multiplies a vector by a scalar.
Declaration
public static void Multiply(in Vector4 vector, float scale, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vector | Left operand. |
| float | scale | Right operand. |
| Vector4 | result | Result of the operation. |
Normalize()
Scales the Vector4 to unit length.
Declaration
public void Normalize()
Normalize(Vector4)
Scale a vector to unit length.
Declaration
[Pure]
public static Vector4 Normalize(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The input vector. |
Returns
| Type | Description |
|---|---|
| Vector4 | The normalized copy. |
Normalize(in Vector4, out Vector4)
Scale a vector to unit length.
Declaration
public static void Normalize(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The input vector. |
| Vector4 | result | The normalized vector. |
Normalized()
Returns a copy of the Vector4 scaled to unit length.
Declaration
public readonly Vector4 Normalized()
Returns
| Type | Description |
|---|---|
| Vector4 | The normalized copy. |
NormalizeFast()
Scales the Vector4 to approximately unit length.
Declaration
public void NormalizeFast()
NormalizeFast(Vector4)
Scale a vector to approximately unit length.
Declaration
[Pure]
public static Vector4 NormalizeFast(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The input vector. |
Returns
| Type | Description |
|---|---|
| Vector4 | The normalized copy. |
NormalizeFast(in Vector4, out Vector4)
Scale a vector to approximately unit length.
Declaration
public static void NormalizeFast(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The input vector. |
| Vector4 | result | The normalized copy. |
Round()
Returns a new vector were component-wise rounding has been applied. Equivalent to calling Round(float) on each component.
Declaration
public readonly Vector4 Round()
Returns
| Type | Description |
|---|---|
| Vector4 | The rounded vector. |
Round(Vector4, MidpointRounding)
Component-wise rounding with specified midpoint rounding rule. Equivalent to calling Round(float, MidpointRounding) on each component.
Declaration
[Pure]
public static Vector4 Round(Vector4 vec, MidpointRounding rounding)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to round. |
| MidpointRounding | rounding | The midpoint rounding rule to use. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise rounded vector. |
Round(Vector4)
Component-wise rounding. Equivalent to calling Round(float) on each component.
Declaration
[Pure]
public static Vector4 Round(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to round. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise rounded vector. |
Round(in Vector4, out Vector4)
Component-wise rounding. Equivalent to calling Round(float) on each component.
Declaration
public static void Round(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to round. |
| Vector4 | result | The component-wise rounded vector. |
Round(in Vector4, MidpointRounding, out Vector4)
Component-wise rounding with specified midpoint rounding rule. Equivalent to calling Round(float, MidpointRounding) on each component.
Declaration
public static void Round(in Vector4 vec, MidpointRounding rounding, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to round. |
| MidpointRounding | rounding | The midpoint rounding rule to use. |
| Vector4 | result | The component-wise rounded vector. |
Round(MidpointRounding)
Returns a new vector were component-wise rounding has been applied with the specified midpoint rounding rule. Equivalent to calling Round(float, MidpointRounding) on each component.
Declaration
public readonly Vector4 Round(MidpointRounding rounding)
Parameters
| Type | Name | Description |
|---|---|---|
| MidpointRounding | rounding | The midpoint rounding rule to use. |
Returns
| Type | Description |
|---|---|
| Vector4 | The rounded vector. |
Slerp(Vector4, Vector4, float)
Returns a new vector that is the spherical interpolation of the two given vectors.
a and b need to be normalized for this function to work properly.
Results are undefined for vectors that point in opposite directions or very close to opposite directions.
Declaration
[Pure]
public static Vector4 Slerp(Vector4 a, Vector4 b, float t)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | Unit vector start point. |
| Vector4 | b | Unit vector end point. |
| float | t | The blend factor. |
Returns
| Type | Description |
|---|---|
| Vector4 |
|
Slerp(in Vector4, in Vector4, float, out Vector4)
Returns a new vector that is the spherical interpolation of the two given vectors.
a and b need to be normalized for this function to work properly.
Results are undefined for vectors that point in opposite directions or very close to opposite directions.
Declaration
public static void Slerp(in Vector4 a, in Vector4 b, float t, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | Unit vector start point. |
| Vector4 | b | Unit vector end point. |
| float | t | The blend factor. |
| Vector4 | result | Is |
Subtract(Vector4, Vector4)
Subtract one Vector from another.
Declaration
[Pure]
public static Vector4 Subtract(Vector4 a, Vector4 b)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First operand. |
| Vector4 | b | Second operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of subtraction. |
Subtract(in Vector4, in Vector4, out Vector4)
Subtract one Vector from another.
Declaration
public static void Subtract(in Vector4 a, in Vector4 b, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | a | First operand. |
| Vector4 | b | Second operand. |
| Vector4 | result | Result of subtraction. |
ToString()
Declaration
public override readonly string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
ToString(IFormatProvider)
Declaration
public readonly string ToString(IFormatProvider formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IFormatProvider | formatProvider |
Returns
| Type | Description |
|---|---|
| string |
ToString(string, IFormatProvider)
Declaration
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format | |
| IFormatProvider | formatProvider |
Returns
| Type | Description |
|---|---|
| string |
ToString(string)
Declaration
public readonly string ToString(string format)
Parameters
| Type | Name | Description |
|---|---|---|
| string | format |
Returns
| Type | Description |
|---|---|
| string |
Transform(Vector4, Quaternion)
Transforms a vector by a quaternion rotation.
Declaration
[Pure]
public static Vector4 Transform(Vector4 vec, Quaternion quat)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to transform. |
| Quaternion | quat | The quaternion to rotate the vector by. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the operation. |
Transform(in Vector4, in Quaternion, out Vector4)
Transforms a vector by a quaternion rotation.
Declaration
public static void Transform(in Vector4 vec, in Quaternion quat, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to transform. |
| Quaternion | quat | The quaternion to rotate the vector by. |
| Vector4 | result | The result of the operation. |
TransformColumn(Matrix4, Vector4)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
[Pure]
public static Vector4 TransformColumn(Matrix4 mat, Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4 | mat | The desired transformation. |
| Vector4 | vec | The vector to transform. |
Returns
| Type | Description |
|---|---|
| Vector4 | The transformed vector. |
TransformColumn(in Matrix4, in Vector4, out Vector4)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
public static void TransformColumn(in Matrix4 mat, in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4 | mat | The desired transformation. |
| Vector4 | vec | The vector to transform. |
| Vector4 | result | The transformed vector. |
TransformRow(Vector4, Matrix4)
Transform a Vector by the given Matrix.
Declaration
[Pure]
public static Vector4 TransformRow(Vector4 vec, Matrix4 mat)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to transform. |
| Matrix4 | mat | The desired transformation. |
Returns
| Type | Description |
|---|---|
| Vector4 | The transformed vector. |
TransformRow(in Vector4, in Matrix4, out Vector4)
Transform a Vector by the given Matrix.
Declaration
public static void TransformRow(in Vector4 vec, in Matrix4 mat, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to transform. |
| Matrix4 | mat | The desired transformation. |
| Vector4 | result | The transformed vector. |
Truncate()
Returns a new vector were component-wise truncation has been applied. Equivalent to calling Truncate(float) on each component.
Declaration
public readonly Vector4 Truncate()
Returns
| Type | Description |
|---|---|
| Vector4 | The truncated vector. |
Truncate(Vector4)
Component-wise truncation. Equivalent to calling Truncate(float) on each component.
Declaration
[Pure]
public static Vector4 Truncate(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to truncate. |
Returns
| Type | Description |
|---|---|
| Vector4 | The component-wise truncated vector. |
Truncate(in Vector4, out Vector4)
Component-wise truncation. Equivalent to calling Truncate(float) on each component.
Declaration
public static void Truncate(in Vector4 vec, out Vector4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to truncate. |
| Vector4 | result | The component-wise truncated vector. |
Operators
operator +(Vector4, Vector4)
Adds two instances.
Declaration
[Pure]
public static Vector4 operator +(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | The first instance. |
| Vector4 | right | The second instance. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the calculation. |
operator /(Vector4, Vector4)
Component-wise division between the specified instance by a scale vector.
Declaration
[Pure]
public static Vector4 operator /(Vector4 vec, Vector4 scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | Left operand. |
| Vector4 | scale | Right operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of the division. |
operator /(Vector4, float)
Divides an instance by a scalar.
Declaration
[Pure]
public static Vector4 operator /(Vector4 vec, float scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The instance. |
| float | scale | The scalar. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the calculation. |
operator ==(Vector4, Vector4)
Compares two instances for equality.
Declaration
public static bool operator ==(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | The first instance. |
| Vector4 | right | The second instance. |
Returns
| Type | Description |
|---|---|
| bool | True, if left equals right; false otherwise. |
explicit operator Color4(Vector4)
Returns this Vector4 as a Color4. The resulting struct will have RGBA mapped to XYZW, in that order.
Declaration
[Pure]
public static explicit operator Color4(Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | v | The Vector4 to convert. |
Returns
| Type | Description |
|---|---|
| Color4 | The Vector4, converted to a Color4. |
explicit operator Vector4h(Vector4)
Converts OpenTK.Vector4 to OpenTK.Vector4h.
Declaration
[Pure]
public static explicit operator Vector4h(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The Vector4 to convert. |
Returns
| Type | Description |
|---|---|
| Vector4h | The resulting Vector4h. |
explicit operator Vector4i(Vector4)
Converts OpenTK.Vector4 to OpenTK.Vector4i.
Declaration
[Pure]
public static explicit operator Vector4i(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The Vector4 to convert. |
Returns
| Type | Description |
|---|---|
| Vector4i | The resulting Vector4i. |
explicit operator IntPtr(Vector4)
Returns a pointer to the first element of the specified instance.
Declaration
[Pure]
public static explicit operator IntPtr(Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | v | The instance. |
Returns
| Type | Description |
|---|---|
| IntPtr | A pointer to the first element of v. |
explicit operator Vector4(Vector4)
Declaration
[Pure]
public static explicit operator Vector4(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The Vector4 to cast. |
Returns
| Type | Description |
|---|---|
| Vector4 |
explicit operator float*(Vector4)
Returns a pointer to the first element of the specified instance.
Declaration
[Pure]
public static explicit operator float*(Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | v | The instance. |
Returns
| Type | Description |
|---|---|
| float* | A pointer to the first element of v. |
explicit operator Vector4(Vector4)
Declaration
[Pure]
public static explicit operator Vector4(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The Vector4 to cast. |
Returns
| Type | Description |
|---|---|
| Vector4 |
implicit operator Vector4d(Vector4)
Converts OpenTK.Vector4 to OpenTK.Vector4d.
Declaration
[Pure]
public static implicit operator Vector4d(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The Vector4 to convert. |
Returns
| Type | Description |
|---|---|
| Vector4d | The resulting Vector4d. |
implicit operator Vector4((float X, float Y, float Z, float W))
Initializes a new instance of the Vector4 struct using a tuple containing the component values.
Declaration
[Pure]
public static implicit operator Vector4((float X, float Y, float Z, float W) values)
Parameters
| Type | Name | Description |
|---|---|---|
| (float X, float Y, float Z, float W) | values | A tuple containing the component values. |
Returns
| Type | Description |
|---|---|
| Vector4 | A new instance of the Vector4 struct with the given component values. |
operator !=(Vector4, Vector4)
Compares two instances for inequality.
Declaration
public static bool operator !=(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | The first instance. |
| Vector4 | right | The second instance. |
Returns
| Type | Description |
|---|---|
| bool | True, if left does not equa lright; false otherwise. |
operator *(Matrix4, Vector4)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
[Pure]
public static Vector4 operator *(Matrix4 mat, Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Matrix4 | mat | The desired transformation. |
| Vector4 | vec | The vector to transform. |
Returns
| Type | Description |
|---|---|
| Vector4 | The transformed vector. |
operator *(Quaternion, Vector4)
Transforms a vector by a quaternion rotation.
Declaration
[Pure]
public static Vector4 operator *(Quaternion quat, Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Quaternion | quat | The quaternion to rotate the vector by. |
| Vector4 | vec | The vector to transform. |
Returns
| Type | Description |
|---|---|
| Vector4 | The transformed vector. |
operator *(Vector4, Matrix4)
Transform a Vector by the given Matrix.
Declaration
[Pure]
public static Vector4 operator *(Vector4 vec, Matrix4 mat)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The vector to transform. |
| Matrix4 | mat | The desired transformation. |
Returns
| Type | Description |
|---|---|
| Vector4 | The transformed vector. |
operator *(Vector4, Vector4)
Component-wise multiplication between the specified instance by a scale vector.
Declaration
[Pure]
public static Vector4 operator *(Vector4 vec, Vector4 scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | Right operand. |
| Vector4 | scale | Left operand. |
Returns
| Type | Description |
|---|---|
| Vector4 | Result of multiplication. |
operator *(Vector4, float)
Multiplies an instance by a scalar.
Declaration
[Pure]
public static Vector4 operator *(Vector4 vec, float scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The instance. |
| float | scale | The scalar. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the calculation. |
operator *(float, Vector4)
Multiplies an instance by a scalar.
Declaration
[Pure]
public static Vector4 operator *(float scale, Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| float | scale | The scalar. |
| Vector4 | vec | The instance. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the calculation. |
operator -(Vector4, Vector4)
Subtracts two instances.
Declaration
[Pure]
public static Vector4 operator -(Vector4 left, Vector4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | left | The first instance. |
| Vector4 | right | The second instance. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the calculation. |
operator -(Vector4)
Negates an instance.
Declaration
[Pure]
public static Vector4 operator -(Vector4 vec)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | vec | The instance. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the calculation. |