Point Struct Reference
[Toolkit classes]

An (x, y) pair. More...

#include <point.h>

List of all members.

Public Member Functions

 Point ()
 The point (0, 0).
 Point (int a, int b)
 The point (a, b).
 Point (const Point &p)
double length ()
int taxiLength ()
Point operator+ (const Point &a) const
Point operator- (const Point &a) const
void operator+= (const Point &a)
void operator-= (const Point &a)
void operator*= (const double a)
void operator/= (const double a)
bool operator== (const Point &a) const
bool operator!= (const Point &a) const
bool operator< (const Point &a) const
bool operator> (const Point &a) const
bool in (Point topLeft, Point bottomRight)
 Is this point in the box defined by these other two points?

Public Attributes

int x
int y


Detailed Description

An (x, y) pair.

This is a simple struct that that does nothing more than hold an (x, y) pair. Note that this can be used for a location or it can be used as a vector.

The x and y coordinates are public, so they can be accessed as p.x and p.y. The following operators are overloaded, and act as you would expect:

==

!=

+/-

+=

-=

*=

/=

Note that *= and /= take a double as the right side, and coordinates are rounded as normal for integers. The operators > and < are also overloaded, but only for easy compatibility with the standard template library. Don't use them.

The following two points are specified:

ORIGIN (0,0)

OFFSCREEN (-9999,-9999)


Constructor & Destructor Documentation

Point::Point (  )  [inline]

The point (0, 0).

Point::Point ( int  a,
int  b 
) [inline]

The point (a, b).

Point::Point ( const Point p  )  [inline]


Member Function Documentation

bool Point::in ( Point  topLeft,
Point  bottomRight 
) [inline]

Is this point in the box defined by these other two points?

double Point::length (  )  [inline]

The length of the vector represented by this point. Alternatively, the distance from here to (0,0).

bool Point::operator!= ( const Point a  )  const [inline]

void Point::operator*= ( const double  a  )  [inline]

Point Point::operator+ ( const Point a  )  const [inline]

void Point::operator+= ( const Point a  )  [inline]

Point Point::operator- ( const Point a  )  const [inline]

void Point::operator-= ( const Point a  )  [inline]

void Point::operator/= ( const double  a  )  [inline]

bool Point::operator< ( const Point a  )  const [inline]

bool Point::operator== ( const Point a  )  const [inline]

bool Point::operator> ( const Point a  )  const [inline]

int Point::taxiLength (  )  [inline]

The taxicab distance from here to (0,0).


Member Data Documentation

int Point::x

int Point::y


The documentation for this struct was generated from the following file:

Generated on Mon Mar 16 14:33:14 2009 for LearningGaming by  doxygen 1.5.7.1