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

Method getArea

grid_map_core/src/Polygon.cpp:101–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101double Polygon::getArea() const
102{
103 double area = 0.0;
104 int j = vertices_.size() - 1;
105 for (int i = 0; i < vertices_.size(); i++) {
106 area += (vertices_.at(j).x() + vertices_.at(i).x())
107 * (vertices_.at(j).y() - vertices_.at(i).y());
108 j = i;
109 }
110 return std::abs(area / 2.0);
111}
112
113Position Polygon::getCentroid() const
114{

Callers

nothing calls this directly

Calls 2

absFunction · 0.85
atMethod · 0.80

Tested by

no test coverage detected