Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Moteur3D::Vector3 Class Reference

The Vector3 class represents a 3-dimensions vector. More...

#include <Vector3.h>

List of all members.

Public Member Functions

 Vector3 ()
 Default constructor. Initialises data to 0.0f.
 Vector3 (const float vx, const float vy, const float vz)
 Constructor that builds the vector data from floats given through arguments.
 Vector3 (const Vector3 &v)
 Copy Constructor.
float Magnitude ()
 Returns the magnitude of a vector. Primarily used for normalizing vectors.
float Magnitude2 ()
 Returns the squared magnitude of a vector.
bool IsZero ()
 Is the vector equal to (0, 0, 0) ?
void Normalize ()
 Normalises a given vector. In clear words, changes the vector so that its "length" is 1.
Vector3 RotateX (float angle)
 rotates a vector around the X axis by a given angle, in radians
Vector3 RotateY (float angle)
 rotates a vector around the Y axis by a given angle, in radians
Vector3 RotateZ (float angle)
 rotates a vector around the Z axis by a given angle, in radians
Vector3 Rotate (float angle, const Vector3 &axe, const Vector3 &v)
float Distance (const Vector3 &v)
 returns the distance between two Vector3's used as vertices
std::string ToString ()
 Returns a string that represents the actual object.
Vector3operator= (const Vector3 &v)
 Affectation operator.
float & operator[] (unsigned int i)
 Indexing operator.
const float & operator[] (unsigned int i) const
 Indexing operator.
Vector3operator+= (const Vector3 &v)
 Adds a Vector3 to this one.
Vector3operator-= (const Vector3 &v)
 Subtracts a Vector3 from this one.
Vector3operator *= (float f)
 Multiplies this Vector3 by a float.
Vector3operator/= (float f)
 Divides the Vector3 by a float.

Static Public Member Functions

static Vector3 MakeNormal (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3)
 creates a normal vector from 3 vertices. This normal is created from vectors (v1,v2) and (v1,v3)
static float DotProduct (const Vector3 &v1, const Vector3 &v2)
 Returns the dot product of 2 vectors. v1.v2 == |v1|*|v2|*cos(v1,v2). So this gives the cosine of the angle between 2 vectors.
static Vector3 CrossProduct (const Vector3 &v1, const Vector3 &v2)
 Returns the cross product of 2 vectors. The cross product of two vectors v1 and v2 is the vector that is perpendicular to v1 and v2. The result is NOT normalized.
static Vector3 Average (const Vector3 &v1, const Vector3 &v2)
 averages 2 vectors

Public Attributes

float x
 Accessors.
float y
float z

Friends

bool operator== (const Vector3 &v1, const Vector3 &v2)
 Comparison Operator.
bool operator!= (const Vector3 &v1, const Vector3 &v2)
 Difference Operator.
Vector3 operator- (const Vector3 &v)
 Negates this vector.
Vector3 operator+ (const Vector3 &v1, const Vector3 &v2)
 Adds 2 Vector3.
Vector3 operator- (const Vector3 &v1, const Vector3 &v2)
 Subtracts one Vector2 from another.
Vector3 operator * (const Vector3 &v, float f)
 Multiplies a Vector3 by a float.
Vector3 operator * (float f, const Vector3 &v)
 Multiplies a Vector3 by a float.
Vector3 operator/ (const Vector3 &v, float f)
 Divides a Vector3 by a float.


Detailed Description

The Vector3 class represents a 3-dimensions vector.


Constructor & Destructor Documentation

Moteur3D::Vector3::Vector3  )  [inline]
 

Default constructor. Initialises data to 0.0f.

Moteur3D::Vector3::Vector3 const float  vx,
const float  vy,
const float  vz
[inline]
 

Constructor that builds the vector data from floats given through arguments.

Moteur3D::Vector3::Vector3 const Vector3 v  )  [inline]
 

Copy Constructor.


Member Function Documentation

static Vector3 Moteur3D::Vector3::Average const Vector3 v1,
const Vector3 v2
[static]
 

averages 2 vectors

static Vector3 Moteur3D::Vector3::CrossProduct const Vector3 v1,
const Vector3 v2
[static]
 

Returns the cross product of 2 vectors. The cross product of two vectors v1 and v2 is the vector that is perpendicular to v1 and v2. The result is NOT normalized.

float Moteur3D::Vector3::Distance const Vector3 v  ) 
 

returns the distance between two Vector3's used as vertices

static float Moteur3D::Vector3::DotProduct const Vector3 v1,
const Vector3 v2
[static]
 

Returns the dot product of 2 vectors. v1.v2 == |v1|*|v2|*cos(v1,v2). So this gives the cosine of the angle between 2 vectors.

bool Moteur3D::Vector3::IsZero  ) 
 

Is the vector equal to (0, 0, 0) ?

float Moteur3D::Vector3::Magnitude  ) 
 

Returns the magnitude of a vector. Primarily used for normalizing vectors.

float Moteur3D::Vector3::Magnitude2  ) 
 

Returns the squared magnitude of a vector.

static Vector3 Moteur3D::Vector3::MakeNormal const Vector3 v1,
const Vector3 v2,
const Vector3 v3
[static]
 

creates a normal vector from 3 vertices. This normal is created from vectors (v1,v2) and (v1,v3)

void Moteur3D::Vector3::Normalize  ) 
 

Normalises a given vector. In clear words, changes the vector so that its "length" is 1.

Vector3& Moteur3D::Vector3::operator *= float  f  )  [inline]
 

Multiplies this Vector3 by a float.

Vector3& Moteur3D::Vector3::operator+= const Vector3 v  )  [inline]
 

Adds a Vector3 to this one.

Vector3& Moteur3D::Vector3::operator-= const Vector3 v  )  [inline]
 

Subtracts a Vector3 from this one.

Vector3& Moteur3D::Vector3::operator/= float  f  )  [inline]
 

Divides the Vector3 by a float.

Vector3& Moteur3D::Vector3::operator= const Vector3 v  )  [inline]
 

Affectation operator.

const float& Moteur3D::Vector3::operator[] unsigned int  i  )  const [inline]
 

Indexing operator.

float& Moteur3D::Vector3::operator[] unsigned int  i  )  [inline]
 

Indexing operator.

Vector3 Moteur3D::Vector3::Rotate float  angle,
const Vector3 axe,
const Vector3 v
 

Vector3 Moteur3D::Vector3::RotateX float  angle  ) 
 

rotates a vector around the X axis by a given angle, in radians

Vector3 Moteur3D::Vector3::RotateY float  angle  ) 
 

rotates a vector around the Y axis by a given angle, in radians

Vector3 Moteur3D::Vector3::RotateZ float  angle  ) 
 

rotates a vector around the Z axis by a given angle, in radians

std::string Moteur3D::Vector3::ToString  ) 
 

Returns a string that represents the actual object.

Returns:
see brief :)


Friends And Related Function Documentation

Vector3 operator * float  f,
const Vector3 v
[friend]
 

Multiplies a Vector3 by a float.

Vector3 operator * const Vector3 v,
float  f
[friend]
 

Multiplies a Vector3 by a float.

bool operator!= const Vector3 v1,
const Vector3 v2
[friend]
 

Difference Operator.

Vector3 operator+ const Vector3 v1,
const Vector3 v2
[friend]
 

Adds 2 Vector3.

Vector3 operator- const Vector3 v1,
const Vector3 v2
[friend]
 

Subtracts one Vector2 from another.

Vector3 operator- const Vector3 v  )  [friend]
 

Negates this vector.

Vector3 operator/ const Vector3 v,
float  f
[friend]
 

Divides a Vector3 by a float.

bool operator== const Vector3 v1,
const Vector3 v2
[friend]
 

Comparison Operator.


Member Data Documentation

float Moteur3D::Vector3::x
 

Accessors.

float Moteur3D::Vector3::y
 

float Moteur3D::Vector3::z
 


The documentation for this class was generated from the following file:
Generated on Sat Oct 15 15:05:51 2005 for Moteur3D by  doxygen 1.4.4