Struct Double3
- Namespace
- Stride.Core.Mathematics
- Assembly
- Stride.Core.Mathematics.dll
Represents a three dimensional mathematical vector with double-precision floats.
[DataContract("double3")]
[DataStyle(DataStyle.Compact)]
public struct Double3 : IEquatable<Double3>, IFormattable
- Implements
Constructors
Double3(Double2, double)
Initializes a new instance of the Double3 struct.
public Double3(Double2 value, double z)
Parameters
valueDouble2A vector containing the values with which to initialize the X and Y components.
zdoubleInitial value for the Z component of the vector.
Double3(Vector3)
Initializes a new instance of the Double3 struct.
public Double3(Vector3 v)
Parameters
vVector3The Vector3 to construct the Double3 from.
Double3(double)
Initializes a new instance of the Double3 struct.
public Double3(double value)
Parameters
valuedoubleThe value that will be assigned to all components.
Double3(double, double, double)
Initializes a new instance of the Double3 struct.
public Double3(double x, double y, double z)
Parameters
xdoubleInitial value for the X component of the vector.
ydoubleInitial value for the Y component of the vector.
zdoubleInitial value for the Z component of the vector.
Double3(double[])
Initializes a new instance of the Double3 struct.
public Double3(double[] values)
Parameters
valuesdouble[]The values to assign to the X, Y, and Z components of the vector. This must be an array with three elements.
Exceptions
- ArgumentNullException
Thrown when
valuesisnull.- ArgumentOutOfRangeException
Thrown when
valuescontains more or less than three elements.
Fields
One
A Double3 with all of its components set to one.
public static readonly Double3 One
Field Value
SizeInBytes
The size of the Double3 type, in bytes.
public static readonly int SizeInBytes
Field Value
UnitX
The X unit Double3 (1, 0, 0).
public static readonly Double3 UnitX
Field Value
UnitY
The Y unit Double3 (0, 1, 0).
public static readonly Double3 UnitY
Field Value
UnitZ
The Z unit Double3 (0, 0, 1).
public static readonly Double3 UnitZ
Field Value
X
The X component of the vector.
[DataMember(0)]
public double X
Field Value
Y
The Y component of the vector.
[DataMember(1)]
public double Y
Field Value
Z
The Z component of the vector.
[DataMember(2)]
public double Z
Field Value
Zero
A Double3 with all of its components set to zero.
public static readonly Double3 Zero
Field Value
Properties
IsNormalized
Gets a value indicting whether this instance is normalized.
public bool IsNormalized { get; }
Property Value
this[int]
Gets or sets the component at the specified index.
public double this[int index] { get; set; }
Parameters
indexintThe index of the component to access. Use 0 for the X component, 1 for the Y component, and 2 for the Z component.
Property Value
- double
The value of the X, Y, or Z component, depending on the index.
Exceptions
- ArgumentOutOfRangeException
Thrown when the
indexis out of the range [0, 2].
Methods
Add(Double3, Double3)
Adds two vectors.
public static Double3 Add(Double3 left, Double3 right)
Parameters
Returns
- Double3
The sum of the two vectors.
Add(ref Double3, ref Double3, out Double3)
Adds two vectors.
public static void Add(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3The first vector to add.
rightDouble3The second vector to add.
resultDouble3When the method completes, contains the sum of the two vectors.
Barycentric(Double3, Double3, Double3, double, double)
Returns a Double3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.
public static Double3 Barycentric(Double3 value1, Double3 value2, Double3 value3, double amount1, double amount2)
Parameters
value1Double3A Double3 containing the 3D Cartesian coordinates of vertex 1 of the triangle.
value2Double3A Double3 containing the 3D Cartesian coordinates of vertex 2 of the triangle.
value3Double3A Double3 containing the 3D Cartesian coordinates of vertex 3 of the triangle.
amount1doubleBarycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in
value2).amount2doubleBarycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in
value3).
Returns
Barycentric(ref Double3, ref Double3, ref Double3, double, double, out Double3)
Returns a Double3 containing the 3D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 3D triangle.
public static void Barycentric(ref Double3 value1, ref Double3 value2, ref Double3 value3, double amount1, double amount2, out Double3 result)
Parameters
value1Double3A Double3 containing the 3D Cartesian coordinates of vertex 1 of the triangle.
value2Double3A Double3 containing the 3D Cartesian coordinates of vertex 2 of the triangle.
value3Double3A Double3 containing the 3D Cartesian coordinates of vertex 3 of the triangle.
amount1doubleBarycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in
value2).amount2doubleBarycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in
value3).resultDouble3When the method completes, contains the 3D Cartesian coordinates of the specified point.
CatmullRom(Double3, Double3, Double3, Double3, double)
Performs a Catmull-Rom interpolation using the specified positions.
public static Double3 CatmullRom(Double3 value1, Double3 value2, Double3 value3, Double3 value4, double amount)
Parameters
value1Double3The first position in the interpolation.
value2Double3The second position in the interpolation.
value3Double3The third position in the interpolation.
value4Double3The fourth position in the interpolation.
amountdoubleWeighting factor.
Returns
- Double3
A vector that is the result of the Catmull-Rom interpolation.
CatmullRom(ref Double3, ref Double3, ref Double3, ref Double3, double, out Double3)
Performs a Catmull-Rom interpolation using the specified positions.
public static void CatmullRom(ref Double3 value1, ref Double3 value2, ref Double3 value3, ref Double3 value4, double amount, out Double3 result)
Parameters
value1Double3The first position in the interpolation.
value2Double3The second position in the interpolation.
value3Double3The third position in the interpolation.
value4Double3The fourth position in the interpolation.
amountdoubleWeighting factor.
resultDouble3When the method completes, contains the result of the Catmull-Rom interpolation.
Clamp(Double3, Double3, Double3)
Restricts a value to be within a specified range.
public static Double3 Clamp(Double3 value, Double3 min, Double3 max)
Parameters
Returns
- Double3
The clamped value.
Clamp(ref Double3, ref Double3, ref Double3, out Double3)
Restricts a value to be within a specified range.
public static void Clamp(ref Double3 value, ref Double3 min, ref Double3 max, out Double3 result)
Parameters
valueDouble3The value to clamp.
minDouble3The minimum value.
maxDouble3The maximum value.
resultDouble3When the method completes, contains the clamped value.
Cross(Double3, Double3)
Calculates the cross product of two vectors.
public static Double3 Cross(Double3 left, Double3 right)
Parameters
Returns
- Double3
The cross product of the two vectors.
Cross(ref Double3, ref Double3, out Double3)
Calculates the cross product of two vectors.
public static void Cross(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3First source vector.
rightDouble3Second source vector.
resultDouble3When the method completes, contains he cross product of the two vectors.
Deconstruct(out double, out double, out double)
Deconstructs the vector's components into named variables.
public void Deconstruct(out double x, out double y, out double z)
Parameters
Demodulate(Double3, Double3)
Demodulates a vector with another by performing component-wise division.
public static Double3 Demodulate(Double3 left, Double3 right)
Parameters
Returns
- Double3
The demodulated vector.
Demodulate(ref Double3, ref Double3, out Double3)
Demodulates a vector with another by performing component-wise division.
public static void Demodulate(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3The first vector to demodulate.
rightDouble3The second vector to demodulate.
resultDouble3When the method completes, contains the demodulated vector.
Distance(Double3, Double3)
Calculates the distance between two vectors.
public static double Distance(Double3 value1, Double3 value2)
Parameters
Returns
- double
The distance between the two vectors.
Remarks
DistanceSquared(Double3, Double3) may be preferred when only the relative distance is needed and speed is of the essence.
Distance(ref Double3, ref Double3, out double)
Calculates the distance between two vectors.
public static void Distance(ref Double3 value1, ref Double3 value2, out double result)
Parameters
value1Double3The first vector.
value2Double3The second vector.
resultdoubleWhen the method completes, contains the distance between the two vectors.
Remarks
DistanceSquared(ref Double3, ref Double3, out double) may be preferred when only the relative distance is needed and speed is of the essence.
DistanceSquared(Double3, Double3)
Calculates the squared distance between two vectors.
public static double DistanceSquared(Double3 value1, Double3 value2)
Parameters
Returns
- 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 Double3, ref Double3, out double)
Calculates the squared distance between two vectors.
public static void DistanceSquared(ref Double3 value1, ref Double3 value2, out double result)
Parameters
value1Double3The first vector.
value2Double3The second vector.
resultdoubleWhen 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(Double3, double)
Scales a vector by the given value.
public static Double3 Divide(Double3 value, double scale)
Parameters
Returns
- Double3
The scaled vector.
Divide(ref Double3, double, out Double3)
Scales a vector by the given value.
public static void Divide(ref Double3 value, double scale, out Double3 result)
Parameters
valueDouble3The vector to scale.
scaledoubleThe amount by which to scale the vector.
resultDouble3When the method completes, contains the scaled vector.
Dot(Double3, Double3)
Calculates the dot product of two vectors.
public static double Dot(Double3 left, Double3 right)
Parameters
Returns
- double
The dot product of the two vectors.
Dot(ref Double3, ref Double3, out double)
Calculates the dot product of two vectors.
public static void Dot(ref Double3 left, ref Double3 right, out double result)
Parameters
leftDouble3First source vector.
rightDouble3Second source vector.
resultdoubleWhen the method completes, contains the dot product of the two vectors.
Equals(Double3)
Determines whether the specified Double3 is equal to this instance.
public bool Equals(Double3 other)
Parameters
Returns
Equals(object)
Determines whether the specified object is equal to this instance.
public override bool Equals(object value)
Parameters
Returns
GetHashCode()
Returns a hash code for this instance.
public override int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Hermite(Double3, Double3, Double3, Double3, double)
Performs a Hermite spline interpolation.
public static Double3 Hermite(Double3 value1, Double3 tangent1, Double3 value2, Double3 tangent2, double amount)
Parameters
value1Double3First source position vector.
tangent1Double3First source tangent vector.
value2Double3Second source position vector.
tangent2Double3Second source tangent vector.
amountdoubleWeighting factor.
Returns
- Double3
The result of the Hermite spline interpolation.
Hermite(ref Double3, ref Double3, ref Double3, ref Double3, double, out Double3)
Performs a Hermite spline interpolation.
public static void Hermite(ref Double3 value1, ref Double3 tangent1, ref Double3 value2, ref Double3 tangent2, double amount, out Double3 result)
Parameters
value1Double3First source position vector.
tangent1Double3First source tangent vector.
value2Double3Second source position vector.
tangent2Double3Second source tangent vector.
amountdoubleWeighting factor.
resultDouble3When the method completes, contains the result of the Hermite spline interpolation.
Length()
Calculates the length of the vector.
public double Length()
Returns
- 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
- 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(Double3, Double3, double)
Performs a linear interpolation between two vectors.
public static Double3 Lerp(Double3 start, Double3 end, double amount)
Parameters
startDouble3Start vector.
endDouble3End vector.
amountdoubleValue between 0 and 1 indicating the weight of
end.
Returns
- Double3
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 Double3, ref Double3, double, out Double3)
Performs a linear interpolation between two vectors.
public static void Lerp(ref Double3 start, ref Double3 end, double amount, out Double3 result)
Parameters
startDouble3Start vector.
endDouble3End vector.
amountdoubleValue between 0 and 1 indicating the weight of
end.resultDouble3When 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(Double3, Double3)
Returns a vector containing the largest components of the specified vectors.
public static Double3 Max(Double3 left, Double3 right)
Parameters
Returns
- Double3
A vector containing the largest components of the source vectors.
Max(ref Double3, ref Double3, out Double3)
Returns a vector containing the smallest components of the specified vectors.
public static void Max(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3The first source vector.
rightDouble3The second source vector.
resultDouble3When the method completes, contains an new vector composed of the largest components of the source vectors.
Min(Double3, Double3)
Returns a vector containing the smallest components of the specified vectors.
public static Double3 Min(Double3 left, Double3 right)
Parameters
Returns
- Double3
A vector containing the smallest components of the source vectors.
Min(ref Double3, ref Double3, out Double3)
Returns a vector containing the smallest components of the specified vectors.
public static void Min(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3The first source vector.
rightDouble3The second source vector.
resultDouble3When the method completes, contains an new vector composed of the smallest components of the source vectors.
Modulate(Double3, Double3)
Modulates a vector with another by performing component-wise multiplication.
public static Double3 Modulate(Double3 left, Double3 right)
Parameters
Returns
- Double3
The modulated vector.
Modulate(ref Double3, ref Double3, out Double3)
Modulates a vector with another by performing component-wise multiplication.
public static void Modulate(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3The first vector to modulate.
rightDouble3The second vector to modulate.
resultDouble3When the method completes, contains the modulated vector.
Multiply(Double3, double)
Scales a vector by the given value.
public static Double3 Multiply(Double3 value, double scale)
Parameters
Returns
- Double3
The scaled vector.
Multiply(ref Double3, double, out Double3)
Scales a vector by the given value.
public static void Multiply(ref Double3 value, double scale, out Double3 result)
Parameters
valueDouble3The vector to scale.
scaledoubleThe amount by which to scale the vector.
resultDouble3When the method completes, contains the scaled vector.
NearEqual(Double3, Double3, Double3)
Tests whether one 3D vector is near another 3D vector.
public static bool NearEqual(Double3 left, Double3 right, Double3 epsilon)
Parameters
Returns
- bool
trueif left and right are near another 3D,falseotherwise
NearEqual(ref Double3, ref Double3, ref Double3)
Tests whether one 3D vector is near another 3D vector.
public static bool NearEqual(ref Double3 left, ref Double3 right, ref Double3 epsilon)
Parameters
Returns
- bool
trueif left and right are near another 3D,falseotherwise
Negate(Double3)
Reverses the direction of a given vector.
public static Double3 Negate(Double3 value)
Parameters
valueDouble3The vector to negate.
Returns
- Double3
A vector facing in the opposite direction.
Negate(ref Double3, out Double3)
Reverses the direction of a given vector.
public static void Negate(ref Double3 value, out Double3 result)
Parameters
valueDouble3The vector to negate.
resultDouble3When the method completes, contains a vector facing in the opposite direction.
Normalize()
Converts the vector into a unit vector.
public void Normalize()
Normalize(Double3)
Converts the vector into a unit vector.
public static Double3 Normalize(Double3 value)
Parameters
valueDouble3The vector to normalize.
Returns
- Double3
The normalized vector.
Normalize(ref Double3, out Double3)
Converts the vector into a unit vector.
public static void Normalize(ref Double3 value, out Double3 result)
Parameters
valueDouble3The vector to normalize.
resultDouble3When the method completes, contains the normalized vector.
Orthogonalize(Double3[], params Double3[])
Orthogonalizes a list of vectors.
public static void Orthogonalize(Double3[] destination, params Double3[] source)
Parameters
destinationDouble3[]The list of orthogonalized vectors.
sourceDouble3[]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
- ArgumentNullException
Thrown when
sourceordestinationisnull.- ArgumentOutOfRangeException
Thrown when
destinationis shorter in length thansource.
Orthonormalize(Double3[], params Double3[])
Orthonormalizes a list of vectors.
public static void Orthonormalize(Double3[] destination, params Double3[] source)
Parameters
destinationDouble3[]The list of orthonormalized vectors.
sourceDouble3[]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
- ArgumentNullException
Thrown when
sourceordestinationisnull.- ArgumentOutOfRangeException
Thrown when
destinationis shorter in length thansource.
Pow(double)
Raises the exponent for each components.
public void Pow(double exponent)
Parameters
exponentdoubleThe exponent.
Project(Double3, double, double, double, double, double, double, Matrix)
Projects a 3D vector from object space into screen space.
public static Double3 Project(Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, Matrix worldViewProjection)
Parameters
vectorDouble3The vector to project.
xdoubleThe X position of the viewport.
ydoubleThe Y position of the viewport.
widthdoubleThe width of the viewport.
heightdoubleThe height of the viewport.
minZdoubleThe minimum depth of the viewport.
maxZdoubleThe maximum depth of the viewport.
worldViewProjectionMatrixThe combined world-view-projection matrix.
Returns
- Double3
The vector in screen space.
Project(ref Double3, double, double, double, double, double, double, ref Matrix, out Double3)
Projects a 3D vector from object space into screen space.
public static void Project(ref Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, ref Matrix worldViewProjection, out Double3 result)
Parameters
vectorDouble3The vector to project.
xdoubleThe X position of the viewport.
ydoubleThe Y position of the viewport.
widthdoubleThe width of the viewport.
heightdoubleThe height of the viewport.
minZdoubleThe minimum depth of the viewport.
maxZdoubleThe maximum depth of the viewport.
worldViewProjectionMatrixThe combined world-view-projection matrix.
resultDouble3When the method completes, contains the vector in screen space.
Reflect(Double3, Double3)
Returns the reflection of a vector off a surface that has the specified normal.
public static Double3 Reflect(Double3 vector, Double3 normal)
Parameters
Returns
- Double3
The reflected vector.
Remarks
Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.
Reflect(ref Double3, ref Double3, out Double3)
Returns the reflection of a vector off a surface that has the specified normal.
public static void Reflect(ref Double3 vector, ref Double3 normal, out Double3 result)
Parameters
vectorDouble3The source vector.
normalDouble3Normal of the surface.
resultDouble3When the method completes, contains the reflected vector.
Remarks
Reflect only gives the direction of a reflection off a surface, it does not determine whether the original vector was close enough to the surface to hit it.
RotationYawPitchRoll(Quaternion)
Calculate the yaw/pitch/roll rotation equivalent to the provided quaterion.
public static Double3 RotationYawPitchRoll(Quaternion quaternion)
Parameters
quaternionQuaternionThe input rotation as quaternion
Returns
- Double3
The equivation yaw/pitch/roll rotation
RotationYawPitchRoll(ref Quaternion, out Double3)
Calculate the yaw/pitch/roll rotation equivalent to the provided quaterion.
public static void RotationYawPitchRoll(ref Quaternion quaternion, out Double3 yawPitchRoll)
Parameters
quaternionQuaternionThe input rotation as quaternion
yawPitchRollDouble3The equivation yaw/pitch/roll rotation
SmoothStep(Double3, Double3, double)
Performs a cubic interpolation between two vectors.
public static Double3 SmoothStep(Double3 start, Double3 end, double amount)
Parameters
startDouble3Start vector.
endDouble3End vector.
amountdoubleValue between 0 and 1 indicating the weight of
end.
Returns
- Double3
The cubic interpolation of the two vectors.
SmoothStep(ref Double3, ref Double3, double, out Double3)
Performs a cubic interpolation between two vectors.
public static void SmoothStep(ref Double3 start, ref Double3 end, double amount, out Double3 result)
Parameters
startDouble3Start vector.
endDouble3End vector.
amountdoubleValue between 0 and 1 indicating the weight of
end.resultDouble3When the method completes, contains the cubic interpolation of the two vectors.
Subtract(Double3, Double3)
Subtracts two vectors.
public static Double3 Subtract(Double3 left, Double3 right)
Parameters
Returns
- Double3
The difference of the two vectors.
Subtract(ref Double3, ref Double3, out Double3)
Subtracts two vectors.
public static void Subtract(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
leftDouble3The first vector to subtract.
rightDouble3The second vector to subtract.
resultDouble3When the method completes, contains the difference of the two vectors.
ToArray()
Creates an array containing the elements of the vector.
public double[] ToArray()
Returns
- double[]
A three-element array containing the components of the vector.
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
ToString(IFormatProvider)
Returns a string that represents this instance.
public string ToString(IFormatProvider formatProvider)
Parameters
formatProviderIFormatProviderThe format provider.
Returns
ToString(string)
Returns a string that represents this instance.
public string ToString(string format)
Parameters
formatstringThe format.
Returns
ToString(string, IFormatProvider)
Returns a string that represents this instance.
public string ToString(string format, IFormatProvider formatProvider)
Parameters
formatstringThe format.
formatProviderIFormatProviderThe format provider.
Returns
Transform(Double3, Matrix)
Transforms a 3D vector by the given Matrix.
public static Double4 Transform(Double3 vector, Matrix transform)
Parameters
Returns
Transform(Double3, Quaternion)
Transforms a 3D vector by the given Quaternion rotation.
public static Double3 Transform(Double3 vector, Quaternion rotation)
Parameters
vectorDouble3The vector to rotate.
rotationQuaternionThe Quaternion rotation to apply.
Returns
Transform(ref Double3, ref Matrix, out Double3)
Transforms a 3D vector by the given Matrix.
public static void Transform(ref Double3 vector, ref Matrix transform, out Double3 result)
Parameters
vectorDouble3The source vector.
transformMatrixThe transformation Matrix.
resultDouble3When the method completes, contains the transformed Double3.
Transform(ref Double3, ref Matrix, out Double4)
Transforms a 3D vector by the given Matrix.
public static void Transform(ref Double3 vector, ref Matrix transform, out Double4 result)
Parameters
vectorDouble3The source vector.
transformMatrixThe transformation Matrix.
resultDouble4When the method completes, contains the transformed Double4.
Transform(ref Double3, ref Quaternion, out Double3)
Transforms a 3D vector by the given Quaternion rotation.
public static void Transform(ref Double3 vector, ref Quaternion rotation, out Double3 result)
Parameters
vectorDouble3The vector to rotate.
rotationQuaternionThe Quaternion rotation to apply.
resultDouble3When the method completes, contains the transformed Double4.
Transform(Double3[], ref Matrix, Double4[])
Transforms an array of 3D vectors by the given Matrix.
public static void Transform(Double3[] source, ref Matrix transform, Double4[] destination)
Parameters
sourceDouble3[]The array of vectors to transform.
transformMatrixThe transformation Matrix.
destinationDouble4[]The array for which the transformed vectors are stored.
Exceptions
- ArgumentNullException
Thrown when
sourceordestinationisnull.- ArgumentOutOfRangeException
Thrown when
destinationis shorter in length thansource.
Transform(Double3[], ref Quaternion, Double3[])
Transforms an array of vectors by the given Quaternion rotation.
public static void Transform(Double3[] source, ref Quaternion rotation, Double3[] destination)
Parameters
sourceDouble3[]The array of vectors to transform.
rotationQuaternionThe Quaternion rotation to apply.
destinationDouble3[]The array for which the transformed vectors are stored. This array may be the same array as
source.
Exceptions
- ArgumentNullException
Thrown when
sourceordestinationisnull.- ArgumentOutOfRangeException
Thrown when
destinationis shorter in length thansource.
TransformCoordinate(Double3, Matrix)
Performs a coordinate transformation using the given Matrix.
public static Double3 TransformCoordinate(Double3 coordinate, Matrix transform)
Parameters
Returns
- Double3
The transformed coordinates.
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the wcomponent to be one and therefore makes the vector homogeneous. The homogeneous vector is often prefered when working with coordinates as the w component can safely be ignored.
TransformCoordinate(ref Double3, ref Matrix, out Double3)
Performs a coordinate transformation using the given Matrix.
public static void TransformCoordinate(ref Double3 coordinate, ref Matrix transform, out Double3 result)
Parameters
coordinateDouble3The coordinate vector to transform.
transformMatrixThe transformation Matrix.
resultDouble3When the method completes, contains the transformed coordinates.
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the wcomponent to be one and therefore makes the vector homogeneous. The homogeneous vector is often prefered when working with coordinates as the w component can safely be ignored.
TransformCoordinate(Double3[], ref Matrix, Double3[])
Performs a coordinate transformation on an array of vectors using the given Matrix.
public static void TransformCoordinate(Double3[] source, ref Matrix transform, Double3[] destination)
Parameters
sourceDouble3[]The array of coordinate vectors to trasnform.
transformMatrixThe transformation Matrix.
destinationDouble3[]The array for which the transformed vectors are stored. This array may be the same array as
source.
Remarks
A coordinate transform performs the transformation with the assumption that the w component is one. The four dimensional vector obtained from the transformation operation has each component in the vector divided by the w component. This forces the wcomponent to be one and therefore makes the vector homogeneous. The homogeneous vector is often prefered when working with coordinates as the w component can safely be ignored.
Exceptions
- ArgumentNullException
Thrown when
sourceordestinationisnull.- ArgumentOutOfRangeException
Thrown when
destinationis shorter in length thansource.
TransformNormal(Double3, Matrix)
Performs a normal transformation using the given Matrix.
public static Double3 TransformNormal(Double3 normal, Matrix transform)
Parameters
Returns
- Double3
The transformed normal.
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth collumn of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often prefered for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
TransformNormal(ref Double3, ref Matrix, out Double3)
Performs a normal transformation using the given Matrix.
public static void TransformNormal(ref Double3 normal, ref Matrix transform, out Double3 result)
Parameters
normalDouble3The normal vector to transform.
transformMatrixThe transformation Matrix.
resultDouble3When the method completes, contains the transformed normal.
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth collumn of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often prefered for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
TransformNormal(Double3[], ref Matrix, Double3[])
Performs a normal transformation on an array of vectors using the given Matrix.
public static void TransformNormal(Double3[] source, ref Matrix transform, Double3[] destination)
Parameters
sourceDouble3[]The array of normal vectors to transform.
transformMatrixThe transformation Matrix.
destinationDouble3[]The array for which the transformed vectors are stored. This array may be the same array as
source.
Remarks
A normal transform performs the transformation with the assumption that the w component is zero. This causes the fourth row and fourth collumn of the matrix to be unused. The end result is a vector that is not translated, but all other transformation properties apply. This is often prefered for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
Exceptions
- ArgumentNullException
Thrown when
sourceordestinationisnull.- ArgumentOutOfRangeException
Thrown when
destinationis shorter in length thansource.
Unproject(Double3, double, double, double, double, double, double, Matrix)
Projects a 3D vector from screen space into object space.
public static Double3 Unproject(Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, Matrix worldViewProjection)
Parameters
vectorDouble3The vector to project.
xdoubleThe X position of the viewport.
ydoubleThe Y position of the viewport.
widthdoubleThe width of the viewport.
heightdoubleThe height of the viewport.
minZdoubleThe minimum depth of the viewport.
maxZdoubleThe maximum depth of the viewport.
worldViewProjectionMatrixThe combined world-view-projection matrix.
Returns
- Double3
The vector in object space.
Unproject(ref Double3, double, double, double, double, double, double, ref Matrix, out Double3)
Projects a 3D vector from screen space into object space.
public static void Unproject(ref Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, ref Matrix worldViewProjection, out Double3 result)
Parameters
vectorDouble3The vector to project.
xdoubleThe X position of the viewport.
ydoubleThe Y position of the viewport.
widthdoubleThe width of the viewport.
heightdoubleThe height of the viewport.
minZdoubleThe minimum depth of the viewport.
maxZdoubleThe maximum depth of the viewport.
worldViewProjectionMatrixThe combined world-view-projection matrix.
resultDouble3When the method completes, contains the vector in object space.
Operators
operator +(Double3, Double3)
Adds two vectors.
public static Double3 operator +(Double3 left, Double3 right)
Parameters
Returns
- Double3
The sum of the two vectors.
operator +(Double3, double)
Adds a vector with the given value.
public static Double3 operator +(Double3 value, double scale)
Parameters
Returns
- Double3
The vector offset.
operator /(Double3, Double3)
Divides a vector by the given vector, component-wise.
public static Double3 operator /(Double3 value, Double3 by)
Parameters
Returns
- Double3
The scaled vector.
operator /(Double3, double)
Scales a vector by the given value.
public static Double3 operator /(Double3 value, double scale)
Parameters
Returns
- Double3
The scaled vector.
operator /(double, Double3)
Divides a numerator by a vector.
public static Double3 operator /(double numerator, Double3 value)
Parameters
Returns
- Double3
The scaled vector.
operator ==(Double3, Double3)
Tests for equality between two objects.
public static bool operator ==(Double3 left, Double3 right)
Parameters
Returns
- bool
trueiflefthas the same value asright; otherwise,false.
explicit operator Double2(Double3)
public static explicit operator Double2(Double3 value)
Parameters
valueDouble3The value.
Returns
- Double2
The result of the conversion.
explicit operator Double4(Double3)
public static explicit operator Double4(Double3 value)
Parameters
valueDouble3The value.
Returns
- Double4
The result of the conversion.
explicit operator Half3(Double3)
public static explicit operator Half3(Double3 value)
Parameters
valueDouble3The value.
Returns
- Half3
The result of the conversion.
explicit operator Vector3(Double3)
public static explicit operator Vector3(Double3 value)
Parameters
valueDouble3The value.
Returns
- Vector3
The result of the conversion.
explicit operator Double3(Half3)
public static explicit operator Double3(Half3 value)
Parameters
valueHalf3The value.
Returns
- Double3
The result of the conversion.
implicit operator Double3(Vector3)
public static implicit operator Double3(Vector3 value)
Parameters
valueVector3The value.
Returns
- Double3
The result of the conversion.
operator !=(Double3, Double3)
Tests for inequality between two objects.
public static bool operator !=(Double3 left, Double3 right)
Parameters
Returns
- bool
trueiflefthas a different value thanright; otherwise,false.
operator *(Double3, Double3)
Modulates a vector with another by performing component-wise multiplication.
public static Double3 operator *(Double3 left, Double3 right)
Parameters
Returns
- Double3
The multiplication of the two vectors.
operator *(Double3, double)
Scales a vector by the given value.
public static Double3 operator *(Double3 value, double scale)
Parameters
Returns
- Double3
The scaled vector.
operator *(double, Double3)
Scales a vector by the given value.
public static Double3 operator *(double scale, Double3 value)
Parameters
Returns
- Double3
The scaled vector.
operator -(Double3, Double3)
Subtracts two vectors.
public static Double3 operator -(Double3 left, Double3 right)
Parameters
Returns
- Double3
The difference of the two vectors.
operator -(Double3, double)
Substracts a vector by the given value.
public static Double3 operator -(Double3 value, double scale)
Parameters
Returns
- Double3
The vector offset.
operator -(Double3)
Reverses the direction of a given vector.
public static Double3 operator -(Double3 value)
Parameters
valueDouble3The vector to negate.
Returns
- Double3
A vector facing in the opposite direction.
operator +(Double3)
Assert a vector (return it unchanged).
public static Double3 operator +(Double3 value)
Parameters
valueDouble3The vector to assert (unchange).
Returns
- Double3
The asserted (unchanged) vector.