WFMath  1.0.1
Public Member Functions | Static Public Member Functions | Friends | List of all members
WFMath::Point< dim > Class Template Reference

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
PointsetToOrigin ()
 Set point to (0,0,...,0)
Pointrotate (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.
CoordTypeoperator[] (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
CoordTypex ()
 access the first component of a point
CoordType y () const
 access the second component of a point
CoordTypey ()
 access the second component of a point
CoordType z () const
 access the third component of a point
CoordTypez ()
 access the third component of a point
Pointpolar (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
Pointpolar (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
Pointspherical (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.

Detailed Description

template<int dim = 3>
class WFMath::Point< dim >

A dim dimensional point.

This class implements the full shape interface, as described in the fake class Shape.

Friends And Related Function Documentation

template<int dim = 3>
Point<dim> Midpoint ( const Point< dim > &  p1,
const Point< dim > &  p2,
CoordType  dist = 0.5 
)
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.


The documentation for this class was generated from the following files: