|
wfmath
1.0.3
A math library for the Worldforge system.
|
A dim dimensional point. More...
#include <point.h>
Public Member Functions | |
| Point () | |
| Construct an uninitialized point. More... | |
| Point (const Point &)=default | |
| Construct a copy of a point. More... | |
| Point (const AtlasInType &a) | |
| Construct a point from an object passed by Atlas. More... | |
| Point (const Vector< dim > &vector) | |
| Construct a point from a vector. More... | |
| AtlasOutType | toAtlas () const |
| Create an Atlas object from the point. More... | |
| void | fromAtlas (const AtlasInType &a) |
| Set the point's value to that given by an Atlas object. More... | |
| Point & | operator= (const Point &rhs)=default |
| bool | isEqualTo (const Point &p, CoordType epsilon=numeric_constants< CoordType >::epsilon()) const |
| bool | operator== (const Point &rhs) const |
| bool | operator!= (const Point &rhs) const |
| bool | isValid () const |
| void | setValid (bool valid=true) |
| make isValid() return true if you've initialized the point by hand More... | |
| Point & | setToOrigin () |
| Set point to (0,0,...,0) More... | |
| Point & | rotate (const RotMatrix< dim > &m, const Point &p) |
| Rotate about point p. More... | |
| size_t | numCorners () const |
| Point< dim > | getCorner (size_t) const |
| Point< dim > | getCenter () const |
| Point | shift (const Vector< dim > &v) |
| Point | moveCornerTo (const Point &p, size_t) |
| Point | moveCenterTo (const Point &p) |
| Point & | rotateCorner (const RotMatrix< dim > &, size_t) |
| Point & | rotateCenter (const RotMatrix< dim > &) |
| Point & | rotatePoint (const RotMatrix< dim > &m, const Point &p) |
| Point & | rotate (const Quaternion &q, const Point &p) |
| Point & | rotateCorner (const Quaternion &, size_t) |
| Point & | rotateCenter (const Quaternion &) |
| Point & | rotatePoint (const Quaternion &q, const Point &p) |
| AxisBox< dim > | boundingBox () const |
| Ball< dim > | boundingSphere () const |
| Ball< dim > | boundingSphereSloppy () const |
| Point | toParentCoords (const Point &origin, const RotMatrix< dim > &rotation=RotMatrix< dim >().identity()) const |
| Point | toParentCoords (const AxisBox< dim > &coords) const |
| Point | toParentCoords (const RotBox< dim > &coords) const |
| Point | toLocalCoords (const Point &origin, const RotMatrix< dim > &rotation=RotMatrix< dim >().identity()) const |
| Point | toLocalCoords (const AxisBox< dim > &coords) const |
| Point | toLocalCoords (const RotBox< dim > &coords) const |
| Point | toParentCoords (const Point &origin, const Quaternion &rotation) const |
| Point | toLocalCoords (const Point &origin, const Quaternion &rotation) const |
| CoordType | operator[] (const int i) const |
| Access the i'th coordinate of the point. More... | |
| CoordType & | operator[] (const int i) |
| Access the i'th coordinate of the point. More... | |
| Point (CoordType x, CoordType y) | |
| 2D only: construct a point from its (x, y) coordinates More... | |
| Point (CoordType x, CoordType y, CoordType z) | |
| 3D only: construct a point from its (x, y, z) coordinates More... | |
| CoordType | x () const |
| access the first component of a point More... | |
| CoordType & | x () |
| access the first component of a point More... | |
| CoordType | y () const |
| access the second component of a point More... | |
| CoordType & | y () |
| access the second component of a point More... | |
| CoordType | z () const |
| access the third component of a point More... | |
| CoordType & | z () |
| access the third component of a point More... | |
| Point & | polar (CoordType r, CoordType theta) |
| 2D only: construct a vector from polar coordinates More... | |
| void | asPolar (CoordType &r, CoordType &theta) const |
| 2D only: convert a vector to polar coordinates More... | |
| Point & | polar (CoordType r, CoordType theta, CoordType z) |
| 3D only: construct a vector from polar coordinates More... | |
| void | asPolar (CoordType &r, CoordType &theta, CoordType &z) const |
| 3D only: convert a vector to polar coordinates More... | |
| Point & | spherical (CoordType r, CoordType theta, CoordType phi) |
| 3D only: construct a vector from spherical coordinates More... | |
| void | asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const |
| 3D only: convert a vector to spherical coordinates More... | |
| const CoordType * | elements () const |
| template<> | |
| Point< 2 > & | polar (CoordType r, CoordType theta) |
| template<> | |
| void | asPolar (CoordType &r, CoordType &theta) const |
| template<> | |
| Point< 3 > & | polar (CoordType r, CoordType theta, CoordType z) |
| template<> | |
| void | asPolar (CoordType &r, CoordType &theta, CoordType &z) const |
| template<> | |
| Point< 3 > & | spherical (CoordType r, CoordType theta, CoordType phi) |
| template<> | |
| void | asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const |
| template<> | |
| Point< 3 > & | rotate (const Quaternion &q, const Point< 3 > &p) |
| template<> | |
| Point< 3 > & | rotatePoint (const Quaternion &q, const Point< 3 > &p) |
| template<> | |
| Point< 3 > | toLocalCoords (const Point< 3 > &origin, const Quaternion &rotation) const |
| template<> | |
| Point< 3 > | toParentCoords (const Point< 3 > &origin, const Quaternion &rotation) const |
| template<> | |
| CoordType | z () const |
| template<> | |
| CoordType & | z () |
| template<> | |
| Point (CoordType x, CoordType y) | |
| template<> | |
| Point (CoordType x, CoordType y, CoordType z) | |
| template<> | |
| Point< 2 > & | polar (CoordType r, CoordType theta) |
| template<> | |
| void | asPolar (CoordType &r, CoordType &theta) const |
| template<> | |
| Point< 3 > & | polar (CoordType r, CoordType theta, CoordType z) |
| template<> | |
| void | asPolar (CoordType &r, CoordType &theta, CoordType &z) const |
| template<> | |
| Point< 3 > & | spherical (CoordType r, CoordType theta, CoordType phi) |
| template<> | |
| void | asSpherical (CoordType &r, CoordType &theta, CoordType &phi) const |
Static Public Member Functions | |
| static const Point< dim > & | ZERO () |
| Provides a global instance preset to zero. More... | |
Friends | |
| class | ZeroPrimitive< Point< dim > > |
| std::ostream & | operator (std::ostream &os, const Point &p) |
| std::istream & | operator>> (std::istream &is, Point &p) |
| Vector< dim > | operator- (const Point &c1, const Point &c2) |
| Point | operator+ (const Point &c, const Vector< dim > &v) |
| Point | operator- (const Point &c, const Vector< dim > &v) |
| Point | operator+ (const Vector< dim > &v, const Point &c) |
| Point & | operator+= (Point &p, const Vector< dim > &rhs) |
| Point & | operator-= (Point &p, const Vector< dim > &rhs) |
| CoordType | SquaredDistance (const Point &p1, const Point &p2) |
| Get the square of the distance from p1 to p2. More... | |
| 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.
|
inline |
Construct an uninitialized point.
Definition at line 100 of file point.h.
Referenced by WFMath::Point< 2 >::operator[](), WFMath::Point< 2 >::Point(), and WFMath::Point< 2 >::rotate().
|
default |
Construct a copy of a point.
|
inlineexplicit |
Construct a point from an object passed by Atlas.
Definition at line 184 of file atlasconv.h.
|
inlineexplicit |
Construct a point from a vector.
Definition at line 40 of file point_funcs.h.
| WFMath::Point< dim >::Point | ( | CoordType | x, |
| CoordType | y | ||
| ) |
2D only: construct a point from its (x, y) coordinates
| WFMath::Point< dim >::Point | ( | CoordType | x, |
| CoordType | y, | ||
| CoordType | z | ||
| ) |
3D only: construct a point from its (x, y, z) coordinates
| void WFMath::Point< dim >::asPolar | ( | CoordType & | r, |
| CoordType & | theta | ||
| ) | const |
2D only: convert a vector to polar coordinates
Referenced by WFMath::Point< 2 >::y().
| void WFMath::Point< dim >::asPolar | ( | CoordType & | r, |
| CoordType & | theta, | ||
| CoordType & | z | ||
| ) | const |
3D only: convert a vector to polar coordinates
| void WFMath::Point< dim >::asSpherical | ( | CoordType & | r, |
| CoordType & | theta, | ||
| CoordType & | phi | ||
| ) | const |
3D only: convert a vector to spherical coordinates
Referenced by WFMath::Point< 2 >::y().
|
inline |
Set the point's value to that given by an Atlas object.
Definition at line 190 of file atlasconv.h.
Referenced by WFMath::RotBox< dim >::fromAtlas(), and WFMath::Point< 2 >::Point().
|
inline |
|
inline |
| Point& WFMath::Point< dim >::polar | ( | CoordType | r, |
| CoordType | theta | ||
| ) |
2D only: construct a vector from polar coordinates
Referenced by WFMath::Point< 2 >::y().
| Point& WFMath::Point< dim >::polar | ( | CoordType | r, |
| CoordType | theta, | ||
| CoordType | z | ||
| ) |
3D only: construct a vector from polar coordinates
|
inline |
Rotate about point p.
Definition at line 146 of file point.h.
Referenced by WFMath::Point< 2 >::rotate().
|
inline |
Set point to (0,0,...,0)
Definition at line 56 of file point_funcs.h.
Referenced by WFMath::BoundingBox(), and WFMath::Point< 2 >::setValid().
|
inline |
make isValid() return true if you've initialized the point by hand
Definition at line 129 of file point.h.
Referenced by WFMath::Barycenter(), WFMath::BoundingSphere(), WFMath::BoundingSphereSloppy(), and WFMath::AxisBox< dim >::setCorners().
| Point& WFMath::Point< dim >::spherical | ( | CoordType | r, |
| CoordType | theta, | ||
| CoordType | phi | ||
| ) |
3D only: construct a vector from spherical coordinates
Referenced by WFMath::Point< 2 >::y().
|
inline |
Create an Atlas object from the point.
Definition at line 203 of file atlasconv.h.
Referenced by WFMath::Point< 2 >::Point().
|
inline |
access the first component of a point
Definition at line 232 of file point.h.
Referenced by WFMath::Ball< dim >::Ball(), and WFMath::Point< 2 >::operator[]().
|
inline |
|
inline |
access the second component of a point
Definition at line 236 of file point.h.
Referenced by WFMath::Ball< dim >::Ball(), and WFMath::Point< 2 >::operator[]().
|
inline |
| CoordType WFMath::Point< dim >::z | ( | ) | const |
access the third component of a point
Referenced by WFMath::Ball< dim >::Ball(), WFMath::Point< 2 >::operator[](), and WFMath::Point< 2 >::y().
| CoordType& WFMath::Point< dim >::z | ( | ) |
access the third component of a point
|
static |
Provides a global instance preset to zero.
Definition at line 48 of file point_funcs.h.
Referenced by WFMath::Point< 2 >::Point().
|
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.
Definition at line 219 of file point_funcs.h.
|
friend |
Get the square of the distance from p1 to p2.
Definition at line 124 of file point_funcs.h.