HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /var/www/devs.lapieza.net/vendor/mindee/mindee/src/Geometry/
Upload File :
Current File : /var/www/devs.lapieza.net/vendor/mindee/mindee/src/Geometry/MinMaxUtils.php
<?php

namespace Mindee\Geometry;

/**
 * Utility class for MinMax.
 */
class MinMaxUtils
{
    /**
     * Retrieves the upper and lower bounds of the y-axis from an array of points.
     *
     * @param array $points An array of points.
     * @return \Mindee\Geometry\MinMax
     */
    public static function getMinMaxY(array $points): MinMax
    {
        $yCoords = [];
        foreach ($points as $point) {
            $yCoords[] = $point->getY();
        }

        return new MinMax(min($yCoords), max($yCoords));
    }

    /**
     * Retrieves the upper and lower bounds of the x-axis from an array of points.
     *
     * @param array $points An array of points.
     * @return \Mindee\Geometry\MinMax
     */
    public static function getMinMaxX(array $points): MinMax
    {
        $xCoords = [];
        foreach ($points as $point) {
            $xCoords[] = $point->getX();
        }

        return new MinMax(min($xCoords), max($xCoords));
    }
}