Table of Contents

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

value Double2

A vector containing the values with which to initialize the X and Y components.

z double

Initial value for the Z component of the vector.

Double3(Vector3)

Initializes a new instance of the Double3 struct.

public Double3(Vector3 v)

Parameters

v Vector3

The Vector3 to construct the Double3 from.

Double3(double)

Initializes a new instance of the Double3 struct.

public Double3(double value)

Parameters

value double

The 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

x double

Initial value for the X component of the vector.

y double

Initial value for the Y component of the vector.

z double

Initial value for the Z component of the vector.

Double3(double[])

Initializes a new instance of the Double3 struct.

public Double3(double[] values)

Parameters

values double[]

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 values is null.

ArgumentOutOfRangeException

Thrown when values contains 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

Double3

SizeInBytes

The size of the Double3 type, in bytes.

public static readonly int SizeInBytes

Field Value

int

UnitX

The X unit Double3 (1, 0, 0).

public static readonly Double3 UnitX

Field Value

Double3

UnitY

The Y unit Double3 (0, 1, 0).

public static readonly Double3 UnitY

Field Value

Double3

UnitZ

The Z unit Double3 (0, 0, 1).

public static readonly Double3 UnitZ

Field Value

Double3

X

The X component of the vector.

[DataMember(0)]
public double X

Field Value

double

Y

The Y component of the vector.

[DataMember(1)]
public double Y

Field Value

double

Z

The Z component of the vector.

[DataMember(2)]
public double Z

Field Value

double

Zero

A Double3 with all of its components set to zero.

public static readonly Double3 Zero

Field Value

Double3

Properties

IsNormalized

Gets a value indicting whether this instance is normalized.

public bool IsNormalized { get; }

Property Value

bool

this[int]

Gets or sets the component at the specified index.

public double this[int index] { get; set; }

Parameters

index int

The 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 index is out of the range [0, 2].

Methods

Add(Double3, Double3)

Adds two vectors.

public static Double3 Add(Double3 left, Double3 right)

Parameters

left Double3

The first vector to add.

right Double3

The second vector to add.

Returns

Double3

The sum of the two vectors.

Add(ref readonly Double3, ref readonly Double3, out Double3)

Adds two vectors.

public static void Add(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

The first vector to add.

right Double3

The second vector to add.

result Double3

When 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

value1 Double3

A Double3 containing the 3D Cartesian coordinates of vertex 1 of the triangle.

value2 Double3

A Double3 containing the 3D Cartesian coordinates of vertex 2 of the triangle.

value3 Double3

A Double3 containing the 3D Cartesian coordinates of vertex 3 of the triangle.

amount1 double

Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

amount2 double

Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

Returns

Double3

A new Double3 containing the 3D Cartesian coordinates of the specified point.

Barycentric(ref readonly Double3, ref readonly Double3, ref readonly 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 readonly Double3 value1, ref readonly Double3 value2, ref readonly Double3 value3, double amount1, double amount2, out Double3 result)

Parameters

value1 Double3

A Double3 containing the 3D Cartesian coordinates of vertex 1 of the triangle.

value2 Double3

A Double3 containing the 3D Cartesian coordinates of vertex 2 of the triangle.

value3 Double3

A Double3 containing the 3D Cartesian coordinates of vertex 3 of the triangle.

amount1 double

Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in value2).

amount2 double

Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in value3).

result Double3

When 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

value1 Double3

The first position in the interpolation.

value2 Double3

The second position in the interpolation.

value3 Double3

The third position in the interpolation.

value4 Double3

The fourth position in the interpolation.

amount double

Weighting factor.

Returns

Double3

A vector that is the result of the Catmull-Rom interpolation.

CatmullRom(ref readonly Double3, ref readonly Double3, ref readonly Double3, ref readonly Double3, double, out Double3)

Performs a Catmull-Rom interpolation using the specified positions.

public static void CatmullRom(ref readonly Double3 value1, ref readonly Double3 value2, ref readonly Double3 value3, ref readonly Double3 value4, double amount, out Double3 result)

Parameters

value1 Double3

The first position in the interpolation.

value2 Double3

The second position in the interpolation.

value3 Double3

The third position in the interpolation.

value4 Double3

The fourth position in the interpolation.

amount double

Weighting factor.

result Double3

When 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

value Double3

The value to clamp.

min Double3

The minimum value.

max Double3

The maximum value.

Returns

Double3

The clamped value.

Clamp(ref readonly Double3, ref readonly Double3, ref readonly Double3, out Double3)

Restricts a value to be within a specified range.

public static void Clamp(ref readonly Double3 value, ref readonly Double3 min, ref readonly Double3 max, out Double3 result)

Parameters

value Double3

The value to clamp.

min Double3

The minimum value.

max Double3

The maximum value.

result Double3

When 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

left Double3

First source vector.

right Double3

Second source vector.

Returns

Double3

The cross product of the two vectors.

Cross(ref readonly Double3, ref readonly Double3, out Double3)

Calculates the cross product of two vectors.

public static void Cross(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

First source vector.

right Double3

Second source vector.

result Double3

When 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

x double

The X component

y double

The Y component

z double

The Z component

Demodulate(Double3, Double3)

Demodulates a vector with another by performing component-wise division.

public static Double3 Demodulate(Double3 left, Double3 right)

Parameters

left Double3

The first vector to demodulate.

right Double3

The second vector to demodulate.

Returns

Double3

The demodulated vector.

Demodulate(ref readonly Double3, ref readonly Double3, out Double3)

Demodulates a vector with another by performing component-wise division.

public static void Demodulate(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

The first vector to demodulate.

right Double3

The second vector to demodulate.

result Double3

When 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

value1 Double3

The first vector.

value2 Double3

The second vector.

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 readonly Double3, ref readonly Double3, out double)

Calculates the distance between two vectors.

public static void Distance(ref readonly Double3 value1, ref readonly Double3 value2, out double result)

Parameters

value1 Double3

The first vector.

value2 Double3

The second vector.

result double

When the method completes, contains the distance between the two vectors.

Remarks

DistanceSquared(ref readonly Double3, ref readonly 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

value1 Double3

The first vector.

value2 Double3

The second vector.

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 readonly Double3, ref readonly Double3, out double)

Calculates the squared distance between two vectors.

public static void DistanceSquared(ref readonly Double3 value1, ref readonly Double3 value2, out double result)

Parameters

value1 Double3

The first vector.

value2 Double3

The second vector.

result double

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(Double3, double)

Scales a vector by the given value.

public static Double3 Divide(Double3 value, double scale)

Parameters

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

Returns

Double3

The scaled vector.

Divide(ref readonly Double3, double, out Double3)

Scales a vector by the given value.

public static void Divide(ref readonly Double3 value, double scale, out Double3 result)

Parameters

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

result Double3

When 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

left Double3

First source vector.

right Double3

Second source vector.

Returns

double

The dot product of the two vectors.

Dot(ref readonly Double3, ref readonly Double3, out double)

Calculates the dot product of two vectors.

public static void Dot(ref readonly Double3 left, ref readonly Double3 right, out double result)

Parameters

left Double3

First source vector.

right Double3

Second source vector.

result double

When 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

other Double3

The Double3 to compare with this instance.

Returns

bool

true if the specified Double3 is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

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

value1 Double3

First source position vector.

tangent1 Double3

First source tangent vector.

value2 Double3

Second source position vector.

tangent2 Double3

Second source tangent vector.

amount double

Weighting factor.

Returns

Double3

The result of the Hermite spline interpolation.

Hermite(ref readonly Double3, ref readonly Double3, ref readonly Double3, ref readonly Double3, double, out Double3)

Performs a Hermite spline interpolation.

public static void Hermite(ref readonly Double3 value1, ref readonly Double3 tangent1, ref readonly Double3 value2, ref readonly Double3 tangent2, double amount, out Double3 result)

Parameters

value1 Double3

First source position vector.

tangent1 Double3

First source tangent vector.

value2 Double3

Second source position vector.

tangent2 Double3

Second source tangent vector.

amount double

Weighting factor.

result Double3

When 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

start Double3

Start vector.

end Double3

End vector.

amount double

Value 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 readonly Double3, ref readonly Double3, double, out Double3)

Performs a linear interpolation between two vectors.

public static void Lerp(ref readonly Double3 start, ref readonly Double3 end, double amount, out Double3 result)

Parameters

start Double3

Start vector.

end Double3

End vector.

amount double

Value between 0 and 1 indicating the weight of end.

result Double3

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(Double3, Double3)

Returns a vector containing the largest components of the specified vectors.

public static Double3 Max(Double3 left, Double3 right)

Parameters

left Double3

The first source vector.

right Double3

The second source vector.

Returns

Double3

A vector containing the largest components of the source vectors.

Max(ref readonly Double3, ref readonly Double3, out Double3)

Returns a vector containing the smallest components of the specified vectors.

public static void Max(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

The first source vector.

right Double3

The second source vector.

result Double3

When 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

left Double3

The first source vector.

right Double3

The second source vector.

Returns

Double3

A vector containing the smallest components of the source vectors.

Min(ref readonly Double3, ref readonly Double3, out Double3)

Returns a vector containing the smallest components of the specified vectors.

public static void Min(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

The first source vector.

right Double3

The second source vector.

result Double3

When 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

left Double3

The first vector to modulate.

right Double3

The second vector to modulate.

Returns

Double3

The modulated vector.

Modulate(ref readonly Double3, ref readonly Double3, out Double3)

Modulates a vector with another by performing component-wise multiplication.

public static void Modulate(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

The first vector to modulate.

right Double3

The second vector to modulate.

result Double3

When 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

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

Returns

Double3

The scaled vector.

Multiply(ref readonly Double3, double, out Double3)

Scales a vector by the given value.

public static void Multiply(ref readonly Double3 value, double scale, out Double3 result)

Parameters

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

result Double3

When 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

left Double3

The left vector.

right Double3

The right vector.

epsilon Double3

The epsilon.

Returns

bool

true if left and right are near another 3D, false otherwise

NearEqual(ref readonly Double3, ref readonly Double3, ref readonly Double3)

Tests whether one 3D vector is near another 3D vector.

public static bool NearEqual(ref readonly Double3 left, ref readonly Double3 right, ref readonly Double3 epsilon)

Parameters

left Double3

The left vector.

right Double3

The right vector.

epsilon Double3

The epsilon.

Returns

bool

true if left and right are near another 3D, false otherwise

Negate(Double3)

Reverses the direction of a given vector.

public static Double3 Negate(Double3 value)

Parameters

value Double3

The vector to negate.

Returns

Double3

A vector facing in the opposite direction.

Negate(ref readonly Double3, out Double3)

Reverses the direction of a given vector.

public static void Negate(ref readonly Double3 value, out Double3 result)

Parameters

value Double3

The vector to negate.

result Double3

When 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

value Double3

The vector to normalize.

Returns

Double3

The normalized vector.

Normalize(ref readonly Double3, out Double3)

Converts the vector into a unit vector.

public static void Normalize(ref readonly Double3 value, out Double3 result)

Parameters

value Double3

The vector to normalize.

result Double3

When 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

destination Double3[]

The list of orthogonalized vectors.

source Double3[]

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 source or destination is null.

ArgumentOutOfRangeException

Thrown when destination is shorter in length than source.

Orthonormalize(Double3[], params Double3[])

Orthonormalizes a list of vectors.

public static void Orthonormalize(Double3[] destination, params Double3[] source)

Parameters

destination Double3[]

The list of orthonormalized vectors.

source Double3[]

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 source or destination is null.

ArgumentOutOfRangeException

Thrown when destination is shorter in length than source.

Pow(double)

Raises the exponent for each components.

public void Pow(double exponent)

Parameters

exponent double

The 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

vector Double3

The vector to project.

x double

The X position of the viewport.

y double

The Y position of the viewport.

width double

The width of the viewport.

height double

The height of the viewport.

minZ double

The minimum depth of the viewport.

maxZ double

The maximum depth of the viewport.

worldViewProjection Matrix

The combined world-view-projection matrix.

Returns

Double3

The vector in screen space.

Project(ref readonly Double3, double, double, double, double, double, double, ref readonly Matrix, out Double3)

Projects a 3D vector from object space into screen space.

public static void Project(ref readonly Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, ref readonly Matrix worldViewProjection, out Double3 result)

Parameters

vector Double3

The vector to project.

x double

The X position of the viewport.

y double

The Y position of the viewport.

width double

The width of the viewport.

height double

The height of the viewport.

minZ double

The minimum depth of the viewport.

maxZ double

The maximum depth of the viewport.

worldViewProjection Matrix

The combined world-view-projection matrix.

result Double3

When 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

vector Double3

The source vector.

normal Double3

Normal of the surface.

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 readonly Double3, ref readonly Double3, out Double3)

Returns the reflection of a vector off a surface that has the specified normal.

public static void Reflect(ref readonly Double3 vector, ref readonly Double3 normal, out Double3 result)

Parameters

vector Double3

The source vector.

normal Double3

Normal of the surface.

result Double3

When 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

quaternion Quaternion

The input rotation as quaternion

Returns

Double3

The equivation yaw/pitch/roll rotation

RotationYawPitchRoll(ref readonly Quaternion, out Double3)

Calculate the yaw/pitch/roll rotation equivalent to the provided quaterion.

public static void RotationYawPitchRoll(ref readonly Quaternion quaternion, out Double3 yawPitchRoll)

Parameters

quaternion Quaternion

The input rotation as quaternion

yawPitchRoll Double3

The 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

start Double3

Start vector.

end Double3

End vector.

amount double

Value between 0 and 1 indicating the weight of end.

Returns

Double3

The cubic interpolation of the two vectors.

SmoothStep(ref readonly Double3, ref readonly Double3, double, out Double3)

Performs a cubic interpolation between two vectors.

public static void SmoothStep(ref readonly Double3 start, ref readonly Double3 end, double amount, out Double3 result)

Parameters

start Double3

Start vector.

end Double3

End vector.

amount double

Value between 0 and 1 indicating the weight of end.

result Double3

When 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

left Double3

The first vector to subtract.

right Double3

The second vector to subtract.

Returns

Double3

The difference of the two vectors.

Subtract(ref readonly Double3, ref readonly Double3, out Double3)

Subtracts two vectors.

public static void Subtract(ref readonly Double3 left, ref readonly Double3 right, out Double3 result)

Parameters

left Double3

The first vector to subtract.

right Double3

The second vector to subtract.

result Double3

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

double[]

A three-element array containing the components of the vector.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Transform(Double3, Matrix)

Transforms a 3D vector by the given Matrix.

public static Double4 Transform(Double3 vector, Matrix transform)

Parameters

vector Double3

The source vector.

transform Matrix

The transformation Matrix.

Returns

Double4

The transformed Double4.

Transform(Double3, Quaternion)

Transforms a 3D vector by the given Quaternion rotation.

public static Double3 Transform(Double3 vector, Quaternion rotation)

Parameters

vector Double3

The vector to rotate.

rotation Quaternion

The Quaternion rotation to apply.

Returns

Double3

The transformed Double4.

Transform(ref readonly Double3, ref readonly Matrix, out Double3)

Transforms a 3D vector by the given Matrix.

public static void Transform(ref readonly Double3 vector, ref readonly Matrix transform, out Double3 result)

Parameters

vector Double3

The source vector.

transform Matrix

The transformation Matrix.

result Double3

When the method completes, contains the transformed Double3.

Transform(ref readonly Double3, ref readonly Matrix, out Double4)

Transforms a 3D vector by the given Matrix.

public static void Transform(ref readonly Double3 vector, ref readonly Matrix transform, out Double4 result)

Parameters

vector Double3

The source vector.

transform Matrix

The transformation Matrix.

result Double4

When the method completes, contains the transformed Double4.

Transform(ref readonly Double3, ref readonly Quaternion, out Double3)

Transforms a 3D vector by the given Quaternion rotation.

public static void Transform(ref readonly Double3 vector, ref readonly Quaternion rotation, out Double3 result)

Parameters

vector Double3

The vector to rotate.

rotation Quaternion

The Quaternion rotation to apply.

result Double3

When the method completes, contains the transformed Double4.

Transform(Double3[], ref readonly Matrix, Double4[])

Transforms an array of 3D vectors by the given Matrix.

public static void Transform(Double3[] source, ref readonly Matrix transform, Double4[] destination)

Parameters

source Double3[]

The array of vectors to transform.

transform Matrix

The transformation Matrix.

destination Double4[]

The array for which the transformed vectors are stored.

Exceptions

ArgumentNullException

Thrown when source or destination is null.

ArgumentOutOfRangeException

Thrown when destination is shorter in length than source.

Transform(Double3[], ref readonly Quaternion, Double3[])

Transforms an array of vectors by the given Quaternion rotation.

public static void Transform(Double3[] source, ref readonly Quaternion rotation, Double3[] destination)

Parameters

source Double3[]

The array of vectors to transform.

rotation Quaternion

The Quaternion rotation to apply.

destination Double3[]

The array for which the transformed vectors are stored. This array may be the same array as source.

Exceptions

ArgumentNullException

Thrown when source or destination is null.

ArgumentOutOfRangeException

Thrown when destination is shorter in length than source.

TransformCoordinate(Double3, Matrix)

Performs a coordinate transformation using the given Matrix.

public static Double3 TransformCoordinate(Double3 coordinate, Matrix transform)

Parameters

coordinate Double3

The coordinate vector to transform.

transform Matrix

The transformation Matrix.

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 readonly Double3, ref readonly Matrix, out Double3)

Performs a coordinate transformation using the given Matrix.

public static void TransformCoordinate(ref readonly Double3 coordinate, ref readonly Matrix transform, out Double3 result)

Parameters

coordinate Double3

The coordinate vector to transform.

transform Matrix

The transformation Matrix.

result Double3

When 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 readonly Matrix, Double3[])

Performs a coordinate transformation on an array of vectors using the given Matrix.

public static void TransformCoordinate(Double3[] source, ref readonly Matrix transform, Double3[] destination)

Parameters

source Double3[]

The array of coordinate vectors to trasnform.

transform Matrix

The transformation Matrix.

destination Double3[]

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 source or destination is null.

ArgumentOutOfRangeException

Thrown when destination is shorter in length than source.

TransformNormal(Double3, Matrix)

Performs a normal transformation using the given Matrix.

public static Double3 TransformNormal(Double3 normal, Matrix transform)

Parameters

normal Double3

The normal vector to transform.

transform Matrix

The transformation Matrix.

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 readonly Double3, ref readonly Matrix, out Double3)

Performs a normal transformation using the given Matrix.

public static void TransformNormal(ref readonly Double3 normal, ref readonly Matrix transform, out Double3 result)

Parameters

normal Double3

The normal vector to transform.

transform Matrix

The transformation Matrix.

result Double3

When 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 readonly Matrix, Double3[])

Performs a normal transformation on an array of vectors using the given Matrix.

public static void TransformNormal(Double3[] source, ref readonly Matrix transform, Double3[] destination)

Parameters

source Double3[]

The array of normal vectors to transform.

transform Matrix

The transformation Matrix.

destination Double3[]

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 source or destination is null.

ArgumentOutOfRangeException

Thrown when destination is shorter in length than source.

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

vector Double3

The vector to project.

x double

The X position of the viewport.

y double

The Y position of the viewport.

width double

The width of the viewport.

height double

The height of the viewport.

minZ double

The minimum depth of the viewport.

maxZ double

The maximum depth of the viewport.

worldViewProjection Matrix

The combined world-view-projection matrix.

Returns

Double3

The vector in object space.

Unproject(ref readonly Double3, double, double, double, double, double, double, ref readonly Matrix, out Double3)

Projects a 3D vector from screen space into object space.

public static void Unproject(ref readonly Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, ref readonly Matrix worldViewProjection, out Double3 result)

Parameters

vector Double3

The vector to project.

x double

The X position of the viewport.

y double

The Y position of the viewport.

width double

The width of the viewport.

height double

The height of the viewport.

minZ double

The minimum depth of the viewport.

maxZ double

The maximum depth of the viewport.

worldViewProjection Matrix

The combined world-view-projection matrix.

result Double3

When 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

left Double3

The first vector to add.

right Double3

The second vector to add.

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

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

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

value Double3

The vector to scale.

by Double3

The by.

Returns

Double3

The scaled vector.

operator /(Double3, double)

Scales a vector by the given value.

public static Double3 operator /(Double3 value, double scale)

Parameters

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

Returns

Double3

The scaled vector.

operator /(double, Double3)

Divides a numerator by a vector.

public static Double3 operator /(double numerator, Double3 value)

Parameters

numerator double

The numerator.

value Double3

The value.

Returns

Double3

The scaled vector.

operator ==(Double3, Double3)

Tests for equality between two objects.

public static bool operator ==(Double3 left, Double3 right)

Parameters

left Double3

The first value to compare.

right Double3

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

explicit operator Double2(Double3)

Performs an explicit conversion from Double3 to Double2.

public static explicit operator Double2(Double3 value)

Parameters

value Double3

The value.

Returns

Double2

The result of the conversion.

explicit operator Double4(Double3)

Performs an explicit conversion from Double3 to Double4.

public static explicit operator Double4(Double3 value)

Parameters

value Double3

The value.

Returns

Double4

The result of the conversion.

explicit operator Half3(Double3)

Performs an explicit conversion from Double3 to Half3.

public static explicit operator Half3(Double3 value)

Parameters

value Double3

The value.

Returns

Half3

The result of the conversion.

explicit operator Vector3(Double3)

Performs an explicit conversion from Double3 to Vector3.

public static explicit operator Vector3(Double3 value)

Parameters

value Double3

The value.

Returns

Vector3

The result of the conversion.

explicit operator Double3(Half3)

Performs an explicit conversion from Half3 to Double3.

public static explicit operator Double3(Half3 value)

Parameters

value Half3

The value.

Returns

Double3

The result of the conversion.

implicit operator Double3(Vector3)

Performs an implicit conversion from Vector3 to Double3.

public static implicit operator Double3(Vector3 value)

Parameters

value Vector3

The 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

left Double3

The first value to compare.

right Double3

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.

operator *(Double3, Double3)

Modulates a vector with another by performing component-wise multiplication.

public static Double3 operator *(Double3 left, Double3 right)

Parameters

left Double3

The first vector to multiply.

right Double3

The second vector to multiply.

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

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

Returns

Double3

The scaled vector.

operator *(double, Double3)

Scales a vector by the given value.

public static Double3 operator *(double scale, Double3 value)

Parameters

scale double

The amount by which to scale the vector.

value Double3

The vector to scale.

Returns

Double3

The scaled vector.

operator -(Double3, Double3)

Subtracts two vectors.

public static Double3 operator -(Double3 left, Double3 right)

Parameters

left Double3

The first vector to subtract.

right Double3

The second vector to subtract.

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

value Double3

The vector to scale.

scale double

The amount by which to scale the vector.

Returns

Double3

The vector offset.

operator -(Double3)

Reverses the direction of a given vector.

public static Double3 operator -(Double3 value)

Parameters

value Double3

The 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

value Double3

The vector to assert (unchange).

Returns

Double3

The asserted (unchanged) vector.