Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mlib::Point2< P, V > Class Template Reference
[MLIB]

A 2D point class with double precision floating point elements.

This class is designed to be base class of more specific types of 2D points. Specifically, 2D points in different coordinate systems. The template argument P is the type of the derived point class. This allows the Point2 to return new points of the same type as the derived class. The template argument V is the type of the corresponding 2D vector class for the coordinate system of the derived 2D point class. More...

#include <point2.H>

Inheritance diagram for mlib::Point2< P, V >:

Inheritance graph
[legend]
List of all members.

Descriptive interface

typedef double value_type
static int dim ()

Public Member Functions

Constructors
 Point2 ()
 Default constructor. Creates a point at the origin.
 Point2 (double s)
 Constructor that creates a point with the supplied double argumetn value in all components.
 Point2 (double xx, double yy)
 Construtor that creates a point with the components supplied in the arguments.
Element Access Functions
const double * data () const
 Returns the elements of the point as an array.
double operator[] (int index) const
double & operator[] (int index)
Overloaded Arithmetic Operators
operator+ (const P &p) const
 Adds a point to a point.
operator+ (const V &v) const
operator- (const P &p) const
operator- (const V &v) const
operator- () const
operator * (double s) const
operator/ (double s) const
operator * (const P &p) const
 Component-wise multiplcation.
void operator *= (const P &p) const
 Component-wise multiplication.
void operator+= (const P &p)
 Adds a point to a point.
void operator+= (const V &v)
void operator-= (const P &p)
void operator-= (const V &v)
void operator *= (double scalar)
void operator/= (double scalar)
Overloaded Comparison Operators
bool operator== (const P &p) const
 Are the two points exactly equal (component-wise)?
bool operator!= (const P &p) const
 Are the two points not equal (component-wise)?
Point Property Queries
double length () const
 Compute the distance from the point to the origin.
double length_sqrd () const
 Compute the distance squared from the point to the origin.
Two Point Operations
double dist_sqrd (const P &p) const
 Compute the distance squared between two points.
double dist (const P &p) const
 Compute the distance between two points.
Point Comparison Functions
bool is_equal (const P &p, double epsSqrd=epsAbsSqrdMath()) const
 Is the distance between the two points essentially zero?

Protected Attributes

double _x
double _y

Related Functions

(Note that these are not member functions.)

ostream & operator<< (ostream &os, const Point2< P, V > &p)
 Stream instertion operator for Point2's.
double det (const Point2< P, V > &a, const Point2< P, V > &b)
 Computes the determinant of the 2x2 matrix with the components of the points as rows.

Detailed Description

template<class P, class V>
class mlib::Point2< P, V >

A 2D point class with double precision floating point elements.

This class is designed to be base class of more specific types of 2D points. Specifically, 2D points in different coordinate systems. The template argument P is the type of the derived point class. This allows the Point2 to return new points of the same type as the derived class. The template argument V is the type of the corresponding 2D vector class for the coordinate system of the derived 2D point class.

Definition at line 32 of file point2.H.


Member Typedef Documentation

template<class P, class V>
typedef double mlib::Point2< P, V >::value_type
 

Definition at line 57 of file point2.H.


Constructor & Destructor Documentation

template<class P, class V>
mlib::Point2< P, V >::Point2  )  [inline]
 

Default constructor. Creates a point at the origin.

Definition at line 44 of file point2.H.

template<class P, class V>
mlib::Point2< P, V >::Point2 double  s  )  [inline, explicit]
 

Constructor that creates a point with the supplied double argumetn value in all components.

Definition at line 47 of file point2.H.

template<class P, class V>
mlib::Point2< P, V >::Point2 double  xx,
double  yy
[inline]
 

Construtor that creates a point with the components supplied in the arguments.

Definition at line 50 of file point2.H.


Member Function Documentation

template<class P, class V>
const double* mlib::Point2< P, V >::data  )  const [inline]
 

Returns the elements of the point as an array.

Definition at line 66 of file point2.H.

Referenced by GestureBoxDrawer::draw(), DEBUG_ELLIPSE::draw(), SmoothShadeStripCB::faceCB(), StripTexCoordsCB2::faceCB(), FlatShadeStripCB::faceCB(), and StripTexCoordsCB3::faceCB().

template<class P, class V>
static int mlib::Point2< P, V >::dim  )  [inline, static]
 

Definition at line 58 of file point2.H.

template<class P, class V>
double mlib::Point2< P, V >::dist const P &  p  )  const [inline]
 

Compute the distance between two points.

Definition at line 138 of file point2.H.

Referenced by GESTURE::dist(), Cam_int::dragup(), Cam_int_fp::dragup(), GESTURE::endpoint_dist(), GESTURE::is_x(), Cam_int::up(), and Cam_int_fp::up().

template<class P, class V>
double mlib::Point2< P, V >::dist_sqrd const P &  p  )  const [inline]
 

Compute the distance squared between two points.

Definition at line 135 of file point2.H.

Referenced by mlib::Point2< NDCpt, NDCvec >::dist(), mlib::Point2< NDCpt, NDCvec >::is_equal(), and Bface::ndc_walk().

template<class P, class V>
bool mlib::Point2< P, V >::is_equal const P &  p,
double  epsSqrd = epsAbsSqrdMath()
const [inline]
 

Is the distance between the two points essentially zero?

Definition at line 146 of file point2.H.

template<class P, class V>
double mlib::Point2< P, V >::length  )  const [inline]
 

Compute the distance from the point to the origin.

Questions:
Do we need/want this function (since points don't really have a length)?

Definition at line 123 of file point2.H.

template<class P, class V>
double mlib::Point2< P, V >::length_sqrd  )  const [inline]
 

Compute the distance squared from the point to the origin.

Questions:
Do we need/want this function (since points don't really have a length)?

Definition at line 127 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator * const P &  p  )  const [inline]
 

Component-wise multiplcation.

Definition at line 89 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator * double  s  )  const [inline]
 

Definition at line 85 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator *= double  scalar  )  [inline]
 

Definition at line 102 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator *= const P &  p  )  const [inline]
 

Component-wise multiplication.

Definition at line 91 of file point2.H.

template<class P, class V>
bool mlib::Point2< P, V >::operator!= const P &  p  )  const [inline]
 

Are the two points not equal (component-wise)?

Definition at line 113 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator+ const V &  v  )  const [inline]
 

Definition at line 80 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator+ const P &  p  )  const [inline]
 

Adds a point to a point.

Warning:
This should only be used to add points that have already been pre-weighted by coefficients that add up to 1.

Definition at line 79 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator+= const V &  v  )  [inline]
 

Definition at line 97 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator+= const P &  p  )  [inline]
 

Adds a point to a point.

Warning:
This should only be used to add points that have already been pre-weighted by coefficients that add up to 1.

Definition at line 96 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator-  )  const [inline]
 

Definition at line 83 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator- const V &  v  )  const [inline]
 

Definition at line 82 of file point2.H.

template<class P, class V>
V mlib::Point2< P, V >::operator- const P &  p  )  const [inline]
 

Definition at line 81 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator-= const V &  v  )  [inline]
 

Definition at line 101 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator-= const P &  p  )  [inline]
 

Questions:
Should this function be allowed (subtracting two points and getting a point as the result)?

Definition at line 100 of file point2.H.

template<class P, class V>
P mlib::Point2< P, V >::operator/ double  s  )  const [inline]
 

Definition at line 86 of file point2.H.

template<class P, class V>
void mlib::Point2< P, V >::operator/= double  scalar  )  [inline]
 

Definition at line 103 of file point2.H.

template<class P, class V>
bool mlib::Point2< P, V >::operator== const P &  p  )  const [inline]
 

Are the two points exactly equal (component-wise)?

Definition at line 111 of file point2.H.

template<class P, class V>
double& mlib::Point2< P, V >::operator[] int  index  )  [inline]
 

Definition at line 69 of file point2.H.

template<class P, class V>
double mlib::Point2< P, V >::operator[] int  index  )  const [inline]
 

Definition at line 68 of file point2.H.


Friends And Related Function Documentation

template<class P, class V>
double det const Point2< P, V > &  a,
const Point2< P, V > &  b
[related]
 

Computes the determinant of the 2x2 matrix with the components of the points as rows.

Definition at line 172 of file point2.H.

template<class P, class V>
ostream & operator<< ostream &  os,
const Point2< P, V > &  p
[related]
 

Stream instertion operator for Point2's.

Definition at line 163 of file point2.H.


Member Data Documentation

template<class P, class V>
double mlib::Point2< P, V >::_x [protected]
 

Definition at line 36 of file point2.H.

Referenced by mlib::Point2< NDCpt, NDCvec >::data(), mlib::Point2< NDCpt, NDCvec >::dist_sqrd(), mlib::Point2< NDCpt, NDCvec >::length(), mlib::Point2< NDCpt, NDCvec >::length_sqrd(), mlib::Point2< NDCpt, NDCvec >::operator *(), mlib::Point2< NDCpt, NDCvec >::operator *=(), mlib::Point2< NDCpt, NDCvec >::operator!=(), mlib::Point2< NDCpt, NDCvec >::operator+(), mlib::Point2< NDCpt, NDCvec >::operator+=(), mlib::Point2< NDCpt, NDCvec >::operator-(), mlib::Point2< NDCpt, NDCvec >::operator-=(), mlib::Point2< NDCpt, NDCvec >::operator/(), mlib::Point2< NDCpt, NDCvec >::operator/=(), mlib::Point2< NDCpt, NDCvec >::operator==(), and mlib::Point2< NDCpt, NDCvec >::operator[]().

template<class P, class V>
double mlib::Point2< P, V >::_y [protected]
 

Definition at line 36 of file point2.H.

Referenced by mlib::Point2< NDCpt, NDCvec >::dist_sqrd(), mlib::Point2< NDCpt, NDCvec >::length(), mlib::Point2< NDCpt, NDCvec >::length_sqrd(), mlib::Point2< NDCpt, NDCvec >::operator *(), mlib::Point2< NDCpt, NDCvec >::operator *=(), mlib::Point2< NDCpt, NDCvec >::operator!=(), mlib::Point2< NDCpt, NDCvec >::operator+(), mlib::Point2< NDCpt, NDCvec >::operator+=(), mlib::Point2< NDCpt, NDCvec >::operator-(), mlib::Point2< NDCpt, NDCvec >::operator-=(), mlib::Point2< NDCpt, NDCvec >::operator/(), mlib::Point2< NDCpt, NDCvec >::operator/=(), and mlib::Point2< NDCpt, NDCvec >::operator==().


The documentation for this class was generated from the following file:
Generated on Mon Sep 18 11:48:10 2006 for jot by  doxygen 1.4.4