37 #ifndef OMPL_CONTROL_PLANNERS_SYCLOP_TRIANGULARDECOMPOSITION_
38 #define OMPL_CONTROL_PLANNERS_SYCLOP_TRIANGULARDECOMPOSITION_
40 #include "ompl/base/State.h"
41 #include "ompl/base/spaces/RealVectorBounds.h"
42 #include "ompl/control/planners/syclop/Decomposition.h"
43 #include "ompl/control/planners/syclop/GridDecomposition.h"
59 virtual void getNeighbors(
unsigned int triID, std::vector<unsigned int>& neighbors)
const;
63 virtual void sampleFromRegion(
unsigned int triID,
RNG& rng, std::vector<double>& coord)
const;
66 void print(std::ostream& out)
const;
78 Polygon(
unsigned int nv) : pts(nv) {}
80 std::vector<Vertex> pts;
87 std::vector<unsigned int> neighbors;
95 const std::vector<Polygon>& holes = std::vector<Polygon>());
100 std::vector<Triangle> triangles_;
101 std::vector<Polygon> holes_;
113 virtual ~LocatorGrid()
119 triDecomp->project(s, coord);
122 virtual void sampleFullState(
const base::StateSamplerPtr& ,
const std::vector<double>& , base::State* )
const
126 const std::vector<unsigned int>& locateTriangles(
const base::State* s)
const
131 void buildTriangleMap(
const std::vector<Triangle>& triangles);
137 std::vector<std::vector<unsigned int> > regToTriangles_;
141 void buildLocatorGrid();
144 bool triContains(
const Triangle& tri,
const std::vector<double>& coord)
const;
147 Vertex pointWithinPoly(
const Polygon& poly)
const;
A TriangularDecomposition is a triangulation that ignores obstacles.
virtual void getNeighbors(unsigned int triID, std::vector< unsigned int > &neighbors) const
Stores a given region's neighbors into a given vector.
virtual int locateRegion(const base::State *s) const
Returns the index of the region containing a given State. Most often, this is obtained by first calli...
TriangularDecomposition(unsigned int dim, const base::RealVectorBounds &b, const std::vector< Polygon > &holes=std::vector< Polygon >())
Constructor. Creates a TriangularDecomposition over the given bounds, which must be 2-dimensional...
A GridDecomposition is a Decomposition implemented using a grid.
A Decomposition is a partition of a bounded Euclidean space into a fixed number of regions which are ...
virtual void sampleFromRegion(unsigned int triID, RNG &rng, std::vector< double > &coord) const
Samples a projected coordinate from a given region.
virtual void sampleFullState(const base::StateSamplerPtr &sampler, const std::vector< double > &coord, base::State *s) const =0
Samples a State using a projected coordinate and a StateSampler.
Random number generation. An instance of this class cannot be used by multiple threads at once (membe...
virtual unsigned int createTriangles()
Helper method to triangulate the space and return the number of triangles.
virtual double getRegionVolume(unsigned int triID)
Returns the volume of a given region in this Decomposition.
Definition of an abstract state.
virtual void project(const base::State *s, std::vector< double > &coord) const =0
Project a given State to a set of coordinates in R^k, where k is the dimension of this Decomposition...
virtual unsigned int getDimension() const
Returns the dimension of this Decomposition.
Decomposition(unsigned int dim, const base::RealVectorBounds &b, unsigned int nreg=0)
Constructor. Creates a Decomposition with a given dimension and a given set of bounds. Accepts as an optional argument a given number of regions.
The lower and upper bounds for an Rn space.
virtual const base::RealVectorBounds & getBounds() const
Returns the bounds of this Decomposition.