mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Public Attributes | List of all members
Vector3 Class Reference

A simple 3d vector and basic operations. More...

#include <Vector3.h>

Public Member Functions

 Vector3 (float x, float y, float z)
 
 Vector3 (const Vector3 &v)
 
 Vector3 (void)
 
 ~Vector3 (void)
 
Vector3 operator+ (const Vector3 &v)
 
Vector3 operator- (const Vector3 &v)
 
Vector3 operator* (const Vector3 &v)
 
Vector3 operator* (float t)
 
Vector3 operator/ (float t)
 
Vector3 operator- (void)
 
Vector3 operator= (const Vector3 &v)
 
float at (Vector3Index index)
 
float at (unsigned __int8 index)
 
float length (void)
 
void normalize (void)
 
float innerProduct (const Vector3 &v)
 
void copy (const Vector3 &v)
 
void set (float x, float y, float z)
 
Vector3 scalarMult (float a)
 

Public Attributes

float x
 
float y
 
float z
 

Detailed Description

A simple 3d vector and basic operations.

This class provides vector arithmetics for a 3-dimensional vactor. All members are public, so the three components can directly be accessed. The basic operations with vectors are supported through operator overloading. Some other operations are available as member functions.

Definition at line 21 of file Vector3.h.

Constructor & Destructor Documentation

Vector3::Vector3 ( float  x,
float  y,
float  z 
)

Definition at line 21 of file Vector3.cpp.

Vector3::Vector3 ( const Vector3 v)

Definition at line 15 of file Vector3.cpp.

Vector3::Vector3 ( void  )

Definition at line 9 of file Vector3.cpp.

Vector3::~Vector3 ( void  )

Definition at line 27 of file Vector3.cpp.

Member Function Documentation

float Vector3::at ( Vector3Index  index)

Definition at line 30 of file Vector3.cpp.

float Vector3::at ( unsigned __int8  index)

Definition at line 45 of file Vector3.cpp.

void Vector3::copy ( const Vector3 v)

Copys the value of a Vector3 into this instance.

Definition at line 172 of file Vector3.cpp.

float Vector3::innerProduct ( const Vector3 v)

Calculates the inner product with an vector.

Definition at line 165 of file Vector3.cpp.

float Vector3::length ( void  )

Calculates the euclidian length of a vector.

Definition at line 144 of file Vector3.cpp.

void Vector3::normalize ( void  )

Normalizes the vector.

Definition at line 151 of file Vector3.cpp.

Vector3 Vector3::operator* ( const Vector3 v)

Cross product.

Definition at line 123 of file Vector3.cpp.

Vector3 Vector3::operator* ( float  t)

Scalar multiplikation.

Definition at line 100 of file Vector3.cpp.

Vector3 Vector3::operator+ ( const Vector3 v)

Addition of an vector.

Parameters
vThe vector to add

Definition at line 64 of file Vector3.cpp.

Vector3 Vector3::operator- ( const Vector3 v)

Subtraction of an vector.

Parameters
vThe vector to substract

Definition at line 78 of file Vector3.cpp.

Vector3 Vector3::operator- ( void  )

Changes the sign of the vector.

Definition at line 89 of file Vector3.cpp.

Vector3 Vector3::operator/ ( float  t)

Scalar division.

Definition at line 112 of file Vector3.cpp.

Vector3 Vector3::operator= ( const Vector3 v)

Definition at line 132 of file Vector3.cpp.

Vector3 Vector3::scalarMult ( float  a)

Multiplikates this vector with a scalar value.

Definition at line 190 of file Vector3.cpp.

void Vector3::set ( float  x,
float  y,
float  z 
)

Sets the value of all components of the vector at the same time.

Definition at line 181 of file Vector3.cpp.

Member Data Documentation

float Vector3::x

Definition at line 24 of file Vector3.h.

float Vector3::y

Definition at line 24 of file Vector3.h.

float Vector3::z

Definition at line 24 of file Vector3.h.


The documentation for this class was generated from the following files: