DoubleVector3 (Struct)
Namespace: Wrld.Common.Maths
Representation of 3 component (3D) vector and points in double precision required for dealing with very large scale precision.
Fields
Name | Type | Description |
---|---|---|
zero | DoubleVector3 | Represents a zero vector with all 3 axes set to 0.0. |
one | DoubleVector3 | Represents a vector with all axes set to 1.0. |
x | double | x component of the vector, points right. |
y | double | y component of the vector, points up. |
z | double | z component of the vector, points forward. |
Methods
bool Equals (DoubleVector3 other)
Conjunction comparison with each respective element. This comparison does not use epsilon approximation.
Argument | Type | Description |
---|---|---|
other | DoubleVector3 | Vector to compare against. |
bool Equals (Object other)
Conjunction comparison with each respective element. This comparison does not use epsilon approximation.
Argument | Type | Description |
---|---|---|
other | Object | Vector to compare against. |
int GetHashCode ()
Returns the combined hash of all three internal x-y-z axes.
String ToString ()
Returns a string representation of the vector of the form x, y, z.
DoubleVector3 Min (DoubleVector3 a, DoubleVector3 b)
Constructs and returns a new vector with the minimum of each component. Eg: newX = Min(a.x, b.x)
Argument | Type | Description |
---|---|---|
a | DoubleVector3 | First vector. |
b | DoubleVector3 | Second vector. |
DoubleVector3 Max (DoubleVector3 a, DoubleVector3 b)
Constructs and returns a new vector with the maximum of each component. Eg: newX = Max(a.x, b.x)
Argument | Type | Description |
---|---|---|
a | DoubleVector3 | First vector. |
b | DoubleVector3 | Second vector. |
double Dot (DoubleVector3 a, DoubleVector3 b)
Calculates and returns the dot product of the two vectors.
Argument | Type | Description |
---|---|---|
a | DoubleVector3 | First vector. |
b | DoubleVector3 | Second vector. |
DoubleVector3 Cross (DoubleVector3 a, DoubleVector3 b)
Calculates and returns the cross product of the two vectors.
Argument | Type | Description |
---|---|---|
a | DoubleVector3 | First vector. |
b | DoubleVector3 | Second vector. |
DoubleVector3 Lerp (DoubleVector3 from, DoubleVector3 to, double time)
Calcualates and returns a new interpolated vector based on the time parameter.
Returns:
Argument | Type | Description |
---|---|---|
from | DoubleVector3 | Starting vector position. |
to | DoubleVector3 | Ending vector position. |
time | double | Current time to interpolate from. |
Properties
double magnitude
Calculates and returns the vector magnitude.
double magnitude { get; private set; }
double sqrMagnitude
Calculates and returns the square of the magnitude. Does not require calculating the square root.
double sqrMagnitude { get; private set; }
DoubleVector3 normalized
Returns the normalized version of the vector. Does not store this value.
DoubleVector3 normalized { get; private set; }