SimPolygon2D.h
Go to the documentation of this file.
1 
7 #pragma once
8 
9 #include <gtsam/geometry/Pose2.h>
11 
12 #include <map>
13 #include <random>
14 
15 namespace gtsam {
16 
20 class GTSAM_UNSTABLE_EXPORT SimPolygon2D {
21 protected:
23  static std::minstd_rand rng;
24 
25 public:
26 
29 
31  static void seedGenerator(unsigned long seed);
32 
34  static SimPolygon2D createTriangle(const Point2& pA, const Point2& pB, const Point2& pC);
35 
40  static SimPolygon2D createRectangle(const Point2& p, double height, double width);
41 
47  static SimPolygon2D randomTriangle(double side_len, double mean_side_len, double sigma_side_len,
48  double min_vertex_dist, double min_side_len, const std::vector<SimPolygon2D>& existing_polys);
49 
55  static SimPolygon2D randomRectangle(double side_len, double mean_side_len, double sigma_side_len,
56  double min_vertex_dist, double min_side_len, const std::vector<SimPolygon2D>& existing_polys);
57 
58  // access to underlying points
59  const Point2& landmark(size_t i) const { return landmarks_[i]; }
60  size_t size() const { return landmarks_.size(); }
61  const Point2Vector& vertices() const { return landmarks_; }
62 
63  // testable requirements
64  bool equals(const SimPolygon2D& p, double tol=1e-5) const;
65  void print(const std::string& s="") const;
66 
70  std::vector<SimWall2D> walls() const;
71 
77  bool contains(const Point2& p) const;
78 
83  bool overlaps(const SimPolygon2D& p) const;
84 
86  static bool anyContains(const Point2& p, const std::vector<SimPolygon2D>& obstacles);
87 
89  static bool anyOverlaps(const SimPolygon2D& p, const std::vector<SimPolygon2D>& obstacles);
90 
92  static bool insideBox(double s, const Point2& p);
93 
95  static bool nearExisting(const Point2Vector& S,
96  const Point2& p, double threshold);
97 
99  static Point2 randomPoint2(double s);
100 
102  static Rot2 randomAngle();
103 
105  static double randomDistance(double mu, double sigma, double min_dist = -1.0);
106 
108  static Point2 randomBoundedPoint2(double boundary_size,
109  const Point2Vector& landmarks, double min_landmark_dist);
110 
112  static Point2 randomBoundedPoint2(double boundary_size,
113  const Point2Vector& landmarks,
114  const std::vector<SimPolygon2D>& obstacles, double min_landmark_dist);
115 
117  static Point2 randomBoundedPoint2(double boundary_size,
118  const std::vector<SimPolygon2D>& obstacles);
119 
121  static Point2 randomBoundedPoint2(
122  const Point2& LL_corner, const Point2& UR_corner,
123  const Point2Vector& landmarks,
124  const std::vector<SimPolygon2D>& obstacles, double min_landmark_dist);
125 
127  static Pose2 randomFreePose(double boundary_size, const std::vector<SimPolygon2D>& obstacles);
128 
129 };
130 
131 typedef std::vector<SimPolygon2D> SimPolygon2DVector;
132 
133 } //\namespace gtsam
134 
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
const Point2Vector & vertices() const
Definition: SimPolygon2D.h:61
Point2 pB(size_t i)
Vector2 Point2
Definition: Point2.h:32
double mu
std::vector< SimPolygon2D > SimPolygon2DVector
Definition: SimPolygon2D.h:131
Point2Vector landmarks_
Definition: SimPolygon2D.h:22
DiscreteKey S(1, 2)
const Point2 & landmark(size_t i) const
Definition: SimPolygon2D.h:59
static std::minstd_rand rng
Definition: SimPolygon2D.h:23
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RealScalar s
traits
Definition: chartTesting.h:28
Point2 pA(size_t i)
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
Definition: Point2.h:49
float * p
Implementation of walls for use with simulators.
size_t size() const
Definition: SimPolygon2D.h:60
static const double sigma
const G double tol
Definition: Group.h:86
2D Pose


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:46