// pointt ////////////////////////////////////////////////////////////////////////////// #ifndef POINTT_H #define POINTT_H #ifndef LAF_H #include "laf.h" #endif ////////////////////////////////////////////////////////////////////////////// // POINTT is for points that are like windows POINT, but // can be also compared and added by a other POINT // ------------- // | . p1 | ( y grows down and x right ) --> // | . p2 | => p1 < p2 == TRUE | // ------------- v // ------------- // | .p2 | // | .p1 | => p1 < p2 == FALSE // ------------- ////////////////////////////////////////////////////////////////////////////// #define XY(p) p.x,p.y // line(XY(p1),XY(p2); ==> line(p1.x,p1.y,p2.x,p2.y); // line(XY(p),XY_(p,3,4)); ==> line(p.x,p.y,p.x+3,p.y+4); #define XY_(p,a,b) p.x+a,p.y+b class POINTT: public POINT { public: POINTT(int px=0,int py=0) { x=px; y=py; }; int operator < (POINT &p) { return ( this->x < p.x && this->y < p.y ); } int operator == (POINT &p) { return ( this->x == p.x && this->y == p.y ); } int operator <= (POINT &p) { return ( *this < p || *this == p ); } POINTT operator + (POINT &p) { POINTT t; t.x = this->x + p.x; t.y = this->y + p.y; return t; } }; // POINTT #endif