#include <Point.h>
Collaboration diagram for Point2D:

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 |
1.5.1-p1