GJK_nD
 All Classes Files Functions Typedefs Friends Pages
Circle.hpp
1 /*
2  * Copyright (c) 2012 Laurent Provot <provot.research@gmail.com>,
3  * Yan Gerard <yan.gerard@free.fr> and Fabien Feschet <research@feschet.fr>
4  * All rights reserved.
5  *
6  * This is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DLL_CIRCLE_HPP
21 #define DLL_CIRCLE_HPP
22 
23 #include <iostream>
24 #include "GJK_nD.hpp"
25 
26 namespace DLL {
27 
37 class Circle
38 {
39 private:
40  typedef std::pair<size_t, size_t> Coordinates;
41  typedef GJKnD::Vector Vector;
42  typedef GJKnD::Point Point;
43 
44 public:
48  void addInPoint (const Coordinates & xy) { addPointToSet(xy, setIn); }
49 
54  void addDownPoint(const Coordinates & xy) { addPointToSet(xy, setDown); }
55 
60  void addUpPoint (const Coordinates & xy) { addPointToSet(xy, setUp); }
61 
70 
74  friend std::ostream & operator<<(std::ostream & out, const Circle & circle);
75 
76 private:
77  void addPointToSet(const Coordinates & xy, std::vector<Point> & set);
78 
79 private:
80  bool myIsDegenerated;
81 
82  std::vector<Point> setIn;
83  std::vector<Point> setDown;
84  std::vector<Point> setUp;
85 
86  double cx, cy, radius_above, radius_below;
87 };
88 
89 } // namespace DLL
90 
91 #endif // DLL_CIRCLE_HPP