Conditions | 2 |
Paths | 2 |
Total Lines | 10 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | public function findCentroid(PointCollectionInterface $points): PointInterface |
||
24 | { |
||
25 | if (! $points->getSpace() instanceof Space) { |
||
26 | throw new \InvalidArgumentException( |
||
27 | "Point collection should consist of Euclidean points" |
||
28 | ); |
||
29 | } |
||
30 | |||
31 | return $points->getSpace()->makePoint(Math::centroid( |
||
32 | array_map(fn (PointInterface $point) => $point->getCoordinates(), iterator_to_array($points)) |
||
33 | )); |
||
36 |