Point2D Class Template Reference
[Utility]

#include <Point.h>

Collaboration diagram for Point2D:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<class ptype>
class ame::Point2D< ptype >

Basic functionality of a 2D point

This class implements the basic functionality of a 2D point. A few simple operations and operators are implemented.


Public Member Functions

 Point2D ()
 doesn't initialize the coordinates
 Point2D (Point2D< ptype > const &p)
 copy constructor
 Point2D (ptype x, ptype y)
 initializes the coordinates to the specified values
 Point2D (ptype c[])
 initializes the coordinates to the specified values
Point2D< ptype > & operator= (Point2D< ptype > const &p)
 assignment operator
Point2D< ptype > operator- (Point2D< ptype > const &p) const
 subtraction
Point2D< ptype > operator+ (Point2D< ptype > const &p) const
 addition
Point2D< ptype > & operator+= (Point2D< ptype > const &p)
 addition
Point2D< ptype > & operator-= (Point2D< ptype > const &p)
 subtraction
Point2D< ptype > operator * (ptype f) const
 scalar multiplication
Point2D< ptype > operator/ (ptype f) const
 scalar division
ptype operator * (Point2D< ptype > const &p) const
 dot product
Point2D< ptype > operator- () const
 negation
bool operator== (Point2D< ptype > const &p) const
 equality
bool operator!= (Point2D< ptype > const &p) const
 inequality
ptype norm () const
 returns the norm of the vector origin -> point
Point2D< ptype > normalize (ptype scale=1)
 normalizes the point
Point2D< ptype > cross (Point2D< ptype > const &p) const
 cross product
ptype dist (Point2D< ptype > const &p) const
 returns the distance between the point and p
ptype Distance (Point2D< ptype > const &p) const
 returns the distance between the point and p
ptype sqrdist (Point2D< ptype > const &p) const
 returns the square of distance
void set (ptype x, ptype y)
void invalidate ()
 sets all coordinates to NaN
bool valid ()
 returns false if any of the coordinates are NaN
void random (void)
 sets all coordinates to random values between -1 and 1
Point2D< ptype > rotate (double angle) const
Point2D< ptype > pwisetimes (Point2D< ptype > const &p) const
Point2D< ptype > pwisedivide (Point2D< ptype > const &p) const
 operator const ptype * () const
 returns the array of coordinates

Public Attributes

union {
   ptype   c [2]
 access to the two coordinates as an array
   struct {
      ptype   x
 access to individual coordinates
      ptype   y
   } 
}; 

Static Public Attributes

static Point2D< ptype > zero

Friends

class boost::serialization::access


The documentation for this class was generated from the following file:
Generated on Tue Mar 6 17:57:20 2007 for AME Repository by  doxygen 1.5.1-p1