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

Method getBoundingBox

grid_map_core/src/Polygon.cpp:130–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130void Polygon::getBoundingBox(Position& center, Length& length) const
131{
132 double minX = std::numeric_limits<double>::infinity();
133 double maxX = -std::numeric_limits<double>::infinity();
134 double minY = std::numeric_limits<double>::infinity();
135 double maxY = -std::numeric_limits<double>::infinity();
136 for (const auto& vertex : vertices_) {
137 if (vertex.x() > maxX) maxX = vertex.x();
138 if (vertex.y() > maxY) maxY = vertex.y();
139 if (vertex.x() < minX) minX = vertex.x();
140 if (vertex.y() < minY) minY = vertex.y();
141 }
142 center.x() = (minX + maxX) / 2.0;
143 center.y() = (minY + maxY) / 2.0;
144 length.x() = (maxX - minX);
145 length.y() = (maxY - minY);
146}
147
148bool Polygon::convertToInequalityConstraints(Eigen::MatrixXd& A, Eigen::VectorXd& b) const
149{

Callers 1

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64