MCPcopy Create free account
hub / github.com/chrxh/alien / calcCenter

Method calcCenter

source/EngineInterface/Descriptions.cpp:103–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103RealVector2D ClusteredDataDescription::calcCenter() const
104{
105 RealVector2D result;
106 int numEntities = 0;
107 for (auto const& cluster : clusters) {
108 for (auto const& cell : cluster.cells) {
109 result += cell.pos;
110 ++numEntities;
111 }
112 }
113 for (auto const& particle : particles) {
114 result += particle.pos;
115 ++numEntities;
116 }
117 result /= numEntities;
118 return result;
119}
120
121void ClusteredDataDescription::shift(RealVector2D const& delta)
122{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected