A double precision 3D vector. More...

Public Member Functions | |
Vector3d (double value) | |
Creates a new vector with one value for all components. | |
Vector3d (double x, double y, double z) | |
Creates a new vector. | |
Vector3d (Vector3 vector) | |
Creates a new vector from a single precision vector. | |
void | Set (double x, double y, double z) |
Set x, y and z components of an existing vector. | |
void | Scale (ref Vector3d scale) |
Multiplies with another vector component-wise. | |
void | Normalize () |
Normalizes this vector. | |
void | Clamp (double min, double max) |
Clamps this vector between a specific range. | |
override int | GetHashCode () |
Returns a hash code for this vector. | |
override bool | Equals (object other) |
Returns if this vector is equal to another one. | |
bool | Equals (Vector3d other) |
Returns if this vector is equal to another one. | |
override string | ToString () |
Returns a nicely formatted string for this vector. | |
string | ToString (string format) |
Returns a nicely formatted string for this vector. | |
Static Public Member Functions | |
static Vector3d | operator+ (Vector3d a, Vector3d b) |
Adds two vectors. | |
static Vector3d | operator- (Vector3d a, Vector3d b) |
Subtracts two vectors. | |
static Vector3d | operator* (Vector3d a, double d) |
Scales the vector uniformly. | |
static Vector3d | operator* (double d, Vector3d a) |
Scales the vector uniformly. | |
static Vector3d | operator/ (Vector3d a, double d) |
Divides the vector with a float. | |
static Vector3d | operator- (Vector3d a) |
Subtracts the vector from a zero vector. | |
static bool | operator== (Vector3d lhs, Vector3d rhs) |
Returns if two vectors equals eachother. | |
static bool | operator!= (Vector3d lhs, Vector3d rhs) |
Returns if two vectors don't equal eachother. | |
static implicit | operator Vector3d (Vector3 v) |
Implicitly converts from a single-precision vector into a double-precision vector. | |
static | operator Vector3 (Vector3d v) |
Implicitly converts from a double-precision vector into a single-precision vector. | |
static double | Dot (ref Vector3d lhs, ref Vector3d rhs) |
Dot Product of two vectors. | |
static void | Cross (ref Vector3d lhs, ref Vector3d rhs, out Vector3d result) |
Cross Product of two vectors. | |
static double | Angle (ref Vector3d from, ref Vector3d to) |
Calculates the angle between two vectors. | |
static void | Lerp (ref Vector3d a, ref Vector3d b, double t, out Vector3d result) |
Performs a linear interpolation between two vectors. | |
static void | Scale (ref Vector3d a, ref Vector3d b, out Vector3d result) |
Multiplies two vectors component-wise. | |
static void | Normalize (ref Vector3d value, out Vector3d result) |
Normalizes a vector. | |
Public Attributes | |
double | x |
The x component. | |
double | y |
The y component. | |
double | z |
The z component. | |
Static Public Attributes | |
static readonly Vector3d | zero = new Vector3d(0, 0, 0) |
The zero vector. | |
const double | Epsilon = double.Epsilon |
The vector epsilon. | |
Properties | |
double | Magnitude [get] |
Gets the magnitude of this vector. | |
double | MagnitudeSqr [get] |
Gets the squared magnitude of this vector. | |
Vector3d | Normalized [get] |
Gets a normalized vector from this vector. | |
double | this[int index] [get, set] |
Gets or sets a specific component by index in this vector. | |
Detailed Description
A double precision 3D vector.
Constructor & Destructor Documentation
◆ Vector3d() [1/3]
realvirtual.Vector3d.Vector3d | ( | double | value | ) |
Creates a new vector with one value for all components.
- Parameters
-
value The value.
◆ Vector3d() [2/3]
realvirtual.Vector3d.Vector3d | ( | double | x, |
double | y, | ||
double | z | ||
) |
Creates a new vector.
- Parameters
-
x The x value. y The y value. z The z value.
◆ Vector3d() [3/3]
realvirtual.Vector3d.Vector3d | ( | Vector3 | vector | ) |
Creates a new vector from a single precision vector.
- Parameters
-
vector The single precision vector.
Member Function Documentation
◆ Angle()
Calculates the angle between two vectors.
- Parameters
-
from The from vector. to The to vector.
- Returns
- The angle.
◆ Clamp()
void realvirtual.Vector3d.Clamp | ( | double | min, |
double | max | ||
) |
Clamps this vector between a specific range.
- Parameters
-
min The minimum component value. max The maximum component value.
◆ Cross()
|
static |
Cross Product of two vectors.
- Parameters
-
lhs The left hand side vector. rhs The right hand side vector. result The resulting vector.
◆ Dot()
Dot Product of two vectors.
- Parameters
-
lhs The left hand side vector. rhs The right hand side vector.
◆ Equals() [1/2]
override bool realvirtual.Vector3d.Equals | ( | object | other | ) |
Returns if this vector is equal to another one.
- Parameters
-
other The other vector to compare to.
- Returns
- If equals.
◆ Equals() [2/2]
bool realvirtual.Vector3d.Equals | ( | Vector3d | other | ) |
Returns if this vector is equal to another one.
- Parameters
-
other The other vector to compare to.
- Returns
- If equals.
◆ GetHashCode()
override int realvirtual.Vector3d.GetHashCode | ( | ) |
Returns a hash code for this vector.
- Returns
- The hash code.
◆ Lerp()
|
static |
Performs a linear interpolation between two vectors.
- Parameters
-
a The vector to interpolate from. b The vector to interpolate to. t The time fraction. result The resulting vector.
◆ Normalize() [1/2]
void realvirtual.Vector3d.Normalize | ( | ) |
Normalizes this vector.
◆ Normalize() [2/2]
Normalizes a vector.
- Parameters
-
value The vector to normalize. result The resulting normalized vector.
◆ operator Vector3()
|
explicitstatic |
Implicitly converts from a double-precision vector into a single-precision vector.
- Parameters
-
v The double-precision vector.
◆ operator Vector3d()
|
static |
Implicitly converts from a single-precision vector into a double-precision vector.
- Parameters
-
v The single-precision vector.
◆ operator!=()
Returns if two vectors don't equal eachother.
- Parameters
-
lhs The left hand side vector. rhs The right hand side vector.
- Returns
- If not equals.
◆ operator*() [1/2]
Scales the vector uniformly.
- Parameters
-
d The scaling vlaue. a The vector.
- Returns
- The resulting vector.
◆ operator*() [2/2]
Scales the vector uniformly.
- Parameters
-
a The vector. d The scaling value.
- Returns
- The resulting vector.
◆ operator+()
Adds two vectors.
- Parameters
-
a The first vector. b The second vector.
- Returns
- The resulting vector.
◆ operator-() [1/2]
Subtracts the vector from a zero vector.
- Parameters
-
a The vector.
- Returns
- The resulting vector.
◆ operator-() [2/2]
Subtracts two vectors.
- Parameters
-
a The first vector. b The second vector.
- Returns
- The resulting vector.
◆ operator/()
Divides the vector with a float.
- Parameters
-
a The vector. d The dividing float value.
- Returns
- The resulting vector.
◆ operator==()
Returns if two vectors equals eachother.
- Parameters
-
lhs The left hand side vector. rhs The right hand side vector.
- Returns
- If equals.
◆ Scale() [1/2]
|
static |
Multiplies two vectors component-wise.
- Parameters
-
a The first vector. b The second vector. result The resulting vector.
◆ Scale() [2/2]
void realvirtual.Vector3d.Scale | ( | ref Vector3d | scale | ) |
Multiplies with another vector component-wise.
- Parameters
-
scale The vector to multiply with.
◆ Set()
void realvirtual.Vector3d.Set | ( | double | x, |
double | y, | ||
double | z | ||
) |
Set x, y and z components of an existing vector.
- Parameters
-
x The x value. y The y value. z The z value.
◆ ToString() [1/2]
override string realvirtual.Vector3d.ToString | ( | ) |
Returns a nicely formatted string for this vector.
- Returns
- The string.
◆ ToString() [2/2]
string realvirtual.Vector3d.ToString | ( | string | format | ) |
Returns a nicely formatted string for this vector.
- Parameters
-
format The float format.
- Returns
- The string.
Member Data Documentation
◆ Epsilon
|
static |
The vector epsilon.
◆ x
double realvirtual.Vector3d.x |
The x component.
◆ y
double realvirtual.Vector3d.y |
The y component.
◆ z
double realvirtual.Vector3d.z |
The z component.
◆ zero
Property Documentation
◆ Magnitude
|
get |
Gets the magnitude of this vector.
◆ MagnitudeSqr
|
get |
Gets the squared magnitude of this vector.
◆ Normalized
|
get |
Gets a normalized vector from this vector.
◆ this[int index]
|
getset |
Gets or sets a specific component by index in this vector.
- Parameters
-
index The component index.