PolygonInterpolator.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rbdyn/api.h>
8 
9 #include <array>
10 #include <memory>
11 #include <vector>
12 
13 namespace geos
14 {
15 namespace geom
16 {
17 class Geometry;
18 class GeometryFactory;
19 } // namespace geom
20 } // namespace geos
21 
22 namespace mc_rbdyn
23 {
24 
26 {
27 public:
28  typedef std::array<double, 2> tuple_t;
29  typedef std::pair<tuple_t, tuple_t> tuple_pair_t;
30 
31 private:
32  struct GeometryDeleter
33  {
34  public:
35  GeometryDeleter(const geos::geom::GeometryFactory & factory);
36 
37  void operator()(geos::geom::Geometry * ptr);
38 
39  private:
40  const geos::geom::GeometryFactory & factory;
41  };
42 
43 public:
44  PolygonInterpolator(const std::vector<tuple_pair_t> & tpv);
45 
46  std::shared_ptr<geos::geom::Geometry> fast_interpolate(double percent);
47 
48  std::vector<tuple_t> midpoint_derivative(double epsilon_derivative);
49 
50  std::vector<tuple_t> normal_derivative(double epsilon_derivative);
51 
52  const std::vector<tuple_pair_t> & tuple_pairs() const;
53 
54 private:
55  const geos::geom::GeometryFactory & geom_factory;
56  GeometryDeleter geom_deleter;
57  std::vector<tuple_pair_t> tuple_pairs_;
58  std::vector<tuple_pair_t> midpoints;
59 };
60 
61 } // namespace mc_rbdyn
geos
Definition: polygon_utils.h:13
mc_rbdyn::PolygonInterpolator
Definition: PolygonInterpolator.h:25
api.h
MC_RBDYN_DLLAPI
#define MC_RBDYN_DLLAPI
Definition: api.h:50
mc_rbdyn::PolygonInterpolator::tuple_t
std::array< double, 2 > tuple_t
Definition: PolygonInterpolator.h:28
mc_rbdyn::PolygonInterpolator::tuple_pair_t
std::pair< tuple_t, tuple_t > tuple_pair_t
Definition: PolygonInterpolator.h:29
mc_rbdyn
Definition: generic_gripper.h:14