#include <Vec.hpp>
Public Member Functions | |
Vec () | |
Vec (double x, double y, double z) | |
void | clear () |
bool | isNull () const |
double | norm () const |
double | norm2 () const |
Vec & | operator*= (double s) |
Vec & | operator+= (Vec v) |
Vec & | operator-= (Vec v) |
Vec & | operator/= (double s) |
void | set (double x, double y, double z) |
double | x () const |
double | y () const |
double | z () const |
Static Public Member Functions | |
static Vec | cross (Vec a, Vec b) |
static double | dot (Vec a, Vec b) |
Protected Attributes | |
double | _x |
double | _y |
double | _z |
Vec is a low-level class for working with three-dimensional vectors: each instance represents a vector with three cartesian components called x, y, and z. The class defines operators for adding two vectors and for multiplying a vector by a scalar. It offers functions to retrieve the vector components, to get the norm or the squared norm of a vector, and for calculating the dot product and cross product of two vectors. The Vec class is fully implemented inline (in this header file). Most compilers optimize away all overhead so that using this class is just as efficient as directly writing the code in terms of the vector components.
|
inline |
This is the default constructor; all vector components are initialized to zero.
|
inline |
This constructor initializes the vector components to the values provided as arguments.
|
inline |
This function sets all vector components to a value of zero.
This static function returns the vector product (outer product) of two vectors.
This static function returns the dot product (inner product) of two vectors.
|
inline |
This function returns true if all components of the vector are trivially zero, and false otherwise.
|
inline |
This function returns the norm of the vector.
|
inline |
This function returns the squared norm of the vector.
|
inline |
This operator multiplies this vector by a scalar.
|
inline |
This operator divides this vector by a scalar.
|
inline |
This function sets the vector components to the values provided as arguments.
|
inline |
This function returns the x component of the vector.
|
inline |
This function returns the y component of the vector.
|
inline |
This function returns the z component of the vector.
|
protected |
These data members represent the cartesian vector components