MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / getBoundingBox

Method getBoundingBox

src/Core/Transform/Polygon.cpp:389–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387 }
388
389 Rect Polygon::getBoundingBox() const
390 {
391 auto [minX, maxX] = std::minmax_element(m_points.begin(), m_points.end(),
392 [](auto& point1, auto& point2) { return point1->x < point2->x; });
393 auto [minY, maxY] = std::minmax_element(m_points.begin(), m_points.end(),
394 [](auto& point1, auto& point2) { return point1->y < point2->y; });
395 const double width = maxX->get()->x - minX->get()->x;
396 const double height = maxY->get()->y - minY->get()->y;
397 return Rect(Transform::UnitVector(minX->get()->x, minY->get()->y),
398 Transform::UnitVector(width, height));
399 }
400} // namespace obe::Transform

Callers

nothing calls this directly

Calls 5

UnitVectorClass · 0.85
RectClass · 0.50
beginMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected