An Implementation of the Marching Cubes Algorithm
1.0
|
This class represents a vector in 3D space. More...
#include <3dvector.hpp>
Public Member Functions | |
t3DVector () | |
Creates an instance of this class. | |
t3DVector (const t3DVector &v) | |
Creates an instance of this class from another instance of this class. | |
t3DVector (double x, double y, double z) | |
Creates an instance of this class and initializes it with a given set of coordinates. | |
void | set_coordinates (const t3DVector &v) |
Changes the coordinates of this vector so that they become equal to the respective coordinates of a given vector. | |
void | set_coordinates (double x, double y, double z) |
Changes the coordinates of this vector. | |
bool | operator== (const t3DVector &v) const |
Verifies whether this vector is equal to a given vector. | |
bool | operator!= (const t3DVector &v) const |
Verifies whether this vector is different from a given vector. | |
t3DVector & | operator= (const t3DVector &v) |
Assigns a given vector to this vector. | |
t3DVector & | operator+= (const t3DVector &v) |
Makes this vector equal to itself plus a given vector, and then returns this vector. | |
t3DVector & | operator-= (const t3DVector &v) |
Makes this vector equal to itself minus a given vector, and then returns this vector. | |
t3DVector & | operator*= (double alpha) |
Scales this vector by a given constant factor. | |
t3DVector | operator- () const |
Multiplies the coordinates of this vector by -1 and then returns the resulting vector. This vector itself is not changed. | |
t3DVector | operator+ (const t3DVector &v) const |
Returns the vector resulting from adding this vector to a given vector. | |
t3DVector | operator- (const t3DVector &v) const |
Returns the vector resulting from subtracting a given vector from this vector. | |
t3DVector | operator* (double alpha) const |
Returns the vector resulting from scaling this vector by a constant factor. | |
double | operator* (const t3DVector &v) const |
Computes the dot product of this vector and a given vector. | |
double | operator[] (unsigned i) const throw ( ExceptionObject ) |
Returns the i-th coordinate of this vetor. | |
double & | operator[] (unsigned i) throw ( ExceptionObject ) |
double | length () const |
Returns the length of this vector. | |
bool | is_null () const |
Returns the logic value true if this vector has lenght zero, and the logic value false otherwise. | |
t3DVector & | negate () |
Multiplies the coordinates of this vector by -1, and then returns this vector after the coordinate values are changed. | |
double | inner (const t3DVector &v) const |
Computes the dot product of this vector and a given vector. | |
t3DVector & | normalize () |
Normalizes this vector and then returns a reference to it. | |
t3DVector | cross (const t3DVector &v) const |
Returns a 3D vector corresponding to the cross product of this vector and a given vector. | |
Public Attributes | |
double | _x |
The first coordinate of the vector. | |
double | _y |
The second coordinate of the vector. | |
double | _z |
The third coordinate of the vector. | |
Friends | |
t3DVector | operator* (double alpha, const t3DVector &v) |
Scales this vector by a constant factor and returns the vector after scaling. |
This class represents a vector in 3D space.
Definition at line 57 of file 3dvector.hpp.
common::t3DVector::t3DVector | ( | const t3DVector & | v | ) | [inline] |
Creates an instance of this class from another instance of this class.
v | A given 3D vector to be cloned. |
Definition at line 86 of file 3dvector.hpp.
common::t3DVector::t3DVector | ( | double | x, |
double | y, | ||
double | z | ||
) | [inline] |
Creates an instance of this class and initializes it with a given set of coordinates.
x | The X coordinate of the vector. |
y | The Y coordinate of the vector. |
z | The Z coordinate of the vector. |
Definition at line 104 of file 3dvector.hpp.
References set_coordinates().
{ this->set_coordinates( x , y , z ) ; }
t3DVector common::t3DVector::cross | ( | const t3DVector & | v | ) | const [inline] |
Returns a 3D vector corresponding to the cross product of this vector and a given vector.
v | A vector in 3D space. |
Definition at line 525 of file 3dvector.hpp.
References _x, _y, _z, and t3DVector().
double common::t3DVector::inner | ( | const t3DVector & | v | ) | const [inline] |
Computes the dot product of this vector and a given vector.
v | A vector in 3D space. |
Definition at line 487 of file 3dvector.hpp.
References operator*().
{ return this->operator*( v ) ; }
bool common::t3DVector::is_null | ( | ) | const [inline] |
Returns the logic value true if this vector has lenght zero, and the logic value false otherwise.
Definition at line 452 of file 3dvector.hpp.
double common::t3DVector::length | ( | ) | const [inline] |
Returns the length of this vector.
Definition at line 437 of file 3dvector.hpp.
Referenced by normalize().
t3DVector & common::t3DVector::negate | ( | ) | [inline] |
Multiplies the coordinates of this vector by -1, and then returns this vector after the coordinate values are changed.
Definition at line 467 of file 3dvector.hpp.
t3DVector & common::t3DVector::normalize | ( | ) | [inline] |
Normalizes this vector and then returns a reference to it.
Definition at line 501 of file 3dvector.hpp.
bool common::t3DVector::operator!= | ( | const t3DVector & | v | ) | const [inline] |
Verifies whether this vector is different from a given vector.
Definition at line 174 of file 3dvector.hpp.
{ return *this == v ; }
t3DVector common::t3DVector::operator* | ( | double | alpha | ) | const [inline] |
Returns the vector resulting from scaling this vector by a constant factor.
alpha | A scalar. |
Definition at line 325 of file 3dvector.hpp.
References _x, _y, _z, and t3DVector().
Referenced by inner().
double common::t3DVector::operator* | ( | const t3DVector & | v | ) | const [inline] |
t3DVector & common::t3DVector::operator*= | ( | double | alpha | ) | [inline] |
Returns the vector resulting from adding this vector to a given vector.
v | A vector in 3D space. |
Definition at line 283 of file 3dvector.hpp.
References _x, _y, _z, and t3DVector().
t3DVector common::t3DVector::operator- | ( | ) | const [inline] |
Multiplies the coordinates of this vector by -1 and then returns the resulting vector. This vector itself is not changed.
Definition at line 266 of file 3dvector.hpp.
References _x, _y, _z, and t3DVector().
Returns the vector resulting from subtracting a given vector from this vector.
v | A vector in 3D space. |
Definition at line 304 of file 3dvector.hpp.
References _x, _y, _z, and t3DVector().
bool common::t3DVector::operator== | ( | const t3DVector & | v | ) | const [inline] |
Verifies whether this vector is equal to a given vector.
Definition at line 156 of file 3dvector.hpp.
double & common::t3DVector::operator[] | ( | unsigned | i | ) | const throw ( ExceptionObject ) [inline] |
Returns the i-th coordinate of this vetor.
Returns a reference to the i-th coordinate of this vetor.
i | The index of a vector coordinate. |
i | The index of a vector coordinate. |
Definition at line 374 of file 3dvector.hpp.
void common::t3DVector::set_coordinates | ( | const t3DVector & | v | ) | [inline] |
Changes the coordinates of this vector so that they become equal to the respective coordinates of a given vector.
v | A vector in 3D space. |
Definition at line 122 of file 3dvector.hpp.
Referenced by t3DVector().
void common::t3DVector::set_coordinates | ( | double | x, |
double | y, | ||
double | z | ||
) | [inline] |
Scales this vector by a constant factor and returns the vector after scaling.
alpha | A scalar. |
v | A vector in 3D space. |
Definition at line 559 of file 3dvector.hpp.
{
return v * alpha ;
}