Fovia's C++ Client/Server API
Public Member Functions | Public Attributes | List of all members
VECTOR3D Struct Reference

Public Member Functions

VECTOR3D add (const VECTOR3D &var)
 
void assign (const VECTOR3D &copy)
 
VECTOR3D cross (const VECTOR3D &op)
 
double dot (VECTOR3D op)
 
double length ()
 
VECTOR3D mul (const VECTOR3D &var)
 
void normalize ()
 
VECTOR3D operator* (const double &var)
 
VECTOR3D operator* (const VECTOR3D &var)
 
VECTOR3D operator+ (const VECTOR3D &var)
 
VECTOR3Doperator+= (const VECTOR3D &r)
 
VECTOR3D operator- (const VECTOR3D &var)
 
VECTOR3Doperator= (const VECTOR3D &r)
 
bool operator== (VECTOR3D v)
 
VECTOR3D scale (const double scalar)
 
VECTOR3D sub (const VECTOR3D &var)
 
std::string toString ()
 
 VECTOR3D ()
 
 VECTOR3D (const VECTOR3D &copy)
 
 VECTOR3D (const VERTEX3D &vtx)
 
 VECTOR3D (double nx, double ny, double nz)
 

Public Attributes

double x
 
double y
 
double z
 

Detailed Description

Double precision 3D vector class.

$ \left|x y z \right| $

Constructor & Destructor Documentation

VECTOR3D::VECTOR3D ( )
inline

Constructs a new VECTOR3D object. The member fields are not initialized by this function.

VECTOR3D::VECTOR3D ( const VECTOR3D copy)
inline

Copies the contents of copy into this vector.

Parameters
copythe vector from which to copy values into this vector.

References assign().

VECTOR3D::VECTOR3D ( const VERTEX3D vtx)
inline

Utility function to convert a VERTEX3D into a VECTOR3D. x,y,z from vtx are assigned to x,y,z in this vector respectively.

Parameters
vtxThe vertex from which to copy the x,y,z values.

References VERTEX3D::x, x, VERTEX3D::y, y, VERTEX3D::z, and z.

VECTOR3D::VECTOR3D ( double  nx,
double  ny,
double  nz 
)
inline

Constructs a vector with the values nx, ny and nz.

Parameters
nxThe x value to apply to this vector.
nyThe y value to apply to this vector.
nzThe z value to apply to this vector.

References x, y, and z.

Member Function Documentation

VECTOR3D VECTOR3D::add ( const VECTOR3D var)
inline

Returns the result of adding the vector var to this vector.

Parameters
varThe right side of the vector add operation.
Returns
The result of the vector add operation.

References x, y, and z.

void VECTOR3D::assign ( const VECTOR3D copy)
inline

Assigns the contents of copy to the member fields in this object.

Parameters
copyThe vector from which to copy values from.

Referenced by VECTOR3D().

VECTOR3D VECTOR3D::cross ( const VECTOR3D op)
inline

Returns the result of the cross product of this object and the vector op.

Parameters
opThe right hand side of the cross product operation.
Returns
The result of the cross product operation.

References x, y, and z.

double VECTOR3D::dot ( VECTOR3D  op)
inline

Returns the result of the dot product of this object and the vector op. The result is the cosine of the angle between the two vectors.

Parameters
opThe right hand side of the dot product operation.
Returns
The result of the dot product operation.

References x, y, and z.

double VECTOR3D::length ( )
inline

Returns the length of this vector.

Returns
The length of this vector.

References x, y, and z.

Referenced by normalize().

VECTOR3D VECTOR3D::mul ( const VECTOR3D var)
inline

Returns the result of multiplying each component of the vector var with the corresponding component from this vector.

Parameters
varThe right side of the vector multiply operation.
Returns
The result of the vector multiply operation.

References x, y, and z.

void VECTOR3D::normalize ( )
inline

Performs an in-place normalization of this vector. Note that unlike other vector operations, this is a mutable member function rather than one that returns the result. After this function completes, the result of the length() function on this vector should be roughly 1.0.

References length(), x, y, and z.

VECTOR3D VECTOR3D::scale ( const double  scalar)
inline

Returns the result of scaling each field in this vector by the value scalar.

Parameters
scalarThe value that each member in this vector will be scaled by.
Returns
The result of the scaling operation.

References x, y, and z.

VECTOR3D VECTOR3D::sub ( const VECTOR3D var)
inline

Returns the result of subtracting the vector var from this vector.

Parameters
varThe right side of the vector subtract operation.
Returns
The result of the vector subtract operation.

References x, y, and z.

std::string VECTOR3D::toString ( )
inline

Returns a sring that describes this object.

Returns
The string that describes this object.

References x, y, and z.

Member Data Documentation

double VECTOR3D::x
double VECTOR3D::y
double VECTOR3D::z