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

Method getPointAroundPosition

src/Core/Transform/Polygon.cpp:259–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

257 }
258
259 std::optional<PolygonPoint*> Polygon::getPointAroundPosition(
260 const Transform::UnitVector& position, const Transform::UnitVector& tolerance)
261 {
262 const Transform::UnitVector pVec = position.to<Transform::Units::SceneUnits>();
263 const Transform::UnitVector pTolerance
264 = tolerance.to<Transform::Units::SceneUnits>();
265 point_index_t i = 0;
266 for (auto& m_point : m_points)
267 {
268 if (Utils::Math::isBetween(
269 pVec.x, m_point->x - pTolerance.x, m_point->x + pTolerance.x))
270 {
271 if (Utils::Math::isBetween(
272 pVec.y, m_point->y - pTolerance.y, m_point->y + pTolerance.y))
273 return std::optional<PolygonPoint*>(m_point.get());
274 }
275 i++;
276 }
277 return std::nullopt;
278 }
279
280 bool Polygon::isCentroidAroundPosition(const Transform::UnitVector& position,
281 const Transform::UnitVector& tolerance) const

Callers 1

Calls 2

isBetweenFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected