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

Method thickenLine

grid_map_core/src/Polygon.cpp:184–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184bool Polygon::thickenLine(const double thickness)
185{
186 if (vertices_.size() != 2) return false;
187 const Vector connection(vertices_[1] - vertices_[0]);
188 const Vector orthogonal = thickness * Vector(connection.y(), -connection.x()).normalized();
189 std::vector<Position> newVertices;
190 newVertices.reserve(4);
191 newVertices.push_back(vertices_[0] + orthogonal);
192 newVertices.push_back(vertices_[0] - orthogonal);
193 newVertices.push_back(vertices_[1] - orthogonal);
194 newVertices.push_back(vertices_[1] + orthogonal);
195 vertices_ = newVertices;
196 return true;
197}
198
199bool Polygon::offsetInward(const double margin)
200{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected