Double4 Struct
Namespace: Stride.Core.MathematicsAssembly: Stride.Core.Mathematics.dll
Represents a four dimensional mathematical vector with double-precision floats.
[DataContract("double4")]
[DataStyle(DataStyle.Compact)]
public struct Double4 : IEquatable<Double4>, IFormattable
| Name | Description | |
|---|---|---|
| Constructors | ||
| Double4(Double2, Double, Double) | Initializes a new instance of the Double4 struct. |
|
| Double4(Double3, Double) | Initializes a new instance of the Double4 struct. |
|
| Double4(Vector4) | Initializes a new instance of the Double4 struct. |
|
| Double4(Double) | Initializes a new instance of the Double4 struct. |
|
| Double4(Double, Double, Double, Double) | Initializes a new instance of the Double4 struct. |
|
| Double4(Double[]) | Initializes a new instance of the Double4 struct. |
|
| Fields | ||
| One | A Double4 with all of its components set to one. |
|
| SizeInBytes | The size of the Double4 type, in bytes. |
|
| UnitW | The W unit Double4 (0, 0, 0, 1). |
|
| UnitX | The X unit Double4 (1, 0, 0, 0). |
|
| UnitY | The Y unit Double4 (0, 1, 0, 0). |
|
| UnitZ | The Z unit Double4 (0, 0, 1, 0). |
|
| W | The W component of the vector. |
|
| X | The X component of the vector. |
|
| Y | The Y component of the vector. |
|
| Z | The Z component of the vector. |
|
| Zero | A Double4 with all of its components set to zero. |
|
| Properties | ||
| IsNormalized | Gets a value indicting whether this instance is normalized. |
|
| Item[Int32] | Gets or sets the component at the specified index. |
|
| Methods | ||
| Add(Double4, Double4) | Adds two vectors. |
|
| Add(ref Double4, ref Double4, out Double4) | Adds two vectors. |
|
| Barycentric(Double4, Double4, Double4, Double, Double) | Returns a Double4 containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle. |
|
| Barycentric(ref Double4, ref Double4, ref Double4, Double, Double, out Double4) | Returns a Double4 containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle. |
|
| CatmullRom(Double4, Double4, Double4, Double4, Double) | Performs a Catmull-Rom interpolation using the specified positions. |
|
| CatmullRom(ref Double4, ref Double4, ref Double4, ref Double4, Double, out Double4) | Performs a Catmull-Rom interpolation using the specified positions. |
|
| Clamp(Double4, Double4, Double4) | Restricts a value to be within a specified range. |
|
| Clamp(ref Double4, ref Double4, ref Double4, out Double4) | Restricts a value to be within a specified range. |
|
| Demodulate(Double4, Double4) | Demodulates a vector with another by performing component-wise division. |
|
| Demodulate(ref Double4, ref Double4, out Double4) | Demodulates a vector with another by performing component-wise division. |
|
| Distance(Double4, Double4) | Calculates the distance between two vectors. |
|
| Distance(ref Double4, ref Double4, out Double) | Calculates the distance between two vectors. |
|
| DistanceSquared(Double4, Double4) | Calculates the squared distance between two vectors. |
|
| DistanceSquared(ref Double4, ref Double4, out Double) | Calculates the squared distance between two vectors. |
|
| Divide(Double4, Double) | Scales a vector by the given value. |
|
| Divide(ref Double4, Double, out Double4) | Scales a vector by the given value. |
|
| Dot(Double4, Double4) | Calculates the dot product of two vectors. |
|
| Dot(ref Double4, ref Double4, out Double) | Calculates the dot product of two vectors. |
|
| Equals(Double4) | Determines whether the specified Double4 is equal to this instance. |
|
| Equals(Object) | Determines whether the specified System.Object is equal to this instance. |
|
| GetHashCode() | Returns a hash code for this instance. |
|
| Hermite(Double4, Double4, Double4, Double4, Double) | Performs a Hermite spline interpolation. |
|
| Hermite(ref Double4, ref Double4, ref Double4, ref Double4, Double, out Double4) | Performs a Hermite spline interpolation. |
|
| Length() | Calculates the length of the vector. |
|
| LengthSquared() | Calculates the squared length of the vector. |
|
| Lerp(Double4, Double4, Double) | Performs a linear interpolation between two vectors. |
|
| Lerp(ref Double4, ref Double4, Double, out Double4) | Performs a linear interpolation between two vectors. |
|
| Max(Double4, Double4) | Returns a vector containing the largest components of the specified vectors. |
|
| Max(ref Double4, ref Double4, out Double4) | Returns a vector containing the smallest components of the specified vectors. |
|
| Min(Double4, Double4) | Returns a vector containing the smallest components of the specified vectors. |
|
| Min(ref Double4, ref Double4, out Double4) | Returns a vector containing the smallest components of the specified vectors. |
|
| Modulate(Double4, Double4) | Modulates a vector with another by performing component-wise multiplication. |
|
| Modulate(ref Double4, ref Double4, out Double4) | Modulates a vector with another by performing component-wise multiplication. |
|
| Multiply(Double4, Double) | Scales a vector by the given value. |
|
| Multiply(ref Double4, Double, out Double4) | Scales a vector by the given value. |
|
| Negate(Double4) | Reverses the direction of a given vector. |
|
| Negate(ref Double4, out Double4) | Reverses the direction of a given vector. |
|
| Normalize() | Converts the vector into a unit vector. |
|
| Normalize(Double4) | Converts the vector into a unit vector. |
|
| Normalize(ref Double4, out Double4) | Converts the vector into a unit vector. |
|
| Orthogonalize(Double4[], Double4[]) | Orthogonalizes a list of vectors. |
|
| Orthonormalize(Double4[], Double4[]) | Orthonormalizes a list of vectors. |
|
| Pow(Double) | Raises the exponent for each components. |
|
| SmoothStep(Double4, Double4, Double) | Performs a cubic interpolation between two vectors. |
|
| SmoothStep(ref Double4, ref Double4, Double, out Double4) | Performs a cubic interpolation between two vectors. |
|
| Subtract(Double4, Double4) | Subtracts two vectors. |
|
| Subtract(ref Double4, ref Double4, out Double4) | Subtracts two vectors. |
|
| ToArray() | Creates an array containing the elements of the vector. |
|
| ToString() | Returns a System.String that represents this instance. |
|
| ToString(IFormatProvider) | Returns a System.String that represents this instance. |
|
| ToString(String) | Returns a System.String that represents this instance. |
|
| ToString(String, IFormatProvider) | Returns a System.String that represents this instance. |
|
| Transform(Double4, Matrix) | Transforms a 4D vector by the given Matrix. |
|
| Transform(Double4, Quaternion) | Transforms a 4D vector by the given Quaternion rotation. |
|
| Transform(ref Double4, ref Matrix, out Double4) | Transforms a 4D vector by the given Matrix. |
|
| Transform(ref Double4, ref Quaternion, out Double4) | Transforms a 4D vector by the given Quaternion rotation. |
|
| Transform(Double4[], ref Matrix, Double4[]) | Transforms an array of 4D vectors by the given Matrix. |
|
| Transform(Double4[], ref Quaternion, Double4[]) | Transforms an array of vectors by the given Quaternion rotation. |
|
| Operators | ||
| Addition(Double4, Double4) | Adds two vectors. |
|
| Division(Double4, Double4) | Divides a vector by the given vector, component-wise. |
|
| Division(Double4, Double) | Scales a vector by the given value. |
|
| Division(Double, Double4) | Divides a numerator by a vector. |
|
| Equality(Double4, Double4) | Tests for equality between two objects. |
|
| Explicit(Double4 to Double2) | ||
| Explicit(Double4 to Double3) | ||
| Explicit(Double4 to Half4) | ||
| Explicit(Double4 to Vector4) | ||
| Explicit(Half4 to Double4) | ||
| Implicit(Vector4 to Double4) | ||
| Inequality(Double4, Double4) | Tests for inequality between two objects. |
|
| Multiply(Double4, Double4) | Modulates a vector with another by performing component-wise multiplication. |
|
| Multiply(Double4, Double) | Scales a vector by the given value. |
|
| Multiply(Double, Double4) | Scales a vector by the given value. |
|
| Subtraction(Double4, Double4) | Subtracts two vectors. |
|
| UnaryNegation(Double4) | Reverses the direction of a given vector. |
|
| UnaryPlus(Double4) | Assert a vector (return it unchanged). |
|
Constructors
Double4(Double2, Double, Double)
Initializes a new instance of the Double4 struct.
public Double4(Double2 value, double z, double w)
Parameters
| Type | Name | Description |
|---|---|---|
| Double2 | value | A vector containing the values with which to initialize the X and Y components. |
| System.Double | z | Initial value for the Z component of the vector. |
| System.Double | w | Initial value for the W component of the vector. |
Double4(Double3, Double)
Initializes a new instance of the Double4 struct.
public Double4(Double3 value, double w)
Parameters
| Type | Name | Description |
|---|---|---|
| Double3 | value | A vector containing the values with which to initialize the X, Y, and Z components. |
| System.Double | w | Initial value for the W component of the vector. |
Double4(Vector4)
Initializes a new instance of the Double4 struct.
public Double4(Vector4 v)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | v | The Vector4 to construct the Double4 from. |
Double4(Double)
Initializes a new instance of the Double4 struct.
public Double4(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | The value that will be assigned to all components. |
Double4(Double, Double, Double, Double)
Initializes a new instance of the Double4 struct.
public Double4(double x, double y, double z, double w)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | x | Initial value for the X component of the vector. |
| System.Double | y | Initial value for the Y component of the vector. |
| System.Double | z | Initial value for the Z component of the vector. |
| System.Double | w | Initial value for the W component of the vector. |
Double4(Double[])
Initializes a new instance of the Double4 struct.
public Double4(double[] values)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double[] | values | The values to assign to the X, Y, Z, and W components of the vector. This must be an array with four elements. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
| System.ArgumentOutOfRangeException | Thrown when |
Fields
One
A Double4 with all of its components set to one.
public static readonly Double4 One
Field Value
| Type | Description |
|---|---|
| Double4 |
SizeInBytes
The size of the Double4 type, in bytes.
public static readonly int SizeInBytes
Field Value
| Type | Description |
|---|---|
| System.Int32 |
UnitW
The W unit Double4 (0, 0, 0, 1).
public static readonly Double4 UnitW
Field Value
| Type | Description |
|---|---|
| Double4 |
UnitX
The X unit Double4 (1, 0, 0, 0).
public static readonly Double4 UnitX
Field Value
| Type | Description |
|---|---|
| Double4 |
UnitY
The Y unit Double4 (0, 1, 0, 0).
public static readonly Double4 UnitY
Field Value
| Type | Description |
|---|---|
| Double4 |
UnitZ
The Z unit Double4 (0, 0, 1, 0).
public static readonly Double4 UnitZ
Field Value
| Type | Description |
|---|---|
| Double4 |
W
The W component of the vector.
[DataMember(3)]
public double W
Field Value
| Type | Description |
|---|---|
| System.Double |
X
The X component of the vector.
[DataMember(0)]
public double X
Field Value
| Type | Description |
|---|---|
| System.Double |
Y
The Y component of the vector.
[DataMember(1)]
public double Y
Field Value
| Type | Description |
|---|---|
| System.Double |
Z
The Z component of the vector.
[DataMember(2)]
public double Z
Field Value
| Type | Description |
|---|---|
| System.Double |
Zero
A Double4 with all of its components set to zero.
public static readonly Double4 Zero
Field Value
| Type | Description |
|---|---|
| Double4 |
Properties
IsNormalized
Gets a value indicting whether this instance is normalized.
public readonly bool IsNormalized { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Item[Int32]
Gets or sets the component at the specified index.
public double this[int index] { get; set; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | The index of the component to access. Use 0 for the X component, 1 for the Y component, 2 for the Z component, and 3 for the W component. |
Property Value
| Type | Description |
|---|---|
| System.Double | The value of the X, Y, Z, or W component, depending on the index. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Thrown when the |
Methods
Add(Double4, Double4)
Adds two vectors.
public static Double4 Add(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to add. |
| Double4 | right | The second vector to add. |
Returns
| Type | Description |
|---|---|
| Double4 | The sum of the two vectors. |
Add(ref Double4, ref Double4, out Double4)
Adds two vectors.
public static void Add(ref Double4 left, ref Double4 right, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to add. |
| Double4 | right | The second vector to add. |
| Double4 | result | When the method completes, contains the sum of the two vectors. |
Barycentric(Double4, Double4, Double4, Double, Double)
Returns a Double4 containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle.
public static Double4 Barycentric(Double4 value1, Double4 value2, Double4 value3, double amount1, double amount2)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | A Double4 containing the 4D Cartesian coordinates of vertex 1 of the triangle. |
| Double4 | value2 | A Double4 containing the 4D Cartesian coordinates of vertex 2 of the triangle. |
| Double4 | value3 | A Double4 containing the 4D Cartesian coordinates of vertex 3 of the triangle. |
| System.Double | amount1 | Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in |
| System.Double | amount2 | Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in |
Returns
| Type | Description |
|---|---|
| Double4 | A new Double4 containing the 4D Cartesian coordinates of the specified point. |
Barycentric(ref Double4, ref Double4, ref Double4, Double, Double, out Double4)
Returns a Double4 containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 4D triangle.
public static void Barycentric(ref Double4 value1, ref Double4 value2, ref Double4 value3, double amount1, double amount2, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | A Double4 containing the 4D Cartesian coordinates of vertex 1 of the triangle. |
| Double4 | value2 | A Double4 containing the 4D Cartesian coordinates of vertex 2 of the triangle. |
| Double4 | value3 | A Double4 containing the 4D Cartesian coordinates of vertex 3 of the triangle. |
| System.Double | amount1 | Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in |
| System.Double | amount2 | Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in |
| Double4 | result | When the method completes, contains the 4D Cartesian coordinates of the specified point. |
CatmullRom(Double4, Double4, Double4, Double4, Double)
Performs a Catmull-Rom interpolation using the specified positions.
public static Double4 CatmullRom(Double4 value1, Double4 value2, Double4 value3, Double4 value4, double amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | The first position in the interpolation. |
| Double4 | value2 | The second position in the interpolation. |
| Double4 | value3 | The third position in the interpolation. |
| Double4 | value4 | The fourth position in the interpolation. |
| System.Double | amount | Weighting factor. |
Returns
| Type | Description |
|---|---|
| Double4 | A vector that is the result of the Catmull-Rom interpolation. |
CatmullRom(ref Double4, ref Double4, ref Double4, ref Double4, Double, out Double4)
Performs a Catmull-Rom interpolation using the specified positions.
public static void CatmullRom(ref Double4 value1, ref Double4 value2, ref Double4 value3, ref Double4 value4, double amount, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | The first position in the interpolation. |
| Double4 | value2 | The second position in the interpolation. |
| Double4 | value3 | The third position in the interpolation. |
| Double4 | value4 | The fourth position in the interpolation. |
| System.Double | amount | Weighting factor. |
| Double4 | result | When the method completes, contains the result of the Catmull-Rom interpolation. |
Clamp(Double4, Double4, Double4)
Restricts a value to be within a specified range.
public static Double4 Clamp(Double4 value, Double4 min, Double4 max)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The value to clamp. |
| Double4 | min | The minimum value. |
| Double4 | max | The maximum value. |
Returns
| Type | Description |
|---|---|
| Double4 | The clamped value. |
Clamp(ref Double4, ref Double4, ref Double4, out Double4)
Restricts a value to be within a specified range.
public static void Clamp(ref Double4 value, ref Double4 min, ref Double4 max, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The value to clamp. |
| Double4 | min | The minimum value. |
| Double4 | max | The maximum value. |
| Double4 | result | When the method completes, contains the clamped value. |
Demodulate(Double4, Double4)
Demodulates a vector with another by performing component-wise division.
public static Double4 Demodulate(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to demodulate. |
| Double4 | right | The second vector to demodulate. |
Returns
| Type | Description |
|---|---|
| Double4 | The demodulated vector. |
Demodulate(ref Double4, ref Double4, out Double4)
Demodulates a vector with another by performing component-wise division.
public static void Demodulate(ref Double4 left, ref Double4 right, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to demodulate. |
| Double4 | right | The second vector to demodulate. |
| Double4 | result | When the method completes, contains the demodulated vector. |
Distance(Double4, Double4)
Calculates the distance between two vectors.
public static double Distance(Double4 value1, Double4 value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | The first vector. |
| Double4 | value2 | The second vector. |
Returns
| Type | Description |
|---|---|
| System.Double | The distance between the two vectors. |
Remarks
DistanceSquared(Double4, Double4) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Double4, ref Double4, out Double)
Calculates the distance between two vectors.
public static void Distance(ref Double4 value1, ref Double4 value2, out double result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | The first vector. |
| Double4 | value2 | The second vector. |
| System.Double | result | When the method completes, contains the distance between the two vectors. |
Remarks
DistanceSquared(ref Double4, ref Double4, out Double) may be preferred when only the relative distance is needed and speed is of the essence.
DistanceSquared(Double4, Double4)
Calculates the squared distance between two vectors.
public static double DistanceSquared(Double4 value1, Double4 value2)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | The first vector. |
| Double4 | value2 | The second vector. |
Returns
| Type | Description |
|---|---|
| System.Double | The squared distance between the two vectors. |
Remarks
Distance squared is the value before taking the square root. Distance squared can often be used in place of distance if relative comparisons are being made. For example, consider three points A, B, and C. To determine whether B or C is further from A, compare the distance between A and B to the distance between A and C. Calculating the two distances involves two square roots, which are computationally expensive. However, using distance squared provides the same information and avoids calculating two square roots.
DistanceSquared(ref Double4, ref Double4, out Double)
Calculates the squared distance between two vectors.
public static void DistanceSquared(ref Double4 value1, ref Double4 value2, out double result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | The first vector. |
| Double4 | value2 | The second vector. |
| System.Double | result | When the method completes, contains the squared distance between the two vectors. |
Remarks
Distance squared is the value before taking the square root. Distance squared can often be used in place of distance if relative comparisons are being made. For example, consider three points A, B, and C. To determine whether B or C is further from A, compare the distance between A and B to the distance between A and C. Calculating the two distances involves two square roots, which are computationally expensive. However, using distance squared provides the same information and avoids calculating two square roots.
Divide(Double4, Double)
Scales a vector by the given value.
public static Double4 Divide(Double4 value, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| System.Double | scale | The amount by which to scale the vector. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Divide(ref Double4, Double, out Double4)
Scales a vector by the given value.
public static void Divide(ref Double4 value, double scale, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| System.Double | scale | The amount by which to scale the vector. |
| Double4 | result | When the method completes, contains the scaled vector. |
Dot(Double4, Double4)
Calculates the dot product of two vectors.
public static double Dot(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | First source vector. |
| Double4 | right | Second source vector. |
Returns
| Type | Description |
|---|---|
| System.Double | The dot product of the two vectors. |
Dot(ref Double4, ref Double4, out Double)
Calculates the dot product of two vectors.
public static void Dot(ref Double4 left, ref Double4 right, out double result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | First source vector |
| Double4 | right | Second source vector. |
| System.Double | result | When the method completes, contains the dot product of the two vectors. |
Equals(Double4)
Determines whether the specified Double4 is equal to this instance.
public bool Equals(Double4 other)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | other | The Double4 to compare with this instance. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
public override bool Equals(object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | value | The System.Object to compare with this instance. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Overrides
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Hermite(Double4, Double4, Double4, Double4, Double)
Performs a Hermite spline interpolation.
public static Double4 Hermite(Double4 value1, Double4 tangent1, Double4 value2, Double4 tangent2, double amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | First source position vector. |
| Double4 | tangent1 | First source tangent vector. |
| Double4 | value2 | Second source position vector. |
| Double4 | tangent2 | Second source tangent vector. |
| System.Double | amount | Weighting factor. |
Returns
| Type | Description |
|---|---|
| Double4 | The result of the Hermite spline interpolation. |
Hermite(ref Double4, ref Double4, ref Double4, ref Double4, Double, out Double4)
Performs a Hermite spline interpolation.
public static void Hermite(ref Double4 value1, ref Double4 tangent1, ref Double4 value2, ref Double4 tangent2, double amount, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value1 | First source position vector. |
| Double4 | tangent1 | First source tangent vector. |
| Double4 | value2 | Second source position vector. |
| Double4 | tangent2 | Second source tangent vector. |
| System.Double | amount | Weighting factor. |
| Double4 | result | When the method completes, contains the result of the Hermite spline interpolation. |
Length()
Calculates the length of the vector.
public double Length()
Returns
| Type | Description |
|---|---|
| System.Double | The length of the vector. |
Remarks
LengthSquared() may be preferred when only the relative length is needed and speed is of the essence.
LengthSquared()
Calculates the squared length of the vector.
public double LengthSquared()
Returns
| Type | Description |
|---|---|
| System.Double | The squared length of the vector. |
Remarks
This method may be preferred to Length() when only a relative length is needed and speed is of the essence.
Lerp(Double4, Double4, Double)
Performs a linear interpolation between two vectors.
public static Double4 Lerp(Double4 start, Double4 end, double amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | start | Start vector. |
| Double4 | end | End vector. |
| System.Double | amount | Value between 0 and 1 indicating the weight of |
Returns
| Type | Description |
|---|---|
| Double4 | The linear interpolation of the two vectors. |
Remarks
This method performs the linear interpolation based on the following formula.
start + (end - start) * amount
Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.
Lerp(ref Double4, ref Double4, Double, out Double4)
Performs a linear interpolation between two vectors.
public static void Lerp(ref Double4 start, ref Double4 end, double amount, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | start | Start vector. |
| Double4 | end | End vector. |
| System.Double | amount | Value between 0 and 1 indicating the weight of |
| Double4 | result | When the method completes, contains the linear interpolation of the two vectors. |
Remarks
This method performs the linear interpolation based on the following formula.
start + (end - start) * amount
Passing amount a value of 0 will cause start to be returned; a value of 1 will cause end to be returned.
Max(Double4, Double4)
Returns a vector containing the largest components of the specified vectors.
public static Double4 Max(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first source vector. |
| Double4 | right | The second source vector. |
Returns
| Type | Description |
|---|---|
| Double4 | A vector containing the largest components of the source vectors. |
Max(ref Double4, ref Double4, out Double4)
Returns a vector containing the smallest components of the specified vectors.
public static void Max(ref Double4 left, ref Double4 right, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first source vector. |
| Double4 | right | The second source vector. |
| Double4 | result | When the method completes, contains an new vector composed of the largest components of the source vectors. |
Min(Double4, Double4)
Returns a vector containing the smallest components of the specified vectors.
public static Double4 Min(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first source vector. |
| Double4 | right | The second source vector. |
Returns
| Type | Description |
|---|---|
| Double4 | A vector containing the smallest components of the source vectors. |
Min(ref Double4, ref Double4, out Double4)
Returns a vector containing the smallest components of the specified vectors.
public static void Min(ref Double4 left, ref Double4 right, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first source vector. |
| Double4 | right | The second source vector. |
| Double4 | result | When the method completes, contains an new vector composed of the smallest components of the source vectors. |
Modulate(Double4, Double4)
Modulates a vector with another by performing component-wise multiplication.
public static Double4 Modulate(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to modulate. |
| Double4 | right | The second vector to modulate. |
Returns
| Type | Description |
|---|---|
| Double4 | The modulated vector. |
Modulate(ref Double4, ref Double4, out Double4)
Modulates a vector with another by performing component-wise multiplication.
public static void Modulate(ref Double4 left, ref Double4 right, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to modulate. |
| Double4 | right | The second vector to modulate. |
| Double4 | result | When the method completes, contains the modulated vector. |
Multiply(Double4, Double)
Scales a vector by the given value.
public static Double4 Multiply(Double4 value, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| System.Double | scale | The amount by which to scale the vector. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Multiply(ref Double4, Double, out Double4)
Scales a vector by the given value.
public static void Multiply(ref Double4 value, double scale, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| System.Double | scale | The amount by which to scale the vector. |
| Double4 | result | When the method completes, contains the scaled vector. |
Negate(Double4)
Reverses the direction of a given vector.
public static Double4 Negate(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to negate. |
Returns
| Type | Description |
|---|---|
| Double4 | A vector facing in the opposite direction. |
Negate(ref Double4, out Double4)
Reverses the direction of a given vector.
public static void Negate(ref Double4 value, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to negate. |
| Double4 | result | When the method completes, contains a vector facing in the opposite direction. |
Normalize()
Converts the vector into a unit vector.
public void Normalize()
Normalize(Double4)
Converts the vector into a unit vector.
public static Double4 Normalize(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to normalize. |
Returns
| Type | Description |
|---|---|
| Double4 | The normalized vector. |
Normalize(ref Double4, out Double4)
Converts the vector into a unit vector.
public static void Normalize(ref Double4 value, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to normalize. |
| Double4 | result | When the method completes, contains the normalized vector. |
Orthogonalize(Double4[], Double4[])
Orthogonalizes a list of vectors.
public static void Orthogonalize(Double4[] destination, params Double4[] source)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4[] | destination | The list of orthogonalized vectors. |
| Double4[] | source | The list of vectors to orthogonalize. |
Remarks
Orthogonalization is the process of making all vectors orthogonal to each other. This means that any given vector in the list will be orthogonal to any other given vector in the list.
Because this method uses the modified Gram-Schmidt process, the resulting vectors tend to be numerically unstable. The numeric stability decreases according to the vectors position in the list so that the first vector is the most stable and the last vector is the least stable.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
| System.ArgumentOutOfRangeException | Thrown when |
Orthonormalize(Double4[], Double4[])
Orthonormalizes a list of vectors.
public static void Orthonormalize(Double4[] destination, params Double4[] source)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4[] | destination | The list of orthonormalized vectors. |
| Double4[] | source | The list of vectors to orthonormalize. |
Remarks
Orthonormalization is the process of making all vectors orthogonal to each other and making all vectors of unit length. This means that any given vector will be orthogonal to any other given vector in the list.
Because this method uses the modified Gram-Schmidt process, the resulting vectors tend to be numerically unstable. The numeric stability decreases according to the vectors position in the list so that the first vector is the most stable and the last vector is the least stable.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
| System.ArgumentOutOfRangeException | Thrown when |
Pow(Double)
Raises the exponent for each components.
public void Pow(double exponent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | exponent | The exponent. |
SmoothStep(Double4, Double4, Double)
Performs a cubic interpolation between two vectors.
public static Double4 SmoothStep(Double4 start, Double4 end, double amount)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | start | Start vector. |
| Double4 | end | End vector. |
| System.Double | amount | Value between 0 and 1 indicating the weight of |
Returns
| Type | Description |
|---|---|
| Double4 | The cubic interpolation of the two vectors. |
SmoothStep(ref Double4, ref Double4, Double, out Double4)
Performs a cubic interpolation between two vectors.
public static void SmoothStep(ref Double4 start, ref Double4 end, double amount, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | start | Start vector. |
| Double4 | end | End vector. |
| System.Double | amount | Value between 0 and 1 indicating the weight of |
| Double4 | result | When the method completes, contains the cubic interpolation of the two vectors. |
Subtract(Double4, Double4)
Subtracts two vectors.
public static Double4 Subtract(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to subtract. |
| Double4 | right | The second vector to subtract. |
Returns
| Type | Description |
|---|---|
| Double4 | The difference of the two vectors. |
Subtract(ref Double4, ref Double4, out Double4)
Subtracts two vectors.
public static void Subtract(ref Double4 left, ref Double4 right, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to subtract. |
| Double4 | right | The second vector to subtract. |
| Double4 | result | When the method completes, contains the difference of the two vectors. |
ToArray()
Creates an array containing the elements of the vector.
public double[] ToArray()
Returns
| Type | Description |
|---|---|
| System.Double[] | A four-element array containing the components of the vector. |
ToString()
Returns a System.String that represents this instance.
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
Overrides
ToString(IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IFormatProvider | formatProvider | The format provider. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
public string ToString(string format)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format | The format. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | format | The format. |
| System.IFormatProvider | formatProvider | The format provider. |
Returns
| Type | Description |
|---|---|
| System.String | A System.String that represents this instance. |
Transform(Double4, Matrix)
Transforms a 4D vector by the given Matrix.
public static Double4 Transform(Double4 vector, Matrix transform)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | vector | The source vector. |
| Matrix | transform | The transformation Matrix. |
Returns
| Type | Description |
|---|---|
| Double4 | The transformed Double4. |
Transform(Double4, Quaternion)
Transforms a 4D vector by the given Quaternion rotation.
public static Double4 Transform(Double4 vector, Quaternion rotation)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | vector | The vector to rotate. |
| Quaternion | rotation | The Quaternion rotation to apply. |
Returns
| Type | Description |
|---|---|
| Double4 | The transformed Double4. |
Transform(ref Double4, ref Matrix, out Double4)
Transforms a 4D vector by the given Matrix.
public static void Transform(ref Double4 vector, ref Matrix transform, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | vector | The source vector. |
| Matrix | transform | The transformation Matrix. |
| Double4 | result | When the method completes, contains the transformed Double4. |
Transform(ref Double4, ref Quaternion, out Double4)
Transforms a 4D vector by the given Quaternion rotation.
public static void Transform(ref Double4 vector, ref Quaternion rotation, out Double4 result)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | vector | The vector to rotate. |
| Quaternion | rotation | The Quaternion rotation to apply. |
| Double4 | result | When the method completes, contains the transformed Double4. |
Transform(Double4[], ref Matrix, Double4[])
Transforms an array of 4D vectors by the given Matrix.
public static void Transform(Double4[] source, ref Matrix transform, Double4[] destination)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4[] | source | The array of vectors to transform. |
| Matrix | transform | The transformation Matrix. |
| Double4[] | destination | The array for which the transformed vectors are stored.
This array may be the same array as |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
| System.ArgumentOutOfRangeException | Thrown when |
Transform(Double4[], ref Quaternion, Double4[])
Transforms an array of vectors by the given Quaternion rotation.
public static void Transform(Double4[] source, ref Quaternion rotation, Double4[] destination)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4[] | source | The array of vectors to transform. |
| Quaternion | rotation | The Quaternion rotation to apply. |
| Double4[] | destination | The array for which the transformed vectors are stored.
This array may be the same array as |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when |
| System.ArgumentOutOfRangeException | Thrown when |
Operators
Addition(Double4, Double4)
Adds two vectors.
public static Double4 operator +(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to add. |
| Double4 | right | The second vector to add. |
Returns
| Type | Description |
|---|---|
| Double4 | The sum of the two vectors. |
Division(Double4, Double4)
Divides a vector by the given vector, component-wise.
public static Double4 operator /(Double4 value, Double4 by)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| Double4 | by | The by. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Division(Double4, Double)
Scales a vector by the given value.
public static Double4 operator /(Double4 value, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| System.Double | scale | The amount by which to scale the vector. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Division(Double, Double4)
Divides a numerator by a vector.
public static Double4 operator /(double numerator, Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | numerator | The numerator. |
| Double4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Equality(Double4, Double4)
Tests for equality between two objects.
public static bool operator ==(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first value to compare. |
| Double4 | right | The second value to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Explicit(Double4 to Double2)
public static explicit operator Double2(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Double2 | The result of the conversion. |
Explicit(Double4 to Double3)
public static explicit operator Double3(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Double3 | The result of the conversion. |
Explicit(Double4 to Half4)
public static explicit operator Half4(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Half4 | The result of the conversion. |
Explicit(Double4 to Vector4)
public static explicit operator Vector4(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Vector4 | The result of the conversion. |
Explicit(Half4 to Double4)
public static explicit operator Double4(Half4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Half4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Double4 | The result of the conversion. |
Implicit(Vector4 to Double4)
public static implicit operator Double4(Vector4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector4 | value | The value. |
Returns
| Type | Description |
|---|---|
| Double4 | The result of the conversion. |
Inequality(Double4, Double4)
Tests for inequality between two objects.
public static bool operator !=(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first value to compare. |
| Double4 | right | The second value to compare. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Multiply(Double4, Double4)
Modulates a vector with another by performing component-wise multiplication.
public static Double4 operator *(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to multiply. |
| Double4 | right | The second vector to multiply. |
Returns
| Type | Description |
|---|---|
| Double4 | The multiplication of the two vectors. |
Multiply(Double4, Double)
Scales a vector by the given value.
public static Double4 operator *(Double4 value, double scale)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to scale. |
| System.Double | scale | The amount by which to scale the vector. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Multiply(Double, Double4)
Scales a vector by the given value.
public static Double4 operator *(double scale, Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | scale | The amount by which to scale the vector. |
| Double4 | value | The vector to scale. |
Returns
| Type | Description |
|---|---|
| Double4 | The scaled vector. |
Subtraction(Double4, Double4)
Subtracts two vectors.
public static Double4 operator -(Double4 left, Double4 right)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | left | The first vector to subtract. |
| Double4 | right | The second vector to subtract. |
Returns
| Type | Description |
|---|---|
| Double4 | The difference of the two vectors. |
UnaryNegation(Double4)
Reverses the direction of a given vector.
public static Double4 operator -(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to negate. |
Returns
| Type | Description |
|---|---|
| Double4 | A vector facing in the opposite direction. |
UnaryPlus(Double4)
Assert a vector (return it unchanged).
public static Double4 operator +(Double4 value)
Parameters
| Type | Name | Description |
|---|---|---|
| Double4 | value | The vector to assert (unchange). |
Returns
| Type | Description |
|---|---|
| Double4 | The asserted (unchanged) vector. |