MCPcopy Create free account
hub / github.com/ANYbotics/grid_map / fromCircle

Method fromCircle

grid_map_core/src/Polygon.cpp:248–261  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248Polygon Polygon::fromCircle(const Position center, const double radius,
249 const int nVertices)
250{
251 Eigen::Vector2d centerToVertex(radius, 0.0), centerToVertexTemp;
252
253 Polygon polygon;
254 for (int j = 0; j < nVertices; j++) {
255 double theta = j * 2 * M_PI / (nVertices - 1);
256 Eigen::Rotation2D<double> rot2d(theta);
257 centerToVertexTemp = rot2d.toRotationMatrix() * centerToVertex;
258 polygon.addVertex(center + centerToVertexTemp);
259 }
260 return polygon;
261}
262
263Polygon Polygon::convexHullOfTwoCircles(const Position center1,
264 const Position center2, const double radius,

Callers

nothing calls this directly

Calls 1

addVertexMethod · 0.80

Tested by

no test coverage detected