A 3-dimensional position and methods to operate on them. More...
#include <matvec3D.h>
Public Member Functions | |
void | get (double p[3]) const |
position const & | operator+= (vec3 const &v) |
position const & | operator-= (vec3 const &v) |
position const & | operator= (position const &p) |
bool | operator== (position const &p) const |
double & | operator[] (int i) |
const double & | operator[] (int i) const |
position (double x, double y, double z) | |
position (const SbVec3f &p) | |
position (double p[3]) | |
position (const position &p) | |
position () | |
void | set (const SbVec3f &v) |
void | set (const vec3 &v) |
void | set (double x, double y, double z) |
void | set (double p[3]) |
void | set (const position &p) |
SbVec3f | toSbVec3f () const |
void | toSbVec3f (SbVec3f &v) const |
double & | x () |
double | x () const |
double & | y () |
double | y () const |
double & | z () |
double | z () const |
Static Public Attributes | |
static const position | ORIGIN |
The position [0,0,0]. | |
Private Attributes | |
double | pos [3] |
Storarge for the 3 position coordinates. | |
Friends | |
double | operator% (vec3 const &v, position const &p) |
double | operator% (position const &p, vec3 const &v) |
position | operator* (position const &p, transf const &tr) |
position | operator* (double d, position const &p) |
position | operator+ (position const &p1, position const &p2) |
position | operator+ (vec3 const &v, position const &p) |
position | operator+ (position const &p, vec3 const &v) |
vec3 | operator- (position const &p1, position const &p2) |
position | operator- (position const &p, vec3 const &v) |
std::ostream & | operator<< (std::ostream &os, const position &p) |
std::istream & | operator>> (std::istream &is, position &p) |
A 3-dimensional position and methods to operate on them.
position is stored as an array of 3 doubles.
Definition at line 169 of file matvec3D.h.
position::position | ( | ) | [inline] |
Default constructor, position is uninitialized.
Definition at line 177 of file matvec3D.h.
position::position | ( | const position & | p | ) | [inline] |
Copy constructor.
Definition at line 180 of file matvec3D.h.
position::position | ( | double | p[3] | ) | [inline] |
Initializes the position with the three values in the array v.
Definition at line 183 of file matvec3D.h.
position::position | ( | const SbVec3f & | p | ) | [inline] |
Initializes the vector with the values from the Inventor vector v.
Definition at line 186 of file matvec3D.h.
position::position | ( | double | x, | |
double | y, | |||
double | z | |||
) | [inline] |
Initializes the vector with the values x, y, z.
Definition at line 189 of file matvec3D.h.
void position::get | ( | double | p[3] | ) | const [inline] |
Gets the 3 values that make up this position
Definition at line 209 of file matvec3D.h.
Adds vector v to this position.
Definition at line 853 of file matvec3D.h.
Subtracts vector v from this position.
Definition at line 861 of file matvec3D.h.
Copies the position p.
Definition at line 830 of file matvec3D.h.
bool position::operator== | ( | position const & | p | ) | const [inline] |
Returns true if two positions are separated by a distance less the resabs.
Definition at line 923 of file matvec3D.h.
double& position::operator[] | ( | int | i | ) | [inline] |
Returns a reference to the value at index i.
Definition at line 195 of file matvec3D.h.
const double& position::operator[] | ( | int | i | ) | const [inline] |
Returns a constant reference to the value at index i.
Definition at line 192 of file matvec3D.h.
void position::set | ( | const SbVec3f & | v | ) | [inline] |
Sets the values in this vector with the values from the Inventor vector v.
Definition at line 800 of file matvec3D.h.
void position::set | ( | const vec3 & | v | ) | [inline] |
Definition at line 206 of file matvec3D.h.
void position::set | ( | double | x, | |
double | y, | |||
double | z | |||
) | [inline] |
Sets the 3 values in this vector to x, y, z.
Definition at line 204 of file matvec3D.h.
void position::set | ( | double | p[3] | ) | [inline] |
Sets the 3 values in this vector to the 3 values in the array v.
Definition at line 201 of file matvec3D.h.
void position::set | ( | const position & | p | ) | [inline] |
Copies vector v.
Definition at line 198 of file matvec3D.h.
SbVec3f position::toSbVec3f | ( | ) | const [inline] |
Converts this vector into an Inventor vector and returns it.
Definition at line 823 of file matvec3D.h.
void position::toSbVec3f | ( | SbVec3f & | v | ) | const [inline] |
Converts the values of this vector into floats and stores them in the provided Inventor vector.
Definition at line 812 of file matvec3D.h.
double& position::x | ( | ) | [inline] |
Returns a reference to the x-coordinate of this vector.
Definition at line 234 of file matvec3D.h.
double position::x | ( | ) | const [inline] |
Returns the x-coordinate of this vector.
Definition at line 225 of file matvec3D.h.
double& position::y | ( | ) | [inline] |
Returns a reference to the y-coordinate of this vector.
Definition at line 237 of file matvec3D.h.
double position::y | ( | ) | const [inline] |
Returns the y-coordinate of this vector.
Definition at line 228 of file matvec3D.h.
double& position::z | ( | ) | [inline] |
Returns a reference to the z-coordinate of this vector.
Definition at line 240 of file matvec3D.h.
double position::z | ( | ) | const [inline] |
Returns the z-coordinate of this vector.
Definition at line 231 of file matvec3D.h.
Returns the dot product of vector v and position p.
Definition at line 720 of file matvec3D.h.
Returns the dot product of vector v and position p.
Definition at line 713 of file matvec3D.h.
Returns the result of transforming position p with transform tr.
Definition at line 1344 of file matvec3D.h.
Definition at line 914 of file matvec3D.h.
Definition at line 908 of file matvec3D.h.
Returns the result of adding vector v to position p.
Definition at line 895 of file matvec3D.h.
Returns the result of adding vector v to position p.
Definition at line 881 of file matvec3D.h.
Returns the result of subtracting position p2 from position p1.
Definition at line 902 of file matvec3D.h.
Returns the result of subtracting vector v from position p.
Definition at line 888 of file matvec3D.h.
std::ostream& operator<< | ( | std::ostream & | os, | |
const position & | p | |||
) | [friend] |
Writes the values of position p to a stream os in the format "[#, #, #]".
Definition at line 462 of file matvec.cpp.
std::istream& operator>> | ( | std::istream & | is, | |
position & | p | |||
) | [friend] |
Reads the values of a position p from stream is formatted as "[#, #, #]".
Definition at line 445 of file matvec.cpp.
const position position::ORIGIN [static] |
The position [0,0,0].
Definition at line 257 of file matvec3D.h.
double position::pos[3] [private] |
Storarge for the 3 position coordinates.
Definition at line 172 of file matvec3D.h.