// FILE: coordsys.h // written for the course 2172, 1999 #if !defined(_COORDSYS_H_) #define _COORDSYS_H_ // for the definition of ostream #include // coordinate class, 2D class coordinate { protected: double _x,_y; // x and y coordinates public: coordinate(double = 0,double = 0); // by default origin double x() const; // x double y() const; // y friend ostream& operator<<(ostream&, const coordinate&); }; /* coordinate system * * * +----------------+ * | | * | | * +----------------+ * */ class coordsys { protected: double xmin,xmax,ymin,ymax; public: // coordsys(xmin,xmax,ymin,ymax) coordsys(double,double,double,double); // S.map(sys,p) // p is a point in system sys // map returns the corrsponding // coordinates of p in S coordinate map(coordsys,coordinate); // S.rotate(p,o,angle) // returns the coordinates of p rotated about p // by angle many degrees (not radians!) counter // clock-wise coordinate rotate(coordinate,coordinate,double); // properties double minX() const; double minY() const; double maxX() const; double maxY() const; friend ostream& operator<<(ostream&, const coordsys&); }; #endif