Public Methods | |
Coord () | |
Coord (double x, double y=0.0, double z=0.0) | |
Coord (VRSFVec3f coord) | |
void | setCoords (double x=0.0, double y=0.0, double z=0.0) |
Coord & | operator+= (const Coord &coord) |
Coord & | operator-= (const Coord &coord) |
Coord | operator+ (const Coord &coord) const |
Coord | operator- (const Coord &coord) const |
Coord | operator- () const |
Coord & | operator= (const Coord &coord) |
bool | operator== (const Coord &coord) const |
Coord & | operator *= (double d) |
Coord & | operator/= (double d) |
Coord | operator * (double d) const |
Coord | operator/ (double d) const |
double & | operator[] (int i) |
double | operator[] (int i) const |
double | sqrabs () const |
double | abs () const |
Coord | unit () const |
void | normalize () |
Public Attributes | |
double | x |
double | y |
double | z |
Friends | |
double | dot (const Coord &c1, const Coord &c2) |
Coord | cross (const Coord &c1, const Coord &c2) |
Every component (x, y, and z) is a double. The coordinate can also be used as a vector, starting at (0,0,0) and ending at (x,y,z).
|
Default constructor. Initializes the coordinate to (0, 0, 0). |
|
Constructor. Initializes the coordinate to (x, y, z).
|
|
Set the coordinate.
|
|
Returns the length of the vector. It is also the square root of the dot product between the vector and itself
|
|
Normalizes the vector to be of length=1.
|
|
Multiplies coordinate by d.
|
|
Multiplies coordinate by d.
|
|
Adds coord to current coordinate.
|
|
Adds coord to current coordinate.
|
|
Returns the current coordinate multiplied by -1.
|
|
Subtract coord from current coordinate.
|
|
Subtract coord from current coordinate.
|
|
Divides coordinate by d.
|
|
Divides coordinate by d.
|
|
Compares 2 coordinates and returns true if they are the same.
|
|
Compares 2 coordinates and returns true if they are the same.
|
|
Returns the x/y/z coordinate (depends on i).
|
|
Returns the x/y/z coordinate (depends on i).
|
|
Set the coordinate.
|
|
Returns the norm of the vector. It is also the dot product between the vector and itself
|
|
Returns a normalized vector (same direction as original vector, but with length=1).
|
|
Returns the cross product between the 2 coordinates.
|
|
Returns the dot product between the 2 coordinates.
|
|
The x coordinate.
|
|
The y coordinate.
|
|
The z coordinate.
|