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 
gtsam::SimPolygon2DVector
std::vector< SimPolygon2D > SimPolygon2DVector
Definition: SimPolygon2D.h:131
gtsam::SimPolygon2D::landmark
const Point2 & landmark(size_t i) const
Definition: SimPolygon2D.h:59
Pose2.h
2D Pose
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
mu
double mu
Definition: testBoundingConstraint.cpp:37
asiaCPTs::pA
ADT pA
Definition: testAlgebraicDecisionTree.cpp:153
gtsam::SimPolygon2D::landmarks_
Point2Vector landmarks_
Definition: SimPolygon2D.h:22
SimWall2D.h
Implementation of walls for use with simulators.
sampling::sigma
static const double sigma
Definition: testGaussianBayesNet.cpp:170
gtsam::print
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:156
gtsam::SimPolygon2D::SimPolygon2D
SimPolygon2D()
Definition: SimPolygon2D.h:28
gtsam::SimPolygon2D::rng
static std::minstd_rand rng
Definition: SimPolygon2D.h:23
gtsam::Point2
Vector2 Point2
Definition: Point2.h:32
gtsam::equals
Definition: Testable.h:112
gtsam::SimPolygon2D::vertices
const Point2Vector & vertices() const
Definition: SimPolygon2D.h:61
gtsam::SimPolygon2D
Definition: SimPolygon2D.h:20
gtsam::Rot2
Definition: Rot2.h:35
gtsam
traits
Definition: SFMdata.h:40
p
float * p
Definition: Tutorial_Map_using.cpp:9
gtsam::SimPolygon2D::size
size_t size() const
Definition: SimPolygon2D.h:60
gtsam::Point2Vector
std::vector< Point2, Eigen::aligned_allocator< Point2 > > Point2Vector
Definition: Point2.h:49
gtsam::tol
const G double tol
Definition: Group.h:79
asiaCPTs::pB
ADT pB
Definition: testAlgebraicDecisionTree.cpp:157
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
S
DiscreteKey S(1, 2)
gtsam::Pose2
Definition: Pose2.h:39


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:13:23