Struct Vector4d
Represents a 4D vector using four double-precision floating-point numbers.
Inherited Members
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Vector4d : IEquatable<Vector4d>, IFormattable
Remarks
The Vector4 structure is suitable for interoperation with unmanaged code requiring four consecutive doubles.
Constructors
Vector4d(Vector2d, double, double)
Initializes a new instance of the Vector4d struct.
Declaration
public Vector4d(Vector2d xy, double z = 0, double w = 0)
Parameters
Type | Name | Description |
---|---|---|
Vector2d | xy | The x and y components of the Vector4d. |
double | z | The z component of the Vector4d. |
double | w | The w component of the Vector4d. |
Vector4d(Vector3d, double)
Initializes a new instance of the Vector4d struct.
Declaration
public Vector4d(Vector3d xyz, double w = 0)
Parameters
Type | Name | Description |
---|---|---|
Vector3d | xyz | The x, y and z components of the Vector4d. |
double | w | The w component of the Vector4d. |
Vector4d(double)
Initializes a new instance of the Vector4d struct.
Declaration
public Vector4d(double value)
Parameters
Type | Name | Description |
---|---|---|
double | value | The value that will initialize this instance. |
Vector4d(double, double, double, double)
Initializes a new instance of the Vector4d struct.
Declaration
public Vector4d(double x, double y, double z, double w)
Parameters
Type | Name | Description |
---|---|---|
double | x | The x component of the Vector4d. |
double | y | The y component of the Vector4d. |
double | z | The z component of the Vector4d. |
double | w | The w component of the Vector4d. |
Fields
NegativeInfinity
Defines an instance with all components set to negative infinity.
Declaration
public static readonly Vector4d NegativeInfinity
Field Value
Type | Description |
---|---|
Vector4d |
One
Defines an instance with all components set to 1.
Declaration
public static readonly Vector4d One
Field Value
Type | Description |
---|---|
Vector4d |
PositiveInfinity
Defines an instance with all components set to positive infinity.
Declaration
public static readonly Vector4d PositiveInfinity
Field Value
Type | Description |
---|---|
Vector4d |
SizeInBytes
Defines the size of the Vector4d struct in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
Type | Description |
---|---|
int |
UnitW
Defines a unit-length Vector4d that points towards the W-axis.
Declaration
public static readonly Vector4d UnitW
Field Value
Type | Description |
---|---|
Vector4d |
UnitX
Defines a unit-length Vector4d that points towards the X-axis.
Declaration
public static readonly Vector4d UnitX
Field Value
Type | Description |
---|---|
Vector4d |
UnitY
Defines a unit-length Vector4d that points towards the Y-axis.
Declaration
public static readonly Vector4d UnitY
Field Value
Type | Description |
---|---|
Vector4d |
UnitZ
Defines a unit-length Vector4d that points towards the Z-axis.
Declaration
public static readonly Vector4d UnitZ
Field Value
Type | Description |
---|---|
Vector4d |
W
The W component of the Vector4d.
Declaration
public double W
Field Value
Type | Description |
---|---|
double |
X
The X component of the Vector4d.
Declaration
public double X
Field Value
Type | Description |
---|---|
double |
Y
The Y component of the Vector4d.
Declaration
public double Y
Field Value
Type | Description |
---|---|
double |
Z
The Z component of the Vector4d.
Declaration
public double Z
Field Value
Type | Description |
---|---|
double |
Zero
Defines an instance with all components set to 0.
Declaration
public static readonly Vector4d Zero
Field Value
Type | Description |
---|---|
Vector4d |
Properties
this[int]
Gets or sets the value at the index of the Vector.
Declaration
public double this[int index] { readonly get; set; }
Parameters
Type | Name | Description |
---|---|---|
int | index | The index of the component from the Vector. |
Property Value
Type | Description |
---|---|
double |
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 double Length { get; }
Property Value
Type | Description |
---|---|
double |
See Also
LengthFast
Gets an approximation of the vector length (magnitude).
Declaration
public readonly double LengthFast { get; }
Property Value
Type | Description |
---|---|
double |
Remarks
This property uses an approximation of the square root function to calculate vector magnitude.
See Also
LengthSquared
Gets the square of the vector length (magnitude).
Declaration
public readonly double LengthSquared { get; }
Property Value
Type | Description |
---|---|
double |
Remarks
This property avoids the costly square root operation required by the Length property. This makes it more suitable for comparisons.
ReciprocalLengthFast
Gets an approximation of 1 over the length (magnitude) of the vector.
Declaration
public readonly double ReciprocalLengthFast { get; }
Property Value
Type | Description |
---|---|
double |
Wx
Gets or sets an OpenTK.Vector2d with the W and X components of this instance.
Declaration
public Vector2d Wx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Wxy
Gets or sets an OpenTK.Vector3d with the W, X, and Y components of this instance.
Declaration
public Vector3d Wxy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Wxyz
Gets or sets an OpenTK.Vector4d with the W, X, Y, and Z components of this instance.
Declaration
public Vector4d Wxyz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Wxz
Gets or sets an OpenTK.Vector3d with the W, X, and Z components of this instance.
Declaration
public Vector3d Wxz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Wxzy
Gets or sets an OpenTK.Vector4d with the W, X, Z, and Y components of this instance.
Declaration
public Vector4d Wxzy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Wy
Gets or sets an OpenTK.Vector2d with the W and Y components of this instance.
Declaration
public Vector2d Wy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Wyx
Gets or sets an OpenTK.Vector3d with the W, Y, and X components of this instance.
Declaration
public Vector3d Wyx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Wyxz
Gets or sets an OpenTK.Vector4d with the W, Y, X, and Z components of this instance.
Declaration
public Vector4d Wyxz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Wyz
Gets or sets an OpenTK.Vector3d with the W, Y, and Z components of this instance.
Declaration
public Vector3d Wyz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Wyzx
Gets or sets an OpenTK.Vector4d with the W, Y, Z, and X components of this instance.
Declaration
public Vector4d Wyzx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Wz
Gets or sets an OpenTK.Vector2d with the W and Z components of this instance.
Declaration
public Vector2d Wz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Wzx
Gets or sets an OpenTK.Vector3d with the W, Z, and X components of this instance.
Declaration
public Vector3d Wzx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Wzxy
Gets or sets an OpenTK.Vector4d with the W, Z, X, and Y components of this instance.
Declaration
public Vector4d Wzxy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Wzy
Gets or sets an OpenTK.Vector3d with the W, Z, and Y components of this instance.
Declaration
public Vector3d Wzy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Wzyw
Gets or sets an OpenTK.Vector4d with the W, Z, Y, and W components of this instance.
Declaration
public Vector4d Wzyw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Wzyx
Gets or sets an OpenTK.Vector4d with the W, Z, Y, and X components of this instance.
Declaration
public Vector4d Wzyx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Xw
Gets or sets an OpenTK.Vector2d with the X and W components of this instance.
Declaration
public Vector2d Xw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Xwy
Gets or sets an OpenTK.Vector3d with the X, W, and Y components of this instance.
Declaration
public Vector3d Xwy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Xwyz
Gets or sets an OpenTK.Vector4d with the X, W, Y, and Z components of this instance.
Declaration
public Vector4d Xwyz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Xwz
Gets or sets an OpenTK.Vector3d with the X, W, and Z components of this instance.
Declaration
public Vector3d Xwz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Xwzy
Gets or sets an OpenTK.Vector4d with the X, W, Z, and Y components of this instance.
Declaration
public Vector4d Xwzy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Xy
Gets or sets an OpenTK.Vector2d with the X and Y components of this instance.
Declaration
public Vector2d Xy { get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Xyw
Gets or sets an OpenTK.Vector3d with the X, Y, and Z components of this instance.
Declaration
public Vector3d Xyw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Xywz
Gets or sets an OpenTK.Vector4d with the X, Y, W, and Z components of this instance.
Declaration
public Vector4d Xywz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Xyz
Gets or sets an OpenTK.Vector3d with the X, Y, and Z components of this instance.
Declaration
public Vector3d Xyz { get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Xz
Gets or sets an OpenTK.Vector2d with the X and Z components of this instance.
Declaration
public Vector2d Xz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Xzw
Gets or sets an OpenTK.Vector3d with the X, Z, and W components of this instance.
Declaration
public Vector3d Xzw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Xzwy
Gets or sets an OpenTK.Vector4d with the X, Z, W, and Y components of this instance.
Declaration
public Vector4d Xzwy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Xzy
Gets or sets an OpenTK.Vector3d with the X, Z, and Y components of this instance.
Declaration
public Vector3d Xzy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Xzyw
Gets or sets an OpenTK.Vector4d with the X, Z, Y, and W components of this instance.
Declaration
public Vector4d Xzyw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yw
Gets or sets an OpenTK.Vector2d with the Y and W components of this instance.
Declaration
public Vector2d Yw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Ywx
Gets or sets an OpenTK.Vector3d with the Y, W, and X components of this instance.
Declaration
public Vector3d Ywx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Ywxz
Gets or sets an OpenTK.Vector4d with the Y, W, X, and Z components of this instance.
Declaration
public Vector4d Ywxz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Ywz
Gets or sets an OpenTK.Vector3d with the Y, W, and Z components of this instance.
Declaration
public Vector3d Ywz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Ywzx
Gets or sets an OpenTK.Vector4d with the Y, W, Z, and X components of this instance.
Declaration
public Vector4d Ywzx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yx
Gets or sets an OpenTK.Vector2d with the Y and X components of this instance.
Declaration
public Vector2d Yx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Yxw
Gets or sets an OpenTK.Vector3d with the Y, X, and W components of this instance.
Declaration
public Vector3d Yxw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Yxwz
Gets or sets an OpenTK.Vector4d with the Y, X, W, and Z components of this instance.
Declaration
public Vector4d Yxwz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yxz
Gets or sets an OpenTK.Vector3d with the Y, X, and Z components of this instance.
Declaration
public Vector3d Yxz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Yxzw
Gets or sets an OpenTK.Vector4d with the Y, X, Z, and W components of this instance.
Declaration
public Vector4d Yxzw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yywz
Gets or sets an OpenTK.Vector4d with the Y, Y, W, and Z components of this instance.
Declaration
public Vector4d Yywz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yyzw
Gets or sets an OpenTK.Vector4d with the Y, Y, Z, and W components of this instance.
Declaration
public Vector4d Yyzw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yz
Gets or sets an OpenTK.Vector2d with the Y and Z components of this instance.
Declaration
public Vector2d Yz { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Yzw
Gets or sets an OpenTK.Vector3d with the Y, Z, and W components of this instance.
Declaration
public Vector3d Yzw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Yzwx
Gets or sets an OpenTK.Vector4d with the Y, Z, W, and X components of this instance.
Declaration
public Vector4d Yzwx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Yzx
Gets or sets an OpenTK.Vector3d with the Y, Z, and X components of this instance.
Declaration
public Vector3d Yzx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Yzxw
Gets or sets an OpenTK.Vector4d with the Y, Z, X, and W components of this instance.
Declaration
public Vector4d Yzxw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zw
Gets or sets an OpenTK.Vector2d with the Z and W components of this instance.
Declaration
public Vector2d Zw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Zwx
Gets or sets an OpenTK.Vector3d with the Z, W, and X components of this instance.
Declaration
public Vector3d Zwx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Zwxy
Gets or sets an OpenTK.Vector4d with the Z, W, X, and Y components of this instance.
Declaration
public Vector4d Zwxy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zwy
Gets or sets an OpenTK.Vector3d with the Z, W, and Y components of this instance.
Declaration
public Vector3d Zwy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Zwyx
Gets or sets an OpenTK.Vector4d with the Z, W, Y, and X components of this instance.
Declaration
public Vector4d Zwyx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zwzy
Gets or sets an OpenTK.Vector4d with the Z, W, Z, and Y components of this instance.
Declaration
public Vector4d Zwzy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zx
Gets or sets an OpenTK.Vector2d with the Z and X components of this instance.
Declaration
public Vector2d Zx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Zxw
Gets or sets an OpenTK.Vector3d with the Z, X, and W components of this instance.
Declaration
public Vector3d Zxw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Zxwy
Gets or sets an OpenTK.Vector4d with the Z, X, W, and Y components of this instance.
Declaration
public Vector4d Zxwy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zxy
Gets or sets an OpenTK.Vector3d with the Z, X, and Y components of this instance.
Declaration
public Vector3d Zxy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Zxyw
Gets or sets an OpenTK.Vector4d with the Z, X, Y, and Z components of this instance.
Declaration
public Vector4d Zxyw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zy
Gets or sets an OpenTK.Vector2d with the Z and Y components of this instance.
Declaration
public Vector2d Zy { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector2d |
Zyw
Gets or sets an OpenTK.Vector3d with the Z, Y, and W components of this instance.
Declaration
public Vector3d Zyw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Zywx
Gets or sets an OpenTK.Vector4d with the Z, Y, W, and X components of this instance.
Declaration
public Vector4d Zywx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Zyx
Gets or sets an OpenTK.Vector3d with the Z, Y, and X components of this instance.
Declaration
public Vector3d Zyx { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector3d |
Zyxw
Gets or sets an OpenTK.Vector4d with the Z, Y, X, and W components of this instance.
Declaration
public Vector4d Zyxw { readonly get; set; }
Property Value
Type | Description |
---|---|
Vector4d |
Methods
Abs()
Returns a new vector that is the component-wise absolute value of the vector.
Declaration
public readonly Vector4d Abs()
Returns
Type | Description |
---|---|
Vector4d | The component-wise absolute value vector. |
Abs(Vector4d)
Take the component-wise absolute value of a vector.
Declaration
public static Vector4d Abs(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to apply component-wise absolute value to. |
Returns
Type | Description |
---|---|
Vector4d | The component-wise absolute value vector. |
Abs(in Vector4d, out Vector4d)
Take the component-wise absolute value of a vector.
Declaration
public static void Abs(in Vector4d vec, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to apply component-wise absolute value to. |
Vector4d | result | The component-wise absolute value vector. |
Add(Vector4d, Vector4d)
Adds two vectors.
Declaration
[Pure]
public static Vector4d Add(Vector4d a, Vector4d b)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | Left operand. |
Vector4d | b | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of operation. |
Add(in Vector4d, in Vector4d, out Vector4d)
Adds two vectors.
Declaration
public static void Add(in Vector4d a, in Vector4d b, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | Left operand. |
Vector4d | b | Right operand. |
Vector4d | result | Result of operation. |
BaryCentric(Vector4d, Vector4d, Vector4d, double, double)
Interpolate 3 Vectors using Barycentric coordinates.
Declaration
[Pure]
public static Vector4d BaryCentric(Vector4d a, Vector4d b, Vector4d c, double u, double v)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First input Vector. |
Vector4d | b | Second input Vector. |
Vector4d | c | Third input Vector. |
double | u | First Barycentric Coordinate. |
double | v | Second Barycentric Coordinate. |
Returns
Type | Description |
---|---|
Vector4d | 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 Vector4d, in Vector4d, in Vector4d, double, double, out Vector4d)
Interpolate 3 Vectors using Barycentric coordinates.
Declaration
public static void BaryCentric(in Vector4d a, in Vector4d b, in Vector4d c, double u, double v, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First input Vector. |
Vector4d | b | Second input Vector. |
Vector4d | c | Third input Vector. |
double | u | First Barycentric Coordinate. |
double | v | Second Barycentric Coordinate. |
Vector4d | 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. |
Clamp(Vector4d, Vector4d, Vector4d)
Clamp a vector to the given minimum and maximum vectors.
Declaration
[Pure]
public static Vector4d Clamp(Vector4d vec, Vector4d min, Vector4d max)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | Input vector. |
Vector4d | min | Minimum vector. |
Vector4d | max | Maximum vector. |
Returns
Type | Description |
---|---|
Vector4d | The clamped vector. |
Clamp(in Vector4d, in Vector4d, in Vector4d, out Vector4d)
Clamp a vector to the given minimum and maximum vectors.
Declaration
public static void Clamp(in Vector4d vec, in Vector4d min, in Vector4d max, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | Input vector. |
Vector4d | min | Minimum vector. |
Vector4d | max | Maximum vector. |
Vector4d | result | The clamped vector. |
ComponentMax(Vector4d, Vector4d)
Returns a vector created from the largest of the corresponding components of the given vectors.
Declaration
[Pure]
public static Vector4d ComponentMax(Vector4d a, Vector4d b)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First operand. |
Vector4d | b | Second operand. |
Returns
Type | Description |
---|---|
Vector4d | The component-wise maximum. |
ComponentMax(in Vector4d, in Vector4d, out Vector4d)
Returns a vector created from the largest of the corresponding components of the given vectors.
Declaration
public static void ComponentMax(in Vector4d a, in Vector4d b, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First operand. |
Vector4d | b | Second operand. |
Vector4d | result | The component-wise maximum. |
ComponentMin(Vector4d, Vector4d)
Returns a vector created from the smallest of the corresponding components of the given vectors.
Declaration
[Pure]
public static Vector4d ComponentMin(Vector4d a, Vector4d b)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First operand. |
Vector4d | b | Second operand. |
Returns
Type | Description |
---|---|
Vector4d | The component-wise minimum. |
ComponentMin(in Vector4d, in Vector4d, out Vector4d)
Returns a vector created from the smallest of the corresponding components of the given vectors.
Declaration
public static void ComponentMin(in Vector4d a, in Vector4d b, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First operand. |
Vector4d | b | Second operand. |
Vector4d | result | The component-wise minimum. |
Deconstruct(out double, out double, out double, out double)
Deconstructs the vector into it's individual components.
Declaration
[Pure]
public readonly void Deconstruct(out double x, out double y, out double z, out double w)
Parameters
Type | Name | Description |
---|---|---|
double | x | The X component of the vector. |
double | y | The Y component of the vector. |
double | z | The Z component of the vector. |
double | w | The W component of the vector. |
Divide(Vector4d, Vector4d)
Divides a vector by the components of a vector (scale).
Declaration
[Pure]
public static Vector4d Divide(Vector4d vector, Vector4d scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
Vector4d | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of the operation. |
Divide(Vector4d, double)
Divides a vector by a scalar.
Declaration
[Pure]
public static Vector4d Divide(Vector4d vector, double scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
double | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of the operation. |
Divide(in Vector4d, in Vector4d, out Vector4d)
Divide a vector by the components of a vector (scale).
Declaration
public static void Divide(in Vector4d vector, in Vector4d scale, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
Vector4d | scale | Right operand. |
Vector4d | result | Result of the operation. |
Divide(in Vector4d, double, out Vector4d)
Divides a vector by a scalar.
Declaration
public static void Divide(in Vector4d vector, double scale, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
double | scale | Right operand. |
Vector4d | result | Result of the operation. |
Dot(Vector4d, Vector4d)
Calculate the dot product of two vectors.
Declaration
[Pure]
public static double Dot(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | First operand. |
Vector4d | right | Second operand. |
Returns
Type | Description |
---|---|
double | The dot product of the two inputs. |
Dot(in Vector4d, in Vector4d, out double)
Calculate the dot product of two vectors.
Declaration
public static void Dot(in Vector4d left, in Vector4d right, out double result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | First operand. |
Vector4d | right | Second operand. |
double | result | The dot product of the two inputs. |
Elerp(Vector4d, Vector4d, float)
Returns a new vector that is the exponential interpolation of the two vectors.
Equivalent to a * pow(b/a, t)
.
Declaration
public static Vector4d Elerp(Vector4d a, Vector4d b, float t)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | The starting value. Must be non-negative. |
Vector4d | b | The end value. Must be non-negative. |
float | t | The blend factor. |
Returns
Type | Description |
---|---|
Vector4d | The exponential interpolation between |
See Also
Elerp(in Vector4d, in Vector4d, float, out Vector4d)
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 Vector4d a, in Vector4d b, float t, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | The starting value. Must be non-negative. |
Vector4d | b | The end value. Must be non-negative. |
float | t | The blend factor. |
Vector4d | result | The exponential interpolation between |
See Also
Equals(Vector4d)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(Vector4d other)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
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 readonly int GetHashCode()
Returns
Type | Description |
---|---|
int | A 32-bit signed integer that is the hash code for this instance. |
Overrides
Lerp(Vector4d, Vector4d, Vector4d)
Returns a new vector that is the component-wise linear blend of the 2 given vectors.
Declaration
[Pure]
public static Vector4d Lerp(Vector4d a, Vector4d b, Vector4d blend)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First input vector. |
Vector4d | b | Second input vector. |
Vector4d | blend | The blend factor. |
Returns
Type | Description |
---|---|
Vector4d | a when blend=0, b when blend=1, and a component-wise linear combination otherwise. |
Lerp(Vector4d, Vector4d, double)
Returns a new vector that is the linear blend of the 2 given vectors.
Declaration
[Pure]
public static Vector4d Lerp(Vector4d a, Vector4d b, double blend)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First input vector. |
Vector4d | b | Second input vector. |
double | blend | The blend factor. |
Returns
Type | Description |
---|---|
Vector4d | a when blend=0, b when blend=1, and a linear combination otherwise. |
Lerp(in Vector4d, in Vector4d, Vector4d, out Vector4d)
Returns a new vector that is the component-wise linear blend of the 2 given vectors.
Declaration
public static void Lerp(in Vector4d a, in Vector4d b, Vector4d blend, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First input vector. |
Vector4d | b | Second input vector. |
Vector4d | blend | The blend factor. |
Vector4d | result | a when blend=0, b when blend=1, and a component-wise linear combination otherwise. |
Lerp(in Vector4d, in Vector4d, double, out Vector4d)
Returns a new vector that is the linear blend of the 2 given vectors.
Declaration
public static void Lerp(in Vector4d a, in Vector4d b, double blend, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First input vector. |
Vector4d | b | Second input vector. |
double | blend | The blend factor. |
Vector4d | result | a when blend=0, b when blend=1, and a linear combination otherwise. |
MagnitudeMax(Vector4d, Vector4d)
Returns the Vector4d with the minimum magnitude.
Declaration
[Pure]
public static Vector4d MagnitudeMax(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | Left operand. |
Vector4d | right | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | The minimum Vector4d. |
MagnitudeMax(in Vector4d, in Vector4d, out Vector4d)
Returns the Vector4d with the maximum magnitude.
Declaration
public static void MagnitudeMax(in Vector4d left, in Vector4d right, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | Left operand. |
Vector4d | right | Right operand. |
Vector4d | result | The magnitude-wise maximum. |
MagnitudeMin(Vector4d, Vector4d)
Returns the Vector4d with the minimum magnitude.
Declaration
[Pure]
public static Vector4d MagnitudeMin(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | Left operand. |
Vector4d | right | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | The minimum Vector4d. |
MagnitudeMin(in Vector4d, in Vector4d, out Vector4d)
Returns the Vector4d with the minimum magnitude.
Declaration
public static void MagnitudeMin(in Vector4d left, in Vector4d right, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | Left operand. |
Vector4d | right | Right operand. |
Vector4d | result | The magnitude-wise minimum. |
Multiply(Vector4d, Vector4d)
Multiplies a vector by the components a vector (scale).
Declaration
[Pure]
public static Vector4d Multiply(Vector4d vector, Vector4d scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
Vector4d | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of the operation. |
Multiply(Vector4d, double)
Multiplies a vector by a scalar.
Declaration
[Pure]
public static Vector4d Multiply(Vector4d vector, double scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
double | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of the operation. |
Multiply(in Vector4d, in Vector4d, out Vector4d)
Multiplies a vector by the components of a vector (scale).
Declaration
public static void Multiply(in Vector4d vector, in Vector4d scale, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
Vector4d | scale | Right operand. |
Vector4d | result | Result of the operation. |
Multiply(in Vector4d, double, out Vector4d)
Multiplies a vector by a scalar.
Declaration
public static void Multiply(in Vector4d vector, double scale, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vector | Left operand. |
double | scale | Right operand. |
Vector4d | result | Result of the operation. |
Normalize()
Scales the Vector4d to unit length.
Declaration
public void Normalize()
Normalize(Vector4d)
Scale a vector to unit length.
Declaration
[Pure]
public static Vector4d Normalize(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The input vector. |
Returns
Type | Description |
---|---|
Vector4d | The normalized copy. |
Normalize(in Vector4d, out Vector4d)
Scale a vector to unit length.
Declaration
public static void Normalize(in Vector4d vec, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The input vector. |
Vector4d | result | The normalized vector. |
NormalizeFast()
Scales the Vector4d to approximately unit length.
Declaration
public void NormalizeFast()
NormalizeFast(Vector4d)
Scale a vector to approximately unit length.
Declaration
[Pure]
public static Vector4d NormalizeFast(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The input vector. |
Returns
Type | Description |
---|---|
Vector4d | The normalized copy. |
NormalizeFast(in Vector4d, out Vector4d)
Scale a vector to approximately unit length.
Declaration
public static void NormalizeFast(in Vector4d vec, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The input vector. |
Vector4d | result | The normalized vector. |
Normalized()
Returns a copy of the Vector4d scaled to unit length.
Declaration
public readonly Vector4d Normalized()
Returns
Type | Description |
---|---|
Vector4d | The normalized copy. |
Slerp(Vector4d, Vector4d, double)
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.
Declaration
[Pure]
public static Vector4d Slerp(Vector4d a, Vector4d b, double t)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | Unit vector start point. |
Vector4d | b | Unit vector end point. |
double | t | The blend factor. |
Returns
Type | Description |
---|---|
Vector4d |
|
Slerp(in Vector4d, in Vector4d, double, out Vector4d)
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.
Declaration
public static void Slerp(in Vector4d a, in Vector4d b, double t, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | Unit vector start point. |
Vector4d | b | Unit vector end point. |
double | t | The blend factor. |
Vector4d | result | Is |
Subtract(Vector4d, Vector4d)
Subtract one Vector from another.
Declaration
[Pure]
public static Vector4d Subtract(Vector4d a, Vector4d b)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First operand. |
Vector4d | b | Second operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of subtraction. |
Subtract(in Vector4d, in Vector4d, out Vector4d)
Subtract one Vector from another.
Declaration
public static void Subtract(in Vector4d a, in Vector4d b, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | a | First operand. |
Vector4d | b | Second operand. |
Vector4d | result | Result of subtraction. |
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
ToString(IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
ToString(string)
Formats the value of the current instance using the specified format.
Declaration
public string ToString(string format)
Parameters
Type | Name | Description |
---|---|---|
string | format | The format to use. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
ToString(string, IFormatProvider)
Formats the value of the current instance using the specified format.
Declaration
public readonly string ToString(string format, IFormatProvider formatProvider)
Parameters
Type | Name | Description |
---|---|---|
string | format | The format to use. -or- A null reference ( |
IFormatProvider | formatProvider | The provider to use to format the value. -or- A null reference ( |
Returns
Type | Description |
---|---|
string | The value of the current instance in the specified format. |
Transform(Vector4d, Quaterniond)
Transforms a vector by a quaternion rotation.
Declaration
[Pure]
public static Vector4d Transform(Vector4d vec, Quaterniond quat)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to transform. |
Quaterniond | quat | The quaternion to rotate the vector by. |
Returns
Type | Description |
---|---|
Vector4d | The result of the operation. |
Transform(in Vector4d, in Quaterniond, out Vector4d)
Transforms a vector by a quaternion rotation.
Declaration
public static void Transform(in Vector4d vec, in Quaterniond quat, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to transform. |
Quaterniond | quat | The quaternion to rotate the vector by. |
Vector4d | result | The result of the operation. |
TransformColumn(Matrix4d, Vector4d)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
[Pure]
public static Vector4d TransformColumn(Matrix4d mat, Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The desired transformation. |
Vector4d | vec | The vector to transform. |
Returns
Type | Description |
---|---|
Vector4d | The transformed vector. |
TransformColumn(in Matrix4d, in Vector4d, out Vector4d)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
public static void TransformColumn(in Matrix4d mat, in Vector4d vec, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The desired transformation. |
Vector4d | vec | The vector to transform. |
Vector4d | result | The transformed vector. |
TransformRow(Vector4d, Matrix4d)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
[Pure]
public static Vector4d TransformRow(Vector4d vec, Matrix4d mat)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to transform. |
Matrix4d | mat | The desired transformation. |
Returns
Type | Description |
---|---|
Vector4d | The transformed vector. |
TransformRow(in Vector4d, in Matrix4d, out Vector4d)
Transform a Vector by the given Matrix.
Declaration
public static void TransformRow(in Vector4d vec, in Matrix4d mat, out Vector4d result)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to transform. |
Matrix4d | mat | The desired transformation. |
Vector4d | result | The transformed vector. |
Operators
operator +(Vector4d, Vector4d)
Adds two instances.
Declaration
[Pure]
public static Vector4d operator +(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | The first instance. |
Vector4d | right | The second instance. |
Returns
Type | Description |
---|---|
Vector4d | The result of the calculation. |
operator /(Vector4d, Vector4d)
Component-wise division between the specified instance by a scale vector.
Declaration
[Pure]
public static Vector4d operator /(Vector4d vec, Vector4d scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | Left operand. |
Vector4d | scale | Right operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of the division. |
operator /(Vector4d, double)
Divides an instance by a scalar.
Declaration
[Pure]
public static Vector4d operator /(Vector4d vec, double scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The instance. |
double | scale | The scalar. |
Returns
Type | Description |
---|---|
Vector4d | The result of the calculation. |
operator ==(Vector4d, Vector4d)
Compares two instances for equality.
Declaration
public static bool operator ==(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | The first instance. |
Vector4d | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left equals right; false otherwise. |
explicit operator Vector4(Vector4d)
Converts OpenTK.Vector4d to OpenTK.Vector4.
Declaration
[Pure]
public static explicit operator Vector4(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The Vector4d to convert. |
Returns
Type | Description |
---|---|
Vector4 | The resulting Vector4. |
explicit operator Vector4h(Vector4d)
Converts OpenTK.Vector4d to OpenTK.Vector4h.
Declaration
[Pure]
public static explicit operator Vector4h(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The Vector4d to convert. |
Returns
Type | Description |
---|---|
Vector4h | The resulting Vector4h. |
explicit operator Vector4i(Vector4d)
Converts OpenTK.Vector4d to OpenTK.Vector4i.
Declaration
[Pure]
public static explicit operator Vector4i(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The Vector4d to convert. |
Returns
Type | Description |
---|---|
Vector4i | The resulting Vector4i. |
implicit operator Vector4d((double X, double Y, double Z, double W))
Initializes a new instance of the Vector4d struct using a tuple containing the component values.
Declaration
[Pure]
public static implicit operator Vector4d((double X, double Y, double Z, double W) values)
Parameters
Type | Name | Description |
---|---|---|
(double X, double Y, double Z, double W) | values | A tuple containing the component values. |
Returns
Type | Description |
---|---|
Vector4d | A new instance of the Vector4d struct with the given component values. |
operator !=(Vector4d, Vector4d)
Compares two instances for inequality.
Declaration
public static bool operator !=(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | The first instance. |
Vector4d | right | The second instance. |
Returns
Type | Description |
---|---|
bool | True, if left does not equa lright; false otherwise. |
operator *(Matrix4d, Vector4d)
Transform a Vector by the given Matrix using right-handed notation.
Declaration
[Pure]
public static Vector4d operator *(Matrix4d mat, Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Matrix4d | mat | The desired transformation. |
Vector4d | vec | The vector to transform. |
Returns
Type | Description |
---|---|
Vector4d | The transformed vector. |
operator *(Quaterniond, Vector4d)
Transforms a vector by a quaternion rotation.
Declaration
[Pure]
public static Vector4d operator *(Quaterniond quat, Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Quaterniond | quat | The quaternion to rotate the vector by. |
Vector4d | vec | The vector to transform. |
Returns
Type | Description |
---|---|
Vector4d | The transformed vector. |
operator *(Vector4d, Matrix4d)
Transform a Vector by the given Matrix.
Declaration
[Pure]
public static Vector4d operator *(Vector4d vec, Matrix4d mat)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The vector to transform. |
Matrix4d | mat | The desired transformation. |
Returns
Type | Description |
---|---|
Vector4d | The transformed vector. |
operator *(Vector4d, Vector4d)
Component-wise multiplication between the specified instance by a scale vector.
Declaration
[Pure]
public static Vector4d operator *(Vector4d vec, Vector4d scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | Right operand. |
Vector4d | scale | Left operand. |
Returns
Type | Description |
---|---|
Vector4d | Result of multiplication. |
operator *(Vector4d, double)
Multiplies an instance by a scalar.
Declaration
[Pure]
public static Vector4d operator *(Vector4d vec, double scale)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The instance. |
double | scale | The scalar. |
Returns
Type | Description |
---|---|
Vector4d | The result of the calculation. |
operator *(double, Vector4d)
Multiplies an instance by a scalar.
Declaration
[Pure]
public static Vector4d operator *(double scale, Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
double | scale | The scalar. |
Vector4d | vec | The instance. |
Returns
Type | Description |
---|---|
Vector4d | The result of the calculation. |
operator -(Vector4d, Vector4d)
Subtracts two instances.
Declaration
[Pure]
public static Vector4d operator -(Vector4d left, Vector4d right)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | left | The first instance. |
Vector4d | right | The second instance. |
Returns
Type | Description |
---|---|
Vector4d | The result of the calculation. |
operator -(Vector4d)
Negates an instance.
Declaration
[Pure]
public static Vector4d operator -(Vector4d vec)
Parameters
Type | Name | Description |
---|---|---|
Vector4d | vec | The instance. |
Returns
Type | Description |
---|---|
Vector4d | The result of the calculation. |