#ifndef _PHYSICS_RECT_ #define _PHYSICS_RECT_ namespace wgd { class Vector2D; }; #include "area.h" class Body; class Rect : public Area { public: Rect (Body* body, int i); Rect (float x1, float y1, float x2, float y2); Rect (const wgd::Vector2D &p1, const wgd::Vector2D &p2); wgd::Vector2D centre () const; bool intersects (const Rect &r) const; bool contains (const wgd::Vector2D &p) const; void translate (const wgd::Vector2D &t); void translate (float dx, float dy); void add (const Rect &r); void add (const wgd::Vector2D &p); void add (float x, float y); float minX () const { return x1; } float minY () const { return y1; } float maxX () const { return x2; } float maxY () const { return y2; } Rect getBounds () const { return *this; } private: float x1; float y1; float x2; float y2; }; #endif