shape_2d.hpp
Go to the documentation of this file.
1 
6 #ifndef SHAPE_2D_HPP
7 #define SHAPE_2D_HPP 1
8 
9 #include "geometry.hpp"
10 
12 class Shape2D
13 {
14 public:
15 
20  virtual bool operator()(const Vector2D& r) const = 0;
21 
23  virtual ~Shape2D(void);
24 };
25 
27 class Circle: public Shape2D
28 {
29 public:
30 
35  Circle(Vector2D const& center, double radius);
36 
37  bool operator()(const Vector2D& r) const;
38 
42  const Vector2D& getCenter(void) const;
43 
47  double getRadius(void) const;
48 
52  void setCenter(Vector2D const& center);
53 
54  ~Circle(void);
55 
59  Circle(const Circle& origin);
60 
61 private:
62 
63  Vector2D center_;
64  const double radius_;
65 };
66 
68 class Outside: public Shape2D
69 {
70 public:
71 
75  explicit Outside(Shape2D const& shape);
76 
77  bool operator()(const Vector2D& r) const;
78 
79 private:
80 
81  Shape2D const& shape_;
82 };
83 
84 #endif // SHAPE_2D_HPP
Geometrical calculations.
Complement set of the points inside a certain shape.
Definition: shape_2d.hpp:68
virtual bool operator()(const Vector2D &r) const =0
Returns true is a point is inside the shape, false otherwise.
A circle.
Definition: shape_2d.hpp:27
virtual ~Shape2D(void)
virtual destructor
Definition: shape_2d.cpp:4
2D Mathematical vector
Definition: geometry.hpp:15
Abstract type for a two dimensional shape.
Definition: shape_2d.hpp:12