@@ 88-90 (lines=3) @@ | ||
85 | $centroid = $this->space->newPoint(array_fill(0, $this->dimention, 0)); |
|
86 | ||
87 | foreach ($this->points as $point) { |
|
88 | for ($n = 0; $n < $this->dimention; $n++) { |
|
89 | $centroid->coordinates[$n] += $point->coordinates[$n]; |
|
90 | } |
|
91 | } |
|
92 | ||
93 | for ($n = 0; $n < $this->dimention; $n++) { |
|
@@ 93-95 (lines=3) @@ | ||
90 | } |
|
91 | } |
|
92 | ||
93 | for ($n = 0; $n < $this->dimention; $n++) { |
|
94 | $this->coordinates[$n] = $centroid->coordinates[$n] / $count; |
|
95 | } |
|
96 | } |
|
97 | ||
98 | public function getIterator(): \Iterator |