3rd Eye Scene C#
3rd Eye Scene C# documentation
|
A basic two component vector coordinate implementation. More...
Public Member Functions | |
Vector2 (float scalar) | |
Construct a new vector with all components set to scalar . | |
Vector2 (float x, float y) | |
Construct a vector with the given component values. | |
void | Negate () |
Negate each component of this vector. | |
float | Normalise (float epsilon=Epsilon) |
Normalise this vector. | |
override bool | Equals (object obj) |
Compare two vectors for precise numeric equality. | |
override int | GetHashCode () |
Generates a simple hash code for this vector. | |
Static Public Member Functions | |
static Vector2 | Scalar (float scalar) |
Creates a vector with all components set to scalar . | |
static bool | operator== (Vector2 a, Vector2 b) |
Compare two quaternions for precise numeric equality. | |
static bool | operator!= (Vector2 a, Vector2 b) |
Compare two quaternions for inequality using precise numeric equality. | |
static Vector2 | operator+ (Vector2 a, Vector2 b) |
Sum two vectors and return the result. | |
static Vector2 | operator- (Vector2 a, Vector2 b) |
Subtract one vectors from another and return the result. | |
static Vector2 | operator* (Vector2 v, float s) |
Scale a vector by a scalar value. | |
static Vector2 | operator* (float s, Vector2 v) |
Scale a vector by a scalar value. | |
static Vector2 | operator/ (Vector2 v, float s) |
Divide a vector by a scalar value. | |
Public Attributes | |
const float | Epsilon = 1e-6f |
Default epsilon value used in various calculations. | |
Static Public Attributes | |
static Vector2 | Zero = new Vector2 { X = 0, Y = 0 } |
A zero vector (0, 0). | |
static Vector2 | One = new Vector2 { X = 1, Y = 1 } |
A vector with all components one (1, 1). | |
static Vector2 | AxisX = new Vector2 { X = 1, Y = 0 } |
A vector representing the X axis: (1, 0). | |
static Vector2 | AxisY = new Vector2 { X = 0, Y = 1 } |
A vector representing the Y axis: (0, 1). | |
Properties | |
float | X [get, set] |
The vector X component. | |
float | Y [get, set] |
The vector Y component. | |
float | MagnitudeSquared [get] |
Return the squared magnitude of this vector: X * X + Y * Y | |
float | Magnitude [get] |
Calculate the magnitude of this vector. | |
float | this[int index] [get, set] |
Indexing accessor. | |
bool | IsZero [get] |
Test if this vector is exactly zero in all components. | |
Vector2 | Negated [get] |
Return the negation of this vector. | |
Vector2 | Normalised [get] |
Calculate and return a normalised copy of this vector. |
A basic two component vector coordinate implementation.
Tes::Maths::Vector2::Vector2 | ( | float | scalar | ) | [inline] |
Construct a new vector with all components set to scalar .
scalar | The value to assign to each component. |
Tes::Maths::Vector2::Vector2 | ( | float | x, |
float | y | ||
) | [inline] |
Construct a vector with the given component values.
x | The X coordinate. |
y | The Y coordinate. |
override bool Tes::Maths::Vector2::Equals | ( | object | obj | ) | [inline] |
Compare two vectors for precise numeric equality.
obj | The vector to compare to. |
InvalidCastException | When obj is not a Vector2. |
override int Tes::Maths::Vector2::GetHashCode | ( | ) | [inline] |
Generates a simple hash code for this vector.
float Tes::Maths::Vector2::Normalise | ( | float | epsilon = Epsilon | ) | [inline] |
Normalise this vector.
The vector is left as is if its magnitude is less than or equal to epsilon .
epsilon | Prevents normalisation of small vectors with magnitudes less than or equal to this value. |
Compare two quaternions for inequality using precise numeric equality.
a | A quaternion to compare. |
b | A quaternion to compare. |
Scale a vector by a scalar value.
s | The scalar value. |
v | The vector value. |
Scale a vector by a scalar value.
v | The vector value. |
s | The scalar value. |
Sum two vectors and return the result.
a | An operand. |
b | An operand. |
Subtract one vectors from another and return the result.
a | An operand. |
b | An operand. |
Divide a vector by a scalar value.
v | The vector value. |
s | The scalar value. |
Compare two quaternions for precise numeric equality.
a | A quaternion to compare. |
b | A quaternion to compare. |
static Vector2 Tes::Maths::Vector2::Scalar | ( | float | scalar | ) | [inline, static] |
Creates a vector with all components set to scalar .
scalar | The value for all components. |
float Tes::Maths::Vector2::MagnitudeSquared [get] |
Return the squared magnitude of this vector: X * X + Y * Y
Vector2 Tes::Maths::Vector2::Negated [get] |
Return the negation of this vector.
The sign of each component is flipped.
Vector2 Tes::Maths::Vector2::Normalised [get] |
Calculate and return a normalised copy of this vector.
The vector is not normalised when the magnitude is less than or equal to Epsilon.
float Tes::Maths::Vector2::this[int index] [get, set] |
Indexing accessor.
Indexes X, Y, Z, W across the range [0, 1].
index | The component index [0, 1]. |
IndexOutOfRangeException | Thrown when index is out of range. |