GJK_nD
 All Classes Files Functions Typedefs Friends Pages
Conic.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_CONIC_HPP
21 #define DLL_CONIC_HPP
22 
23 #include <iostream>
24 #include "GJK_nD.hpp"
25 
26 namespace DLL {
27 
36 class Conic
37 {
38 private:
39  typedef std::pair<size_t, size_t> Coordinates;
40  typedef GJKnD::Vector Vector;
41  typedef GJKnD::Point Point;
42 
43 public:
47  void addInPoint (const Coordinates & xy) { addPointToSet(xy, setIn); }
48 
53  void addDownPoint(const Coordinates & xy) { addPointToSet(xy, setDown); }
54 
59  void addUpPoint (const Coordinates & xy) { addPointToSet(xy, setUp); }
60 
69 
73  friend std::ostream & operator<<(std::ostream & out, const Conic & conic);
74 
75 private:
76  void addPointToSet(const Coordinates & xy, std::vector<Point> & set);
77 
78 private:
79  std::vector<Point> setIn;
80  std::vector<Point> setDown;
81  std::vector<Point> setUp;
82 
83  double a, b, c, d, e, lower_bound, upper_bound;
84 };
85 
86 } // namespace DLL
87 
88 #endif // DLL_CONIC_HPP