Class Double3
Represents a three dimensional mathematical vector.
Inheritance
Implements
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public sealed class Double3 : ValueType, IEquatable<Double3>, IFormattable
Constructors
Double3(Double2, Double)
Initializes a new instance of the Double3 struct.
Declaration
public Double3(Double2 value, double z)
Parameters
|
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. |
Double3(Double4)
Initializes a new instance of the Double3 struct.
Declaration
public Double3(Double4 value)
Parameters
|
Double4
value
A vector containing the values with which to initialize the X, Y and Z components. |
Double3(Float3)
Initializes a new instance of the Double3 struct.
Declaration
public Double3(Float3 value)
Parameters
|
Float3
value
A vector containing the values with which to initialize the X, Y and Z components. |
Double3(Vector3)
Initializes a new instance of the Double3 struct.
Declaration
public Double3(Vector3 value)
Parameters
|
Vector3
value
A vector containing the values with which to initialize the X, Y and Z components. |
Double3(Double)
Initializes a new instance of the Double3 struct.
Declaration
public Double3(double value)
Parameters
|
System.Double
value
The value that will be assigned to all components. |
Double3(Double, Double, Double)
Initializes a new instance of the Double3 struct.
Declaration
public Double3(double x, double y, double z)
Parameters
|
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. |
Double3(Double[])
Initializes a new instance of the Double3 struct.
Declaration
public Double3(double[] values)
Parameters
|
System.Double[]
values
The values to assign to the X, Y, and Z components of the vector. This must be an array with three elements. |
Exceptions
|
System.ArgumentNullException
Thrown when |
|
System.ArgumentOutOfRangeException
Thrown when |
Fields
Backward
A unit Double3 designating backward in a left-handed coordinate system (0, 0, -1).
Declaration
public static readonly Double3 Backward
Field Value
|
Double3
|
Down
A unit Double3 designating down (0, -1, 0).
Declaration
public static readonly Double3 Down
Field Value
|
Double3
|
Forward
A unit Double3 designating forward in a left-handed coordinate system (0, 0, 1).
Declaration
public static readonly Double3 Forward
Field Value
|
Double3
|
Half
A Double3 with all of its components set to half.
Declaration
public static readonly Double3 Half
Field Value
|
Double3
|
Left
A unit Double3 designating left (-1, 0, 0).
Declaration
public static readonly Double3 Left
Field Value
|
Double3
|
Maximum
A Double3 with all components equal to System.Double.MaxValue.
Declaration
public static readonly Double3 Maximum
Field Value
|
Double3
|
Minimum
A Double3 with all components equal to System.Double.MinValue.
Declaration
public static readonly Double3 Minimum
Field Value
|
Double3
|
One
A Double3 with all of its components set to one.
Declaration
public static readonly Double3 One
Field Value
|
Double3
|
Right
A unit Double3 designating right (1, 0, 0).
Declaration
public static readonly Double3 Right
Field Value
|
Double3
|
SizeInBytes
The size of the Double3 type, in bytes.
Declaration
public static readonly int SizeInBytes
Field Value
|
System.Int32
|
UnitX
UnitY
UnitZ
Up
A unit Double3 designating up (0, 1, 0).
Declaration
public static readonly Double3 Up
Field Value
|
Double3
|
X
The X component.
Declaration
public double X
Field Value
|
System.Double
|
Y
The Y component.
Declaration
public double Y
Field Value
|
System.Double
|
Z
The Z component.
Declaration
public double Z
Field Value
|
System.Double
|
Zero
A Double3 with all of its components set to zero.
Declaration
public static readonly Double3 Zero
Field Value
|
Double3
|
Properties
Absolute
Gets a vector with values being absolute values of that vector.
Declaration
public Double3 Absolute { get; }
Property Value
|
Double3
|
AvgValue
Gets an arithmetic average value of all vector components.
Declaration
public double AvgValue { get; }
Property Value
|
System.Double
|
Default
IsNormalized
Gets a value indicting whether this instance is normalized.
Declaration
public bool IsNormalized { get; }
Property Value
|
System.Boolean
|
IsOne
Gets a value indicting whether this vector is one
Declaration
public bool IsOne { get; }
Property Value
|
System.Boolean
|
IsZero
Gets a value indicting whether this vector is zero
Declaration
public bool IsZero { get; }
Property Value
|
System.Boolean
|
Item[Int32]
Gets or sets the component at the specified index.
Declaration
public double this[int index] { get; set; }
Parameters
|
System.Int32
index
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
|
System.Double
The value of the X, Y, or Z component, depending on the index. |
Exceptions
|
System.ArgumentOutOfRangeException
Thrown when the |
Length
Calculates the length of the vector.
Declaration
public double Length { get; }
Property Value
|
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.
Declaration
public double LengthSquared { get; }
Property Value
|
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.
MaxValue
Gets a maximum component value
Declaration
public double MaxValue { get; }
Property Value
|
System.Double
|
MinValue
Gets a minimum component value
Declaration
public double MinValue { get; }
Property Value
|
System.Double
|
Negative
Gets a vector with values being opposite to values of that vector.
Declaration
public Double3 Negative { get; }
Property Value
|
Double3
|
Normalized
Gets the normalized vector. Returned vector has length equal 1.
Declaration
public Double3 Normalized { get; }
Property Value
|
Double3
|
ValuesSum
Gets a sum of the component values.
Declaration
public double ValuesSum { get; }
Property Value
|
System.Double
|
Methods
Abs(Double3)
Returns the absolute value of a vector.
Declaration
public static Double3 Abs(Double3 v)
Parameters
|
Double3
v
The value. |
Returns
|
Double3
A vector which components are less or equal to 0. |
Add(Double3, Double3)
Adds two vectors.
Declaration
public static Double3 Add(Double3 left, Double3 right)
Parameters
|
Double3
left
The first vector to add. |
|
Double3
right
The second vector to add. |
Returns
|
Double3
The sum of the two vectors. |
Add(Double3, Double)
Performs a component-wise addition.
Declaration
public static Double3 Add(Double3 left, double right)
Parameters
|
Double3
left
The input vector |
|
System.Double
right
The scalar value to be added to elements |
Returns
|
Double3
The vector with added scalar for each element. |
Add(ref Double3, ref Double3, out Double3)
Adds two vectors.
Declaration
public static void Add(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
|
Double3
left
The first vector to add. |
|
Double3
right
The second vector to add. |
|
Double3
result
When the method completes, contains the sum of the two vectors. |
Add(ref Double3, ref Double, out Double3)
Performs a component-wise addition.
Declaration
public static void Add(ref Double3 left, ref double right, out Double3 result)
Parameters
|
Double3
left
The input vector |
|
System.Double
right
The scalar value to be added to elements |
|
Double3
result
The vector with added scalar for each element. |
Angle(Double3, Double3)
Calculates the angle (in degrees) between from and to. This is always the smallest value.
Declaration
public static double Angle(Double3 from, Double3 to)
Parameters
|
Double3
from
The first vector. |
|
Double3
to
The second vector. |
Returns
|
System.Double
The angle (in degrees). |
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.
Declaration
public static Double3 Barycentric(Double3 value1, Double3 value2, Double3 value3, double amount1, double amount2)
Parameters
|
Double3
value1
A Double3 containing the 3D Cartesian coordinates of vertex 1 of the triangle. |
|
Double3
value2
A Double3 containing the 3D Cartesian coordinates of vertex 2 of the triangle. |
|
Double3
value3
A Double3 containing the 3D 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
|
Double3
A new Double3 containing the 3D Cartesian coordinates of the specified point. |
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.
Declaration
public static void Barycentric(ref Double3 value1, ref Double3 value2, ref Double3 value3, double amount1, double amount2, out Double3 result)
Parameters
|
Double3
value1
A Double3 containing the 3D Cartesian coordinates of vertex 1 of the triangle. |
|
Double3
value2
A Double3 containing the 3D Cartesian coordinates of vertex 2 of the triangle. |
|
Double3
value3
A Double3 containing the 3D 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 |
|
Double3
result
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.
Declaration
public static Double3 CatmullRom(Double3 value1, Double3 value2, Double3 value3, Double3 value4, double amount)
Parameters
|
Double3
value1
The first position in the interpolation. |
|
Double3
value2
The second position in the interpolation. |
|
Double3
value3
The third position in the interpolation. |
|
Double3
value4
The fourth position in the interpolation. |
|
System.Double
amount
Weighting 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.
Declaration
public static void CatmullRom(ref Double3 value1, ref Double3 value2, ref Double3 value3, ref Double3 value4, double amount, out Double3 result)
Parameters
|
Double3
value1
The first position in the interpolation. |
|
Double3
value2
The second position in the interpolation. |
|
Double3
value3
The third position in the interpolation. |
|
Double3
value4
The fourth position in the interpolation. |
|
System.Double
amount
Weighting factor. |
|
Double3
result
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.
Declaration
public static Double3 Clamp(Double3 value, Double3 min, Double3 max)
Parameters
|
Double3
value
The value to clamp. |
|
Double3
min
The minimum value. |
|
Double3
max
The maximum value. |
Returns
|
Double3
The clamped value. |
Clamp(ref Double3, ref Double3, ref Double3, out Double3)
Restricts a value to be within a specified range.
Declaration
public static void Clamp(ref Double3 value, ref Double3 min, ref Double3 max, out Double3 result)
Parameters
|
Double3
value
The value to clamp. |
|
Double3
min
The minimum value. |
|
Double3
max
The maximum value. |
|
Double3
result
When the method completes, contains the clamped value. |
ClampLength(Double3, Double)
Makes sure that Length of the output vector is always below max and above 0.
Declaration
public static Double3 ClampLength(Double3 vector, double max)
Parameters
|
Double3
vector
Input Vector. |
|
System.Double
max
Max Length |
Returns
|
Double3
|
ClampLength(Double3, Double, Double)
Makes sure that Length of the output vector is always below max and above min.
Declaration
public static Double3 ClampLength(Double3 vector, double min, double max)
Parameters
|
Double3
vector
Input Vector. |
|
System.Double
min
Min Length |
|
System.Double
max
Max Length |
Returns
|
Double3
|
ClampLength(Double3, Double, Double, out Double3)
Makes sure that Length of the output vector is always below max and above min.
Declaration
public static void ClampLength(Double3 vector, double min, double max, out Double3 result)
Parameters
|
Double3
vector
Input Vector. |
|
System.Double
min
Min Length |
|
System.Double
max
Max Length |
|
Double3
result
The result vector. |
Cross(Double3, Double3)
Calculates the cross product of two vectors.
Declaration
public static Double3 Cross(Double3 left, Double3 right)
Parameters
|
Double3
left
First source vector. |
|
Double3
right
Second source vector. |
Returns
|
Double3
The cross product of the two vectors. |
Cross(ref Double3, ref Double3, out Double3)
Calculates the cross product of two vectors.
Declaration
public static void Cross(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
|
Double3
left
First source vector. |
|
Double3
right
Second source vector. |
|
Double3
result
When the method completes, contains he cross product of the two vectors. |
Distance(Double3, Double3)
Calculates the distance between two vectors.
Declaration
public static double Distance(Double3 value1, Double3 value2)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
Returns
|
System.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)
Calculates the distance between two vectors.
Declaration
public static double Distance(ref Double3 value1, ref Double3 value2)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
Returns
|
System.Double
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.
Distance(ref Double3, ref Double3, out Double)
Calculates the distance between two vectors.
Declaration
public static void Distance(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
|
System.Double
result
When 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.
Declaration
public static double DistanceSquared(Double3 value1, Double3 value2)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
Returns
|
System.Double
The squared distance between the two vectors. |
DistanceSquared(ref Double3, ref Double3)
Calculates the squared distance between two vectors.
Declaration
public static double DistanceSquared(ref Double3 value1, ref Double3 value2)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
Returns
|
System.Double
The squared distance between the two vectors. |
DistanceSquared(ref Double3, ref Double3, out Double)
Calculates the squared distance between two vectors.
Declaration
public static void DistanceSquared(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
|
System.Double
result
When the method completes, contains the squared distance between the two vectors. |
DistanceXY(ref Double3, ref Double3, out Double)
Calculates the distance between two vectors on the XY plane (ignoring Z).
Declaration
public static void DistanceXY(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
|
System.Double
result
When the method completes, contains the distance between the two vectors in the XY plane. |
DistanceXYSquared(ref Double3, ref Double3, out Double)
Calculates the squared distance between two vectors on the XY plane (ignoring Z).
Declaration
public static void DistanceXYSquared(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector |
|
System.Double
result
When the method completes, contains the squared distance between the two vectors in the XY plane. |
DistanceXZ(ref Double3, ref Double3, out Double)
Calculates the distance between two vectors on the XZ plane (ignoring Y).
Declaration
public static void DistanceXZ(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
|
System.Double
result
When the method completes, contains the distance between the two vectors in the XY plane. |
DistanceXZSquared(ref Double3, ref Double3, out Double)
Calculates the squared distance between two vectors on the XZ plane (ignoring Y).
Declaration
public static void DistanceXZSquared(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector |
|
System.Double
result
When the method completes, contains the squared distance between the two vectors in the XY plane. |
DistanceYZ(ref Double3, ref Double3, out Double)
Calculates the distance between two vectors on the YZ plane (ignoring X).
Declaration
public static void DistanceYZ(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector. |
|
System.Double
result
When the method completes, contains the distance between the two vectors in the YZ plane. |
DistanceYZSquared(ref Double3, ref Double3, out Double)
Calculates the squared distance between two vectors on the YZ plane (ignoring X).
Declaration
public static void DistanceYZSquared(ref Double3 value1, ref Double3 value2, out double result)
Parameters
|
Double3
value1
The first vector. |
|
Double3
value2
The second vector |
|
System.Double
result
When the method completes, contains the squared distance between the two vectors in the YZ plane. |
Divide(Double3, Double3)
Divides a vector by the given value.
Declaration
public static Double3 Divide(Double3 value, Double3 scale)
Parameters
|
Double3
value
The vector to scale. |
|
Double3
scale
The amount by which to scale the vector (per component). |
Returns
|
Double3
The divided vector. |
Divide(Double3, Double)
Scales a vector by the given value.
Declaration
public static Double3 Divide(Double3 value, double scale)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
Returns
|
Double3
The scaled vector. |
Divide(ref Double3, ref Double3, out Double3)
Divides a vector by the given value.
Declaration
public static void Divide(ref Double3 value, ref Double3 scale, out Double3 result)
Parameters
|
Double3
value
The vector to scale. |
|
Double3
scale
The amount by which to scale the vector (per component). |
|
Double3
result
When the method completes, contains the divided vector. |
Divide(ref Double3, Double, out Double3)
Scales a vector by the given value.
Declaration
public static void Divide(ref Double3 value, double scale, out Double3 result)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
|
Double3
result
When the method completes, contains the scaled vector. |
Divide(Double, Double3)
Scales a vector by the given value.
Declaration
public static Double3 Divide(double scale, Double3 value)
Parameters
|
System.Double
scale
The amount by which to scale the vector. |
|
Double3
value
The vector to scale. |
Returns
|
Double3
The scaled vector. |
Divide(Double, ref Double3, out Double3)
Scales a vector by the given value.
Declaration
public static void Divide(double scale, ref Double3 value, out Double3 result)
Parameters
|
System.Double
scale
The amount by which to scale the vector. |
|
Double3
value
The vector to scale. |
|
Double3
result
When the method completes, contains the scaled vector. |
Dot(Double3, Double3)
Calculates the dot product of two vectors.
Declaration
public static double Dot(Double3 left, Double3 right)
Parameters
|
Double3
left
First source vector. |
|
Double3
right
Second source vector. |
Returns
|
System.Double
The dot product of the two vectors. |
Dot(ref Double3, ref Double3)
Calculates the dot product of two vectors.
Declaration
public static double Dot(ref Double3 left, ref Double3 right)
Parameters
|
Double3
left
First source vector. |
|
Double3
right
Second source vector. |
Returns
|
System.Double
The dot product of the two vectors. |
Dot(ref Double3, ref Double3, out Double)
Calculates the dot product of two vectors.
Declaration
public static void Dot(ref Double3 left, ref Double3 right, out double result)
Parameters
|
Double3
left
First source vector. |
|
Double3
right
Second source vector. |
|
System.Double
result
When the method completes, contains the dot product of the two vectors. |
Equals(Double3)
Determines whether the specified Double3 is equal to this instance.
Declaration
public bool Equals(Double3 other)
Parameters
|
Double3
other
The Double3 to compare with this instance. |
Returns
|
System.Boolean
|
Equals(ref Double3)
Determines whether the specified Double3 is equal to this instance.
Declaration
public bool Equals(ref Double3 other)
Parameters
|
Double3
other
The Double3 to compare with this instance. |
Returns
|
System.Boolean
|
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object value)
Parameters
|
System.Object
value
The System.Object to compare with this instance. |
Returns
|
System.Boolean
|
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
|
System.Int32
|
Hermite(Double3, Double3, Double3, Double3, Double)
Performs a Hermite spline interpolation.
Declaration
public static Double3 Hermite(Double3 value1, Double3 tangent1, Double3 value2, Double3 tangent2, double amount)
Parameters
|
Double3
value1
First source position vector. |
|
Double3
tangent1
First source tangent vector. |
|
Double3
value2
Second source position vector. |
|
Double3
tangent2
Second source tangent vector. |
|
System.Double
amount
Weighting 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.
Declaration
public static void Hermite(ref Double3 value1, ref Double3 tangent1, ref Double3 value2, ref Double3 tangent2, double amount, out Double3 result)
Parameters
|
Double3
value1
First source position vector. |
|
Double3
tangent1
First source tangent vector. |
|
Double3
value2
Second source position vector. |
|
Double3
tangent2
Second source tangent vector. |
|
System.Double
amount
Weighting factor. |
|
Double3
result
When the method completes, contains the result of the Hermite spline interpolation. |
Lerp(Double3, Double3, Double)
Performs a linear interpolation between two vectors.
Declaration
public static Double3 Lerp(Double3 start, Double3 end, double amount)
Parameters
|
Double3
start
Start vector. |
|
Double3
end
End vector. |
|
System.Double
amount
Value between 0 and 1 indicating the weight of |
Returns
|
Double3
The linear interpolation of the two vectors. |
Remarks
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.
Declaration
public static void Lerp(ref Double3 start, ref Double3 end, double amount, out Double3 result)
Parameters
|
Double3
start
Start vector. |
|
Double3
end
End vector. |
|
System.Double
amount
Value between 0 and 1 indicating the weight of |
|
Double3
result
When the method completes, contains the linear interpolation of the two vectors. |
Remarks
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.
Declaration
public static Double3 Max(Double3 left, Double3 right)
Parameters
|
Double3
left
The first source vector. |
|
Double3
right
The second source vector. |
Returns
|
Double3
A vector containing the largest components of the source vectors. |
Max(ref Double3, ref Double3, out Double3)
Returns a vector containing the largest components of the specified vectors.
Declaration
public static void Max(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
|
Double3
left
The first source vector. |
|
Double3
right
The second source vector. |
|
Double3
result
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.
Declaration
public static Double3 Min(Double3 left, Double3 right)
Parameters
|
Double3
left
The first source vector. |
|
Double3
right
The second source vector. |
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.
Declaration
public static void Min(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
|
Double3
left
The first source vector. |
|
Double3
right
The second source vector. |
|
Double3
result
When the method completes, contains an new vector composed of the smallest components of the source vectors. |
MoveTowards(Double3, Double3, Double)
Moves a value current towards target.
Declaration
public static Double3 MoveTowards(Double3 current, Double3 target, double maxDistanceDelta)
Parameters
|
Double3
current
The position to move from. |
|
Double3
target
The position to move towards. |
|
System.Double
maxDistanceDelta
The maximum distance that can be applied to the value. |
Returns
|
Double3
The new position. |
Multiply(Double3, Double3)
Multiply a vector with another by performing component-wise multiplication.
Declaration
public static Double3 Multiply(Double3 left, Double3 right)
Parameters
|
Double3
left
The first vector to Multiply. |
|
Double3
right
The second vector to multiply. |
Returns
|
Double3
The multiplied vector. |
Multiply(Double3, Double)
Scales a vector by the given value.
Declaration
public static Double3 Multiply(Double3 value, double scale)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
Returns
|
Double3
The scaled vector. |
Multiply(ref Double3, ref Double3, out Double3)
Multiply a vector with another by performing component-wise multiplication.
Declaration
public static void Multiply(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
|
Double3
left
The first vector to multiply. |
|
Double3
right
The second vector to multiply. |
|
Double3
result
When the method completes, contains the multiplied vector. |
Multiply(ref Double3, Double, out Double3)
Scales a vector by the given value.
Declaration
public static void Multiply(ref Double3 value, double scale, out Double3 result)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
|
Double3
result
When the method completes, contains the scaled vector. |
NearEqual(Double3, Double3, Double)
Tests whether one vector is near another vector.
Declaration
public static bool NearEqual(Double3 left, Double3 right, double epsilon = 1E-16)
Parameters
|
Double3
left
The left vector. |
|
Double3
right
The right vector. |
|
System.Double
epsilon
The epsilon. |
Returns
|
System.Boolean
|
NearEqual(ref Double3, ref Double3, Double)
Tests whether one vector is near another vector.
Declaration
public static bool NearEqual(ref Double3 left, ref Double3 right, double epsilon = 1E-16)
Parameters
|
Double3
left
The left vector. |
|
Double3
right
The right vector. |
|
System.Double
epsilon
The epsilon. |
Returns
|
System.Boolean
|
Negate(Double3)
Reverses the direction of a given vector.
Declaration
public static Double3 Negate(Double3 value)
Parameters
|
Double3
value
The vector to negate. |
Returns
|
Double3
A vector facing in the opposite direction. |
Negate(ref Double3, out Double3)
Reverses the direction of a given vector.
Declaration
public static void Negate(ref Double3 value, out Double3 result)
Parameters
|
Double3
value
The vector to negate. |
|
Double3
result
When the method completes, contains a vector facing in the opposite direction. |
Normalize()
Converts the vector into a unit vector.
Declaration
public void Normalize()
Normalize(Double3)
Converts the vector into a unit vector.
Declaration
public static Double3 Normalize(Double3 value)
Parameters
|
Double3
value
The vector to normalize. |
Returns
|
Double3
The normalized vector. |
Normalize(ref Double3, out Double3)
Converts the vector into a unit vector.
Declaration
public static void Normalize(ref Double3 value, out Double3 result)
Parameters
|
Double3
value
The vector to normalize. |
|
Double3
result
When the method completes, contains the normalized vector. |
Project(Double3, Double3)
Projects a vector onto another vector.
Declaration
public static Double3 Project(Double3 vector, Double3 onNormal)
Parameters
|
Double3
vector
The vector to project. |
|
Double3
onNormal
The projection normal vector. |
Returns
|
Double3
The projected vector. |
Project(Double3, Double, Double, Double, Double, Double, Double, Matrix)
Projects a 3D vector from object space into screen space.
Declaration
public static Double3 Project(Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, Matrix worldViewProjection)
Parameters
|
Double3
vector
The vector to project. |
|
System.Double
x
The X position of the viewport. |
|
System.Double
y
The Y position of the viewport. |
|
System.Double
width
The width of the viewport. |
|
System.Double
height
The height of the viewport. |
|
System.Double
minZ
The minimum depth of the viewport. |
|
System.Double
maxZ
The maximum depth of the viewport. |
|
Matrix
worldViewProjection
The 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.
Declaration
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
|
Double3
vector
The vector to project. |
|
System.Double
x
The X position of the viewport. |
|
System.Double
y
The Y position of the viewport. |
|
System.Double
width
The width of the viewport. |
|
System.Double
height
The height of the viewport. |
|
System.Double
minZ
The minimum depth of the viewport. |
|
System.Double
maxZ
The maximum depth of the viewport. |
|
Matrix
worldViewProjection
The combined world-view-projection matrix. |
|
Double3
result
When the method completes, contains the vector in screen space. |
ProjectOnPlane(Double3, Double3)
Projects a vector onto a plane defined by a normal orthogonal to the plane.
Declaration
public static Double3 ProjectOnPlane(Double3 vector, Double3 planeNormal)
Parameters
|
Double3
vector
The vector to project. |
|
Double3
planeNormal
The plane normal vector. |
Returns
|
Double3
The projected vector. |
Reflect(Double3, Double3)
Returns the reflection of a vector off a surface that has the specified normal.
Declaration
public static Double3 Reflect(Double3 vector, Double3 normal)
Parameters
|
Double3
vector
The source vector. |
|
Double3
normal
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 Double3, ref Double3, out Double3)
Returns the reflection of a vector off a surface that has the specified normal.
Declaration
public static void Reflect(ref Double3 vector, ref Double3 normal, out Double3 result)
Parameters
|
Double3
vector
The source vector. |
|
Double3
normal
Normal of the surface. |
|
Double3
result
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.
SmoothStep(Double3, Double3, Double)
Performs a cubic interpolation between two vectors.
Declaration
public static Double3 SmoothStep(Double3 start, Double3 end, double amount)
Parameters
|
Double3
start
Start vector. |
|
Double3
end
End vector. |
|
System.Double
amount
Value between 0 and 1 indicating the weight of |
Returns
|
Double3
The cubic interpolation of the two vectors. |
SmoothStep(ref Double3, ref Double3, Double, out Double3)
Performs a cubic interpolation between two vectors.
Declaration
public static void SmoothStep(ref Double3 start, ref Double3 end, double amount, out Double3 result)
Parameters
|
Double3
start
Start vector. |
|
Double3
end
End vector. |
|
System.Double
amount
Value between 0 and 1 indicating the weight of |
|
Double3
result
When the method completes, contains the cubic interpolation of the two vectors. |
SnapToGrid(Double3, Double3)
Snaps the input position into the grid.
Declaration
public static Double3 SnapToGrid(Double3 pos, Double3 gridSize)
Parameters
|
Double3
pos
The position to snap. |
|
Double3
gridSize
The size of the grid. |
Returns
|
Double3
The position snapped to the grid. |
Subtract(Double3, Double3)
Subtracts two vectors.
Declaration
public static Double3 Subtract(Double3 left, Double3 right)
Parameters
|
Double3
left
The first vector to subtract. |
|
Double3
right
The second vector to subtract. |
Returns
|
Double3
The difference of the two vectors. |
Subtract(Double3, Double)
Performs a component-wise subtraction.
Declaration
public static Double3 Subtract(Double3 left, double right)
Parameters
|
Double3
left
The input vector |
|
System.Double
right
The scalar value to be subtracted from elements |
Returns
|
Double3
The vector with subtracted scalar for each element. |
Subtract(ref Double3, ref Double3, out Double3)
Subtracts two vectors.
Declaration
public static void Subtract(ref Double3 left, ref Double3 right, out Double3 result)
Parameters
|
Double3
left
The first vector to subtract. |
|
Double3
right
The second vector to subtract. |
|
Double3
result
When the method completes, contains the difference of the two vectors. |
Subtract(ref Double3, ref Double, out Double3)
Performs a component-wise subtraction.
Declaration
public static void Subtract(ref Double3 left, ref double right, out Double3 result)
Parameters
|
Double3
left
The input vector |
|
System.Double
right
The scalar value to be subtracted from elements |
|
Double3
result
The vector with subtracted scalar for each element. |
Subtract(Double, Double3)
Performs a component-wise subtraction.
Declaration
public static Double3 Subtract(double left, Double3 right)
Parameters
|
System.Double
left
The scalar value to be subtracted from elements |
|
Double3
right
The input vector. |
Returns
|
Double3
The vector with subtracted scalar for each element. |
Subtract(ref Double, ref Double3, out Double3)
Performs a component-wise subtraction.
Declaration
public static void Subtract(ref double left, ref Double3 right, out Double3 result)
Parameters
|
System.Double
left
The scalar value to be subtracted from elements |
|
Double3
right
The input vector. |
|
Double3
result
The vector with subtracted scalar for each element. |
ToArray()
Creates an array containing the elements of the vector.
Declaration
public double[] ToArray()
Returns
|
System.Double[]
A three-element array containing the components of the vector. |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
|
System.String
A System.String that represents this instance. |
ToString(IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
|
System.IFormatProvider
formatProvider
The format provider. |
Returns
|
System.String
A System.String that represents this instance. |
ToString(String)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format)
Parameters
|
System.String
format
The format. |
Returns
|
System.String
A System.String that represents this instance. |
ToString(String, IFormatProvider)
Returns a System.String that represents this instance.
Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
|
System.String
format
The format. |
|
System.IFormatProvider
formatProvider
The format provider. |
Returns
|
System.String
A System.String that represents this instance. |
Transform(Double3, Matrix)
Transforms a 3D vector by the given Matrix.
Declaration
public static Double3 Transform(Double3 vector, Matrix transform)
Parameters
|
Double3
vector
The source vector. |
|
Matrix
transform
The transformation Matrix. |
Returns
|
Double3
The transformed Double4. |
Transform(Double3, Matrix3x3)
Transforms a 3D vector by the given Matrix3x3.
Declaration
public static Double3 Transform(Double3 vector, Matrix3x3 transform)
Parameters
|
Double3
vector
The source vector. |
|
Matrix3x3
transform
The transformation Matrix3x3. |
Returns
|
Double3
The transformed Double3. |
Transform(Double3, Quaternion)
Transforms a 3D vector by the given Quaternion rotation.
Declaration
public static Double3 Transform(Double3 vector, Quaternion rotation)
Parameters
|
Double3
vector
The vector to rotate. |
|
Quaternion
rotation
The Quaternion rotation to apply. |
Returns
|
Double3
The transformed Double3. |
Transform(ref Double3, ref Matrix, out Double3)
Transforms a 3D vector by the given Matrix.
Declaration
public static void Transform(ref Double3 vector, ref Matrix transform, out Double3 result)
Parameters
|
Double3
vector
The source vector. |
|
Matrix
transform
The transformation Matrix. |
|
Double3
result
When the method completes, contains the transformed Double3. |
Transform(ref Double3, ref Matrix, out Double4)
Transforms a 3D vector by the given Matrix.
Declaration
public static void Transform(ref Double3 vector, ref Matrix transform, out Double4 result)
Parameters
|
Double3
vector
The source vector. |
|
Matrix
transform
The transformation Matrix. |
|
Double4
result
When the method completes, contains the transformed Double4. |
Transform(ref Double3, ref Matrix3x3, out Double3)
Transforms a 3D vector by the given Matrix3x3.
Declaration
public static void Transform(ref Double3 vector, ref Matrix3x3 transform, out Double3 result)
Parameters
|
Double3
vector
The source vector. |
|
Matrix3x3
transform
The transformation Matrix3x3. |
|
Double3
result
When the method completes, contains the transformed Double3. |
Transform(ref Double3, ref Quaternion, out Double3)
Transforms a 3D vector by the given Quaternion rotation.
Declaration
public static void Transform(ref Double3 vector, ref Quaternion rotation, out Double3 result)
Parameters
|
Double3
vector
The vector to rotate. |
|
Quaternion
rotation
The Quaternion rotation to apply. |
|
Double3
result
When the method completes, contains the transformed Double3. |
TransformCoordinate(Double3, Matrix)
Performs a coordinate transformation using the given Matrix.
Declaration
public static Double3 TransformCoordinate(Double3 coordinate, Matrix transform)
Parameters
|
Double3
coordinate
The coordinate vector to transform. |
|
Matrix
transform
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 w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred 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.
Declaration
public static void TransformCoordinate(ref Double3 coordinate, ref Matrix transform, out Double3 result)
Parameters
|
Double3
coordinate
The coordinate vector to transform. |
|
Matrix
transform
The transformation Matrix. |
|
Double3
result
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 w component to be one and therefore makes the vector homogeneous. The homogeneous vector is often preferred when working with coordinates as the w component can safely be ignored.
TransformNormal(Double3, Matrix)
Performs a normal transformation using the given Matrix.
Declaration
public static Double3 TransformNormal(Double3 normal, Matrix transform)
Parameters
|
Double3
normal
The normal vector to transform. |
|
Matrix
transform
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 column 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 preferred 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.
Declaration
public static void TransformNormal(ref Double3 normal, ref Matrix transform, out Double3 result)
Parameters
|
Double3
normal
The normal vector to transform. |
|
Matrix
transform
The transformation Matrix. |
|
Double3
result
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 column 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 preferred for normal vectors as normals purely represent direction rather than location because normal vectors should not be translated.
Unproject(Double3, Double, Double, Double, Double, Double, Double, Matrix)
Projects a 3D vector from screen space into object space.
Declaration
public static Double3 Unproject(Double3 vector, double x, double y, double width, double height, double minZ, double maxZ, Matrix worldViewProjection)
Parameters
|
Double3
vector
The vector to project. |
|
System.Double
x
The X position of the viewport. |
|
System.Double
y
The Y position of the viewport. |
|
System.Double
width
The width of the viewport. |
|
System.Double
height
The height of the viewport. |
|
System.Double
minZ
The minimum depth of the viewport. |
|
System.Double
maxZ
The maximum depth of the viewport. |
|
Matrix
worldViewProjection
The 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.
Declaration
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
|
Double3
vector
The vector to project. |
|
System.Double
x
The X position of the viewport. |
|
System.Double
y
The Y position of the viewport. |
|
System.Double
width
The width of the viewport. |
|
System.Double
height
The height of the viewport. |
|
System.Double
minZ
The minimum depth of the viewport. |
|
System.Double
maxZ
The maximum depth of the viewport. |
|
Matrix
worldViewProjection
The combined world-view-projection matrix. |
|
Double3
result
When the method completes, contains the vector in object space. |
UnwindEuler()
When this vector contains Euler angles (degrees), ensure that angles are between +/-180
Declaration
public void UnwindEuler()
Operators
Addition(Double3, Double3)
Adds two vectors.
Declaration
public static Double3 operator +(Double3 left, Double3 right)
Parameters
|
Double3
left
The first vector to add. |
|
Double3
right
The second vector to add. |
Returns
|
Double3
The sum of the two vectors. |
Addition(Double3, Double)
Performs a component-wise addition.
Declaration
public static Double3 operator +(Double3 value, double scalar)
Parameters
|
Double3
value
The input vector. |
|
System.Double
scalar
The scalar value to be added on elements |
Returns
|
Double3
The vector with added scalar for each element. |
Addition(Double, Double3)
Performs a component-wise addition.
Declaration
public static Double3 operator +(double scalar, Double3 value)
Parameters
|
System.Double
scalar
The scalar value to be added on elements |
|
Double3
value
The input vector. |
Returns
|
Double3
The vector with added scalar for each element. |
Division(Double3, Double3)
Scales a vector by the given value.
Declaration
public static Double3 operator /(Double3 value, Double3 scale)
Parameters
|
Double3
value
The vector to scale. |
|
Double3
scale
The amount by which to scale the vector. |
Returns
|
Double3
The scaled vector. |
Division(Double3, Double)
Scales a vector by the given value.
Declaration
public static Double3 operator /(Double3 value, double scale)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
Returns
|
Double3
The scaled vector. |
Division(Double, Double3)
Scales a vector by the given value.
Declaration
public static Double3 operator /(double scale, Double3 value)
Parameters
|
System.Double
scale
The amount by which to scale the vector. |
|
Double3
value
The vector to scale. |
Returns
|
Double3
The scaled vector. |
Equality(Double3, Double3)
Tests for equality between two objects.
Declaration
public static bool operator ==(Double3 left, Double3 right)
Parameters
|
Double3
left
The first value to compare. |
|
Double3
right
The second value to compare. |
Returns
|
System.Boolean
|
Explicit(Double3 to Double2)
Declaration
public static explicit operator Double2(Double3 value)
Parameters
|
Double3
value
The value. |
Returns
|
Double2
The result of the conversion. |
Explicit(Double3 to Double4)
Declaration
public static explicit operator Double4(Double3 value)
Parameters
|
Double3
value
The value. |
Returns
|
Double4
The result of the conversion. |
Implicit(Double3 to Float3)
Declaration
public static implicit operator Float3(Double3 value)
Parameters
|
Double3
value
The value. |
Returns
|
Float3
The result of the conversion. |
Implicit(Double3 to Vector3)
Declaration
public static implicit operator Vector3(Double3 value)
Parameters
|
Double3
value
The value. |
Returns
|
Vector3
The result of the conversion. |
Inequality(Double3, Double3)
Tests for inequality between two objects.
Declaration
public static bool operator !=(Double3 left, Double3 right)
Parameters
|
Double3
left
The first value to compare. |
|
Double3
right
The second value to compare. |
Returns
|
System.Boolean
|
Modulus(Double3, Double3)
Remainder of value divided by scale.
Declaration
public static Double3 operator %(Double3 value, Double3 scale)
Parameters
|
Double3
value
The vector to scale. |
|
Double3
scale
The amount by which to scale the vector. |
Returns
|
Double3
The remained vector. |
Modulus(Double3, Double)
Remainder of value divided by scale.
Declaration
public static Double3 operator %(Double3 value, double scale)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
Returns
|
Double3
The remained vector. |
Modulus(Double, Double3)
Remainder of value divided by scale.
Declaration
public static Double3 operator %(double value, Double3 scale)
Parameters
|
System.Double
value
The amount by which to scale the vector. |
|
Double3
scale
The vector to scale. |
Returns
|
Double3
The remained vector. |
Multiply(Double3, Double3)
Multiplies a vector with another by performing component-wise multiplication equivalent to Multiply(ref Double3, ref Double3, out Double3).
Declaration
public static Double3 operator *(Double3 left, Double3 right)
Parameters
|
Double3
left
The first vector to multiply. |
|
Double3
right
The second vector to multiply. |
Returns
|
Double3
The multiplication of the two vectors. |
Multiply(Double3, Quaternion)
Transforms a vector by the given rotation.
Declaration
public static Double3 operator *(Double3 vector, Quaternion rotation)
Parameters
|
Double3
vector
The vector to transform. |
|
Quaternion
rotation
The quaternion. |
Returns
|
Double3
The scaled vector. |
Multiply(Double3, Double)
Scales a vector by the given value.
Declaration
public static Double3 operator *(Double3 value, double scale)
Parameters
|
Double3
value
The vector to scale. |
|
System.Double
scale
The amount by which to scale the vector. |
Returns
|
Double3
The scaled vector. |
Multiply(Double, Double3)
Scales a vector by the given value.
Declaration
public static Double3 operator *(double scale, Double3 value)
Parameters
|
System.Double
scale
The amount by which to scale the vector. |
|
Double3
value
The vector to scale. |
Returns
|
Double3
The scaled vector. |
Subtraction(Double3, Double3)
Subtracts two vectors.
Declaration
public static Double3 operator -(Double3 left, Double3 right)
Parameters
|
Double3
left
The first vector to subtract. |
|
Double3
right
The second vector to subtract. |
Returns
|
Double3
The difference of the two vectors. |
Subtraction(Double3, Double)
Performs a component-wise subtraction.
Declaration
public static Double3 operator -(Double3 value, double scalar)
Parameters
|
Double3
value
The input vector. |
|
System.Double
scalar
The scalar value to be subtracted from elements |
Returns
|
Double3
The vector with added scalar from each element. |
Subtraction(Double, Double3)
Performs a component-wise subtraction.
Declaration
public static Double3 operator -(double scalar, Double3 value)
Parameters
|
System.Double
scalar
The scalar value to be subtracted from elements |
|
Double3
value
The input vector. |
Returns
|
Double3
The vector with subtracted scalar from each element. |
UnaryNegation(Double3)
Reverses the direction of a given vector.
Declaration
public static Double3 operator -(Double3 value)
Parameters
|
Double3
value
The vector to negate. |
Returns
|
Double3
A vector facing in the opposite direction. |
UnaryPlus(Double3)
Assert a vector (return it unchanged).
Declaration
public static Double3 operator +(Double3 value)
Parameters
|
Double3
value
The vector to assert (unchanged). |
Returns
|
Double3
The asserted (unchanged) vector. |