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

Method setPositionFromCentroid

src/Core/Transform/Polygon.cpp:359–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357 }
358
359 void Polygon::setPositionFromCentroid(const Transform::UnitVector& position)
360 {
361 if (!m_points.empty())
362 {
363 const Transform::UnitVector pVec
364 = position.to<Transform::Units::SceneUnits>();
365 const Transform::UnitVector centroid = this->getCentroid();
366 const Transform::UnitVector addPosition = pVec - centroid;
367
368 for (auto& point : m_points)
369 {
370 *point += addPosition;
371 }
372 }
373 }
374
375 PolygonPoint& Polygon::operator[](point_index_t i)
376 {

Callers

nothing calls this directly

Calls 2

getCentroidMethod · 0.95
emptyMethod · 0.45

Tested by

no test coverage detected