3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::Maths::Vector2 Struct Reference

A basic two component vector coordinate implementation. More...

List of all members.

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.

Detailed Description

A basic two component vector coordinate implementation.


Constructor & Destructor Documentation

Tes::Maths::Vector2::Vector2 ( float  scalar) [inline]

Construct a new vector with all components set to scalar .

Parameters:
scalarThe value to assign to each component.
Tes::Maths::Vector2::Vector2 ( float  x,
float  y 
) [inline]

Construct a vector with the given component values.

Parameters:
xThe X coordinate.
yThe Y coordinate.

Member Function Documentation

override bool Tes::Maths::Vector2::Equals ( object  obj) [inline]

Compare two vectors for precise numeric equality.

Parameters:
objThe vector to compare to.
Returns:
True if the vectors are precisely equal.
Exceptions:
InvalidCastExceptionWhen obj is not a Vector2.
override int Tes::Maths::Vector2::GetHashCode ( ) [inline]

Generates a simple hash code for this vector.

Returns:
A 32-bit hash code.
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 .

Parameters:
epsilonPrevents normalisation of small vectors with magnitudes less than or equal to this value.
Returns:
The vector magnitude before normalisation.
static bool Tes::Maths::Vector2::operator!= ( Vector2  a,
Vector2  b 
) [inline, static]

Compare two quaternions for inequality using precise numeric equality.

Parameters:
aA quaternion to compare.
bA quaternion to compare.
Returns:
True if the quaternions are not precisely equal.
static Vector2 Tes::Maths::Vector2::operator* ( float  s,
Vector2  v 
) [inline, static]

Scale a vector by a scalar value.

Parameters:
sThe scalar value.
vThe vector value.
Returns:
The vector v scaled by s .
static Vector2 Tes::Maths::Vector2::operator* ( Vector2  v,
float  s 
) [inline, static]

Scale a vector by a scalar value.

Parameters:
vThe vector value.
sThe scalar value.
Returns:
The vector v scaled by s .
static Vector2 Tes::Maths::Vector2::operator+ ( Vector2  a,
Vector2  b 
) [inline, static]

Sum two vectors and return the result.

Parameters:
aAn operand.
bAn operand.
Returns:
The sum of a and b .
static Vector2 Tes::Maths::Vector2::operator- ( Vector2  a,
Vector2  b 
) [inline, static]

Subtract one vectors from another and return the result.

Parameters:
aAn operand.
bAn operand.
Returns:
The difference between a and b .
static Vector2 Tes::Maths::Vector2::operator/ ( Vector2  v,
float  s 
) [inline, static]

Divide a vector by a scalar value.

Parameters:
vThe vector value.
sThe scalar value.
Returns:
The vector v scaled by the inverse of s .
static bool Tes::Maths::Vector2::operator== ( Vector2  a,
Vector2  b 
) [inline, static]

Compare two quaternions for precise numeric equality.

Parameters:
aA quaternion to compare.
bA quaternion to compare.
Returns:
True if the quaternions are precisely equal.
static Vector2 Tes::Maths::Vector2::Scalar ( float  scalar) [inline, static]

Creates a vector with all components set to scalar .

Parameters:
scalarThe value for all components.
Returns:
The vector (scalar, scalar).

Property Documentation

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].

Parameters:
indexThe component index [0, 1].
Returns:
The requested component.
Exceptions:
IndexOutOfRangeExceptionThrown when index is out of range.

The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events