Parasol Planning Library (PPL)
Boundary.h
Go to the documentation of this file.
1 #ifndef PMPL_BOUNDARY_H_
2 #define PMPL_BOUNDARY_H_
3 
4 #include <cstddef>
5 #include <iostream>
6 #include <memory>
7 #include <string>
8 #include <utility>
9 #include <vector>
10 
11 #include "Vector.h"
12 using namespace mathtool;
13 
14 #include "Range.h"
15 #include "Utilities/IOUtils.h"
16 
17 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
18 #include <CGAL/Polyhedron_3.h>
19 #include <CGAL/Polyhedron_incremental_builder_3.h>
20 
21 class Cfg;
22 class GMSPolyhedron;
23 class XMLNode;
24 
25 
30 class Boundary {
31 
32  public:
33 
36 
38  enum Space {Workspace, CSpace};
39 
43 
44  virtual ~Boundary() noexcept;
45 
49  static std::unique_ptr<Boundary> Factory(XMLNode& _node);
50 
55  virtual std::unique_ptr<Boundary> Clone() const = 0;
56 
60 
62  virtual Space Type() const noexcept = 0;
63 
65  virtual std::string Name() const noexcept = 0;
66 
68  virtual size_t GetDimension() const noexcept = 0;
69 
74  virtual double GetMaxDist(const double _r1 = 2., const double _r2 = .5)
75  const = 0;
76 
80  virtual const Range<double>& GetRange(const size_t _i) const = 0;
81 
83  virtual const std::vector<double>& GetCenter() const noexcept = 0;
84 
86  virtual double GetVolume() const noexcept = 0;
87 
91 
93  virtual std::vector<double> GetRandomPoint() const = 0;
94 
97  virtual void PushInside(std::vector<double>& _point) const noexcept = 0;
98 
102 
108  virtual void ScalePoint(std::vector<double>& _point) const noexcept;
109 
115  virtual void UnscalePoint(std::vector<double>& _point) const noexcept;
116 
120 
124  virtual bool InBoundary(const Vector3d& _p) const;
125 
129  virtual bool InBoundary(const std::vector<double>& _v) const = 0;
130 
135  virtual bool InBoundary(const Cfg& _c) const = 0;
136 
140 
144  virtual double GetClearance(const Vector3d& _p) const = 0;
145 
149  virtual Vector3d GetClearancePoint(const Vector3d& _p) const = 0;
150 
154 
157  virtual void SetCenter(const std::vector<double>& _c) noexcept = 0;
158 
161  virtual void Translate(const Vector3d& _v) = 0;
162 
165  virtual void Translate(const std::vector<double>& _t) = 0;
166 
171  virtual void ResetBoundary(const std::vector<std::pair<double, double>>& _bbx,
172  const double _margin) = 0;
173 
177 
182  virtual void Read(std::istream& _is, CountingStreamBuffer& _cbs) = 0;
183 
186  virtual void Write(std::ostream& _os) const = 0;
187 
191 
192  typedef CGAL::Exact_predicates_exact_constructions_kernel CGALKernel;
193  typedef CGAL::Polyhedron_3<CGALKernel> CGALPolyhedron;
194 
196  virtual CGALPolyhedron CGAL() const;
197 
201  virtual GMSPolyhedron MakePolyhedron() const;
202 
204 
205  protected:
206 
209 
213  bool InWorkspace(const Cfg& _c) const;
214 
219  bool InCSpace(const Cfg& _c) const;
220 
222 
223 #ifdef _PARALLEL
224  public:
225 
226  void define_type(stapl::typer&) { }
227 #endif
228 
229 };
230 
231 /*----------------------------------- I/O ------------------------------------*/
232 
233 std::ostream& operator<<(std::ostream& _os, const Boundary& _b);
234 
236 //std::istream& operator>>(std::istream& _is, const Boundary& _b);
237 
238 /*----------------------------------------------------------------------------*/
239 
240 #endif
std::ostream & operator<<(std::ostream &_os, const Boundary &_b)
Definition: Boundary.cpp:190
void Read(GenericStateGraph *_g, const std::string &_filename)
Definition: GenericStateGraph.h:1337
Definition: Boundary.h:30
Space
The types of space that can be modeled with boundaries.
Definition: Boundary.h:38
CGAL::Exact_predicates_exact_constructions_kernel CGALKernel
Definition: Boundary.h:192
virtual ~Boundary() noexcept
CGAL::Polyhedron_3< CGALKernel > CGALPolyhedron
Definition: Boundary.h:193
Definition: Cfg.h:38
Definition: CountingStreamBuffer.h:20
Definition: GMSPolyhedron.h:42
Definition: XMLNode.h:27
Definition: Cfg.h:23
A range of numeric values.
Definition: Range.h:17