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

A basic vector3 implementation. More...

List of all members.

Public Member Functions

 Vector3 (float scalar)
 Construct a new vector with all components set to scalar .
 Vector3 (float x, float y, float z)
 Construct a vector with the given component values.
void Negate ()
 Negate each component of this vector.
float Normalise (float epsilon=Epsilon)
 Normalise this vector.
float Dot (Vector3 other)
 Calculate the dot product of this vector and another.
Vector3 Cross (Vector3 other)
 Calculate the cross product of this vector and another.
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 Vector3 Scalar (float scalar)
 Creates a vector with all components set to scalar .
static bool operator== (Vector3 a, Vector3 b)
 Compare two quaternions for precise numeric equality.
static bool operator!= (Vector3 a, Vector3 b)
 Compare two quaternions for inequality using precise numeric equality.
static Vector3 operator+ (Vector3 a, Vector3 b)
 Sum two vectors and return the result.
static Vector3 operator- (Vector3 a, Vector3 b)
 Subtract one vectors from another and return the result.
static Vector3 operator* (Vector3 v, float s)
 Scale a vector by a scalar value.
static Vector3 operator* (float s, Vector3 v)
 Scale a vector by a scalar value.
static Vector3 operator/ (Vector3 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 Vector3 Zero = new Vector3 { X = 0, Y = 0, Z = 0 }
 A zero vector (0, 0, 0).
static Vector3 One = new Vector3 { X = 1, Y = 1, Z = 1 }
 A vector with all components one (1, 1, 1).
static Vector3 AxisX = new Vector3 { X = 1, Y = 0, Z = 0 }
 A vector representing the X axis: (1, 0, 0).
static Vector3 AxisY = new Vector3 { X = 0, Y = 1, Z = 0 }
 A vector representing the Y axis: (0, 1, 0).
static Vector3 AxisZ = new Vector3 { X = 0, Y = 0, Z = 1 }
 A vector representing the Z axis: (0, 0, 1).

Properties

float X [get, set]
 The vector X component.
float Y [get, set]
 The vector Y component.
float Z [get, set]
 The vector Z component.
float MagnitudeSquared [get]
 Return the squared magnitude of this vector: X * X + Y * Y + Z * Z
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.
Vector3 Negated [get]
 Return the negation of this vector.
Vector3 Normalised [get]
 Calculate and return a normalised copy of this vector.

Detailed Description

A basic vector3 implementation.


Constructor & Destructor Documentation

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

Construct a new vector with all components set to scalar .

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

Construct a vector with the given component values.

Parameters:
xThe X coordinate.
yThe Y coordinate.
zThe Z coordinate.

Member Function Documentation

Vector3 Tes::Maths::Vector3::Cross ( Vector3  other) [inline]

Calculate the cross product of this vector and another.

Parameters:
otherThe other vector.
Returns:
The cross product of this and other .
float Tes::Maths::Vector3::Dot ( Vector3  other) [inline]

Calculate the dot product of this vector and another.

Parameters:
otherThe other vector.
Returns:
The dot product of this and other .
override bool Tes::Maths::Vector3::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 Vector3.
override int Tes::Maths::Vector3::GetHashCode ( ) [inline]

Generates a simple hash code for this vector.

Returns:
A 32-bit hash code.
void Tes::Maths::Vector3::Negate ( ) [inline]

Negate each component of this vector.

The vector is not normalised when the magnitude is less than or equal to Epsilon.

float Tes::Maths::Vector3::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::Vector3::operator!= ( Vector3  a,
Vector3  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 Vector3 Tes::Maths::Vector3::operator* ( Vector3  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 Vector3 Tes::Maths::Vector3::operator* ( float  s,
Vector3  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 Vector3 Tes::Maths::Vector3::operator+ ( Vector3  a,
Vector3  b 
) [inline, static]

Sum two vectors and return the result.

Parameters:
aAn operand.
bAn operand.
Returns:
The sum of a and b .
static Vector3 Tes::Maths::Vector3::operator- ( Vector3  a,
Vector3  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 Vector3 Tes::Maths::Vector3::operator/ ( Vector3  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::Vector3::operator== ( Vector3  a,
Vector3  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 Vector3 Tes::Maths::Vector3::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, scalar).

Property Documentation

float Tes::Maths::Vector3::MagnitudeSquared [get]

Return the squared magnitude of this vector: X * X + Y * Y + Z * Z

Vector3 Tes::Maths::Vector3::Negated [get]

Return the negation of this vector.

The sign of each component is flipped.

float Tes::Maths::Vector3::this[int index] [get, set]

Indexing accessor.

Indexes X, Y, Z, W across the range [0, 2].

Parameters:
indexThe component index [0, 2].
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