Chunks
Moddable voxel sandbox for room-scale VR.
|
Represents a position or offset in 3D space. More...
Public Member Functions | |
Vector (float x, float y) | |
Constructs a new vector with the given X and Y components, with 0 for the Z component. More... | |
Vector (float x, float y, float z) | |
Constructs a new vector with the given X, Y, and Z components. More... | |
float | Dot (Vector other) |
Finds the scalar product of this vector and another. More... | |
Vector | Cross (Vector other) |
Finds the cross product of this vector and another. More... | |
bool | Equals (Vector other) |
Tests for equality with another vector. More... | |
bool | Equals (Vector other, float epsilon) |
Tests for equality with another vector within a given margin of error. More... | |
override bool | Equals (object obj) |
Tests for equality with another object. More... | |
override int | GetHashCode () |
Returns the hash code for this vector. More... | |
IntVector | FloorToInt () |
override string | ToString () |
Returns a string representation of this vector. More... | |
Static Public Member Functions | |
static implicit | operator Vector (Vector2D a) |
static | operator Vector2D (Vector a) |
static implicit | operator Vector (IntVector vec) |
Casts an integer vector into a float vector. More... | |
static Vector | operator+ (Vector a) |
static Vector | operator- (Vector a) |
Negates a vector. More... | |
static Vector | operator+ (Vector a, Vector b) |
Adds two vectors together. More... | |
static Vector | operator- (Vector a, Vector b) |
Subtracts a vector from another. More... | |
static Vector | operator* (Vector a, Vector b) |
Multiplies two vectors together. More... | |
static Vector | operator* (float scalar, Vector vec) |
Multiplies a vector by a scalar. More... | |
static Vector | operator* (Vector vec, float scalar) |
Multiplies a vector by a scalar. More... | |
static Vector | operator/ (Vector a, Vector b) |
Divides each component of a vector by the corresponding component of another. More... | |
static Vector | operator/ (Vector vec, float denom) |
Divides a vector by a scalar. More... | |
static Vector | Min (Vector a, Vector b) |
Finds the component-wise minimum of two vectors. More... | |
static Vector | Max (Vector a, Vector b) |
Finds the component-wise maximum of two vectors. More... | |
static float | Angle (Vector from, Vector to) |
Finds the smallest angle between two vectors. More... | |
static Vector | Lerp (Vector from, Vector to, float t) |
Linearly interpolates between two vectors. More... | |
static Vector | Slerp (Vector from, Vector to, float t) |
Spherically interpolates between two vectors. More... | |
Public Attributes | |
readonly float | X |
X component of the vector. More... | |
readonly float | Y |
Y component of the vector. More... | |
readonly float | Z |
Z component of the vector. More... | |
Static Public Attributes | |
static readonly Vector | Zero = new Vector(0, 0, 0) |
The zero vector with 0 for X, Y, and Z. More... | |
static readonly Vector | One = new Vector(1, 1, 1) |
A vector with 1 for X, Y, and Z. More... | |
static readonly Vector | UnitX = new Vector(1, 0, 0) |
A unit vector pointing along +X. More... | |
static readonly Vector | UnitY = new Vector(0, 1, 0) |
A unit vector pointing along +Y. More... | |
static readonly Vector | UnitZ = new Vector(0, 0, 1) |
A unit vector pointing along +Z. More... | |
Properties | |
float | Length [get] |
Finds the length of the vector. More... | |
float | LengthSquared [get] |
Finds the squared length of the vector. More... | |
Vector | NormalizedSafe [get] |
Finds a unit vector pointing in the same direction as this one. If the original vector has approximately zero length, the zero vector is returned. More... | |
Vector | Normalized [get] |
Finds a unit vector pointing in the same direction as this one. Use NormalizedSafe for vectors that may have zero length. More... | |
float | this[int index] [get] |
Gets a component of the vector by indexl with 0 for X, 1 for Y, and 2 for Z. More... | |
Represents a position or offset in 3D space.
Chunks.Geometry.Vector.Vector | ( | float | x, |
float | y | ||
) |
Constructs a new vector with the given X and Y components, with 0 for the Z component.
x | X component |
y | Y component |
Chunks.Geometry.Vector.Vector | ( | float | x, |
float | y, | ||
float | z | ||
) |
Constructs a new vector with the given X, Y, and Z components.
x | X component |
y | Y component |
z | Z component |
Finds the smallest angle between two vectors.
from | Starting vector |
to | Ending vector |
Finds the cross product of this vector and another.
other | Vector to find the cross product with |
float Chunks.Geometry.Vector.Dot | ( | Vector | other | ) |
Finds the scalar product of this vector and another.
other | Vector to find the scalar product with |
bool Chunks.Geometry.Vector.Equals | ( | Vector | other | ) |
Tests for equality with another vector.
other | Vector to test for equality with |
bool Chunks.Geometry.Vector.Equals | ( | Vector | other, |
float | epsilon | ||
) |
Tests for equality with another vector within a given margin of error.
other | Vector to test for equality with |
epsilon | Inclusive margin of error |
override bool Chunks.Geometry.Vector.Equals | ( | object | obj | ) |
Tests for equality with another object.
obj | Object to test for equality with |
IntVector Chunks.Geometry.Vector.FloorToInt | ( | ) |
override int Chunks.Geometry.Vector.GetHashCode | ( | ) |
Returns the hash code for this vector.
Linearly interpolates between two vectors.
from | Starting vector |
to | Ending vector |
t | Interpolation parameter |
Finds the component-wise maximum of two vectors.
a | First vector to find the maximum of |
b | Second vector to find the maximum of |
Finds the component-wise minimum of two vectors.
a | First vector to find the minimum of |
b | Second vector to find the minimum of |
Casts an integer vector into a float vector.
vec | Vector to cast |
Multiplies two vectors together.
a | First vector to multiply |
b | Second vector to multiply |
Multiplies a vector by a scalar.
vec | Vector to multiply |
scalar | Scalar value to multiply by |
Multiplies a vector by a scalar.
vec | Vector to multiply |
scalar | Scalar value to multiply by |
Adds two vectors together.
a | First vector to add |
b | Second vector to add |
Negates a vector.
a | Vector to negate |
Divides each component of a vector by the corresponding component of another.
a | Numerator vector |
b | Denomenator vector |
Divides a vector by a scalar.
vec | Vector to divide |
denom | Scalar value to divide by |
Spherically interpolates between two vectors.
from | Starting vector |
to | Ending vector |
t | Interpolation parameter |
override string Chunks.Geometry.Vector.ToString | ( | ) |
Returns a string representation of this vector.
A vector with 1 for X, Y, and Z.
A unit vector pointing along +X.
A unit vector pointing along +Y.
A unit vector pointing along +Z.
readonly float Chunks.Geometry.Vector.X |
X component of the vector.
readonly float Chunks.Geometry.Vector.Y |
Y component of the vector.
readonly float Chunks.Geometry.Vector.Z |
Z component of the vector.
The zero vector with 0 for X, Y, and Z.
|
get |
Finds the length of the vector.
|
get |
Finds the squared length of the vector.
|
get |
Finds a unit vector pointing in the same direction as this one. Use NormalizedSafe for vectors that may have zero length.
|
get |
Finds a unit vector pointing in the same direction as this one. If the original vector has approximately zero length, the zero vector is returned.
|
get |
Gets a component of the vector by indexl with 0 for X, 1 for Y, and 2 for Z.
index | Index of the component to get |