WFMath
1.0.2
|
A dim dimensional point. More...
#include <point.h>
Public Member Functions | |
Point () | |
Construct an uninitialized point. | |
Point (const Point &p) | |
Construct a copy of a point. | |
Point (const AtlasInType &a) | |
Construct a point from an object passed by Atlas. | |
Point (const Vector< dim > &vector) | |
Construct a point from a vector. | |
AtlasOutType | toAtlas () const |
Create an Atlas object from the point. | |
void | fromAtlas (const AtlasInType &a) |
Set the point's value to that given by an Atlas object. | |
void | setValid (bool valid=true) |
make isValid() return true if you've initialized the point by hand | |
Point & | setToOrigin () |
Set point to (0,0,...,0) | |
Point & | rotate (const RotMatrix< dim > &m, const Point &p) |
Rotate about point p. | |
CoordType | operator[] (const int i) const |
Access the i'th coordinate of the point. | |
CoordType & | operator[] (const int i) |
Access the i'th coordinate of the point. | |
Point (CoordType x, CoordType y) | |
2D only: construct a point from its (x, y) coordinates | |
Point (CoordType x, CoordType y, CoordType z) | |
3D only: construct a point from its (x, y, z) coordinates | |
CoordType | x () const |
access the first component of a point | |
CoordType & | x () |
access the first component of a point | |
CoordType | y () const |
access the second component of a point | |
CoordType & | y () |
access the second component of a point | |
CoordType | z () const |
access the third component of a point | |
CoordType & | z () |
access the third component of a point | |
Point & | polar (CoordType r, CoordType theta) |
2D only: construct a vector from polar coordinates | |
void | asPolar (CoordType &r, CoordType &theta) const |
2D only: convert a vector to polar coordinates | |
Point & | polar (CoordType r, CoordType theta, CoordType z) |
3D only: construct a vector from polar coordinates | |
void | asPolar (CoordType &r, CoordType &theta, CoordType &z) const |
3D only: convert a vector to polar coordinates | |
Point & | spherical (CoordType r, CoordType theta, CoordType phi) |
3D only: construct a vector from spherical coordinates | |
void | asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const |
3D only: convert a vector to spherical coordinates | |
Static Public Member Functions | |
static const Point< dim > & | ZERO () |
Provides a global instance preset to zero. | |
Friends | |
CoordType | SquaredDistance (const Point &p1, const Point &p2) |
Get the square of the distance from p1 to p2. | |
Point< dim > | Midpoint (const Point &p1, const Point &p2, CoordType dist) |
Find a point on the line containing p1 and p2, by default the midpoint. More... | |
A dim dimensional point.
This class implements the full shape interface, as described in the fake class Shape.
|
friend |
Find a point on the line containing p1 and p2, by default the midpoint.
The default value of 0.5 for dist gives the midpoint. A value of 0 gives p1, and 1 gives p2. Values of dist outside the [0, 1] range are allowed, and give points on the line which are not on the segment bounded by p1 and p2.