Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

Vector Class Reference
[GLT Math]

3D Vector More...

#include <vector3.h>

Inheritance diagram for Vector:

Inheritance graph
[legend]
List of all members.

Public Methods

 Vector ()
 Default constructor.

 Vector (const Vector &v)
 Copy constructor.

 Vector (const real x, const real y, const real z)
 Constructor.

 Vector (const float *v)
 Constructor.

 Vector (const double *v)
 Constructor.

 Vector (const std::string &str)
 Construct from string.

realx ()
 x co-ordinate

const realx () const
 x co-ordinate

realy ()
 y co-ordinate

const realy () const
 y co-ordinate

realz ()
 z co-ordinate

const realz () const
 z co-ordinate

realoperator[] (const int i)
 i'th co-ordinate

const realoperator[] (const int i) const
 i'th co-ordinate

 operator real * ()
 Access as array.

bool operator== (const Vector &v) const
 Equality operator.

bool operator!= (const Vector &v) const
 Inequality operator.

bool operator== (const real &a) const
 Equality operator: x==a && y==a && z==a.

bool operator< (const Vector &c) const
 less-than comparison

bool operator> (const Vector &c) const
 greater-than comparison

Vector & operator= (const Vector &v)
 Assignment operator.

Vector & operator= (const float *)
 Assignment operator.

Vector & operator= (const double *)
 Assignment operator.

Vector & operator+= (const Vector &v)
 Addition.

Vector & operator-= (const Vector &v)
 Subtraction.

real operator * (const Vector &v) const
 Vector dot product (aka scalar product).

Vector & operator *= (const real &x)
 Multiply.

Vector & operator *= (const Matrix &m)
 Matrix Transformation.

Vector operator- () const
 Negative.

void scale (const real &x)
 Scale.

void scale (const Vector &x)
 Scale.

void normalize ()
 Normalise the vector: |x| = 1.0.

void abs ()
 Make x, y and z positive.

int dominant () const
 Find the dominant component: x, y or z.

real norm () const
 Squared length of vector.

real dist (const Vector &x) const
 Squared distance between vectors.

real length () const
 Length of vector.

bool project (const Matrix &model, const Matrix &proj, const GltViewport &view)
 Map object co-ordinates to window co-ordinates.

Vector & vmin (const Vector &v)
 Replace with minimum x, y and z.

Vector & vmax (const Vector &v)
 Replace with maximum x, y and z.

void glVertex () const
 Draw OpenGL vertex.

void glNormal () const
 Draw OpenGL normal.

void glColor () const
 Draw OpenGL color.

void glTexCoord () const
 Draw OpenGL texture co-ordinate.

std::ostream & writePov (std::ostream &os) const
 Write vector in Povray format.


Protected Attributes

real _vector [3]
 Storage for x, y and z components.


Friends

std::ostream & operator<< (std::ostream &os, const Vector &x)
 Output vector to stream.

std::istream & operator>> (std::istream &is, Vector &x)
 Input vector from stream.

Vector operator * (const Vector &v, const real x)
 Vector scale.

Vector operator/ (const Vector &v, const real x)
 Vector inverse scale.

Vector operator * (const real x, const Vector &v)
 Vector scale.

Vector operator+ (const Vector &v1, const Vector &v2)
 Vector addition.

Vector operator- (const Vector &v1, const Vector &v2)
 Vector difference.

Vector xProduct (const Vector &v1, const Vector &v2)
 Vector cross product.

Vector planeNormal (const Vector &v1, const Vector &v2, const Vector &v3)
 Calculate normal from three points in plane.

Vector polar (const real lat, const real longitude)
 Location on unit sphere.

void orthogonalSystem (Vector &a, Vector &b, Vector &c)
 Create orthogonal co-ordinate system, based on a.


Detailed Description

3D Vector

Todo:
Nice pictures and explanation. Dot product, Cross product, etc.

Definition at line 50 of file vector3.h.


The documentation for this class was generated from the following files:
Generated on Tue Nov 5 11:11:49 2002 for GLT by doxygen1.2.18