UGDK  0.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
rect.h
Go to the documentation of this file.
1 #ifndef PYRAMIDWORKS_GEOMETRY_RECT_H_
2 #define PYRAMIDWORKS_GEOMETRY_RECT_H_
3 
5 
6 namespace pyramidworks {
7 namespace geometry {
8 
11 class Rect : public GeometricShape {
12  public:
15  Rect(double _width, double _height) : GeometricShape(), half_width_(_width/2), half_height_(_height/2) {}
16 
18 
19  double width() const { return 2*half_width_; }
20 
22 
23  double height() const { return 2*half_height_; }
24 
25  bool Intersects(const ugdk::Vector2D& this_pos, const GeometricShape *obj, const ugdk::Vector2D& that_pos) const;
26  bool Intersects(const ugdk::Vector2D& this_pos, const Rect *obj, const ugdk::Vector2D& that_pos) const;
27  bool Intersects(const ugdk::Vector2D& this_pos, const Circle *obj, const ugdk::Vector2D& that_pos) const;
28  bool Intersects(const ugdk::Vector2D& this_pos, const ConvexPolygon *obj, const ugdk::Vector2D& that_pos) const;
30 
31  private:
32  double half_width_, half_height_;
33 };
34 
35 } // namespace geometry
36 } // namespace pyramidworks
37 
38 
39 #endif /* PYRAMIDWORKS_GEOMETRY_RECT_H_ */