The TPoint Class

Header File

geometry.h

Description

TPoint is a support class, derived from tagPOINT. The tagPOINT struct is defined as

struct tagPOINT {
   int x;
   int y;
};

TPoint encapsulates the notion of a two-dimensional point that usually represents a screen position. TPoint inherits two data members, the coordinates x and y, from tagPOINT. Member functions and operators are provided for comparing, assigning, and manipulating points. Overloaded << and >> operators allow chained insertion and extraction of TPoint objects with streams.

Public Constructors

TPoint();
TPoint(int _x, int _y);
TPoint(const POINT& point);
TPoint(const SIZE& size);
TPoint(uint32 dw);

Public Member Functions

TPoint& Offset(int dx, int dy);
TPoint OffsetBy(int dx, int dy) const;
TPoint operator +(const TSize& size) const;
TPoint operator -(const TSize& size) const;
TSize operator -(const TPoint& point) const;
TPoint operator -() const;
bool operator ==(const TPoint& other) const;
TPoint& operator +=(const TSize& size);
TPoint& operator -=(const TSize& size) const;
bool operator !=(const TPoint& other);
ipstream& operator >>(ipstream& is, TPoint& p);
istream& operator >>(istream& is, TPoint& p);
opstream& operator <<(opstream& os, const TPoint& p);
ostream& operator <<(ostream& os, const TPoint& p);