UGDK
src/pyramidworks/geometry/rect.h
Go to the documentation of this file.
00001 #ifndef PYRAMIDWORKS_GEOMETRY_RECT_H_
00002 #define PYRAMIDWORKS_GEOMETRY_RECT_H_
00003 
00004 #include <pyramidworks/geometry/geometricshape.h>
00005 
00006 namespace pyramidworks {
00007 namespace geometry {
00008 
00011 class Rect : public GeometricShape {
00012   public:
00015     Rect(double _width, double _height) : GeometricShape(), half_width_(_width/2), half_height_(_height/2) {}
00016     
00018 
00019     double width() const { return 2*half_width_; }
00020 
00022 
00023     double height() const { return 2*half_height_; }
00024 
00025     bool Intersects(const ugdk::Vector2D& this_pos, const GeometricShape *obj, const ugdk::Vector2D& that_pos) const;
00026     bool Intersects(const ugdk::Vector2D& this_pos, const           Rect *obj, const ugdk::Vector2D& that_pos) const;
00027     bool Intersects(const ugdk::Vector2D& this_pos, const         Circle *obj, const ugdk::Vector2D& that_pos) const;
00028         bool Intersects(const ugdk::Vector2D& this_pos, const  ConvexPolygon *obj, const ugdk::Vector2D& that_pos) const;
00029     ugdk::ikdtree::Box<2> GetBoundingBox(const ugdk::Vector2D& position) const;
00030 
00031   private:
00032     double half_width_, half_height_;
00033 };
00034 
00035 } // namespace geometry
00036 } // namespace pyramidworks
00037 
00038 
00039 #endif /* PYRAMIDWORKS_GEOMETRY_RECT_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines