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

Method isCentroidAroundPosition

src/Core/Transform/Polygon.cpp:280–295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278 }
279
280 bool Polygon::isCentroidAroundPosition(const Transform::UnitVector& position,
281 const Transform::UnitVector& tolerance) const
282 {
283 const Transform::UnitVector pVec = position.to<Transform::Units::SceneUnits>();
284 const Transform::UnitVector pTolerance
285 = tolerance.to<Transform::Units::SceneUnits>();
286 const Transform::UnitVector centroid = this->getCentroid();
287 if (Utils::Math::isBetween(
288 pVec.x, centroid.x - pTolerance.x, centroid.x + pTolerance.x))
289 {
290 if (Utils::Math::isBetween(
291 pVec.y, centroid.y - pTolerance.x, centroid.y + pTolerance.y))
292 return true;
293 }
294 return false;
295 }
296
297 PolygonSegment Polygon::getSegment(const point_index_t segment)
298 {

Callers 1

Calls 2

getCentroidMethod · 0.95
isBetweenFunction · 0.85

Tested by

no test coverage detected