Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members  

PLMVec3 Class Reference

Simple 3D vector. More...

#include <PLMMath.hpp>

List of all members.

Public Methods

 PLMVec3 ()
 PLMVec3 (const float x, const float y, const float z)
 PLMVec3 (const float *v)
void Reset ()
void Set (const float x=0.0f, const float y=0.0f, const float z=0.0f)
void Set (const float *v)
void Translate (const float x=0.0f, const float y=0.0f, const float z=0.0f)
float & operator[] (int i)
const float & operator[] (int i) const
float Length () const
float Length2 () const
void Negate ()
void Normalize ()
void Cross (const PLMVec3 &v1, const PLMVec3 &v2)
bool operator== (const PLMVec3 &v) const
bool operator!= (const PLMVec3 &v) const
PLMVec3 operator- () const
const PLMVec3 & operator+= (const PLMVec3 &v)
const PLMVec3 & operator-= (const PLMVec3 &v)
const PLMVec3 & operator%= (const PLMVec3 &v)
const PLMVec3 & operator *= (const float f)
PLMVec3 operator+ (const PLMVec3 &v) const
PLMVec3 operator- (const PLMVec3 &v) const
float operator * (const PLMVec3 &v) const
PLMVec3 operator% (const PLMVec3 &v) const
PLMVec3 operator * (const float f) const


Detailed Description

Simple 3D vector.


Constructor & Destructor Documentation

PLMVec3::PLMVec3   [inline]
 

Create a null vector.

PLMVec3::PLMVec3 const float    x,
const float    y,
const float    z
[inline]
 

Create a new vector (x, y, z).

PLMVec3::PLMVec3 const float *    v [inline]
 

Create a new vector (v[0], v[1], v[2]).


Member Function Documentation

void PLMVec3::Reset   [inline]
 

Set all components to 0.0f.

void PLMVec3::Set const float    x = 0.0f,
const float    y = 0.0f,
const float    z = 0.0f
[inline]
 

Change the values to (x, y, z).

void PLMVec3::Set const float *    v [inline]
 

Change the values to (v[0], v[1], v[2]).

void PLMVec3::Translate const float    x = 0.0f,
const float    y = 0.0f,
const float    z = 0.0f
[inline]
 

Add (x, y, z) to the current position.

float & PLMVec3::operator[] int    i [inline]
 

Get a reference on the i-th component (0 <= i <= 2).

const float & PLMVec3::operator[] int    i const [inline]
 

Get a constant reference on the i-th component (0 <= i <= 2).

float PLMVec3::Length   [inline]
 

Get the norm of the vector.

float PLMVec3::Length2   [inline]
 

Get the square of the norm.

void PLMVec3::Negate   [inline]
 

Change the sign of all components.

void PLMVec3::Normalize   [inline]
 

Normalize the vector (length = 1).

void PLMVec3::Cross const PLMVec3 &    v1,
const PLMVec3 &    v2
[inline]
 

The current vector is set to the result of v1 x v2 (cross product).

bool PLMVec3::operator== const PLMVec3 &    v const [inline]
 

Comparison operator. Returns true if all components are equal.

bool PLMVec3::operator!= const PLMVec3 &    v const [inline]
 

Comparison operator. Returns true if at least one component is different.

PLMVec3 PLMVec3::operator-   [inline]
 

Negation operator.

const PLMVec3 & PLMVec3::operator+= const PLMVec3 &    v [inline]
 

Translation. Add v components to the current vector.

const PLMVec3 & PLMVec3::operator-= const PLMVec3 &    v [inline]
 

Translation. Substract v components from the current vector.

const PLMVec3 & PLMVec3::operator%= const PLMVec3 &    v [inline]
 

Cross product. Current vector is set to (this x v).

const PLMVec3 & PLMVec3::operator *= const float    f [inline]
 

Scale. Multiply current components by f.

PLMVec3 PLMVec3::operator+ const PLMVec3 &    v const [inline]
 

Return a new vector set to (this + v). Current vector not modified.

PLMVec3 PLMVec3::operator- const PLMVec3 &    v const [inline]
 

Return a new vector set to (this - v). Current vector not modified.

float PLMVec3::operator * const PLMVec3 &    v const [inline]
 

Return a new vector set to (this . v) (dot product). Current vector not modified.

PLMVec3 PLMVec3::operator% const PLMVec3 &    v const [inline]
 

Return a new vector set to (this + v) (cross product). Current vector not modified.

PLMVec3 PLMVec3::operator * const float    f const [inline]
 

Return a new vector set to (\af * this) (mult. by a float). Current vector not modified.


The documentation for this class was generated from the following file:
  • PLMMath.hpp

Generated by Doxygen 1.2.18 on Tue Oct 26 12:07:45 2004.