mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-03-19 12:13:56 +00:00
31 lines
755 B
PHP
31 lines
755 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Location\Direction;
|
|
|
|
use Location\Coordinate;
|
|
|
|
class Direction
|
|
{
|
|
public function pointIsNorthOf(Coordinate $point, Coordinate $compareAgainst): bool
|
|
{
|
|
return $point->getLat() > $compareAgainst->getLat();
|
|
}
|
|
|
|
public function pointIsSouthOf(Coordinate $point, Coordinate $compareAgainst): bool
|
|
{
|
|
return $point->getLat() < $compareAgainst->getLat();
|
|
}
|
|
|
|
public function pointIsEastOf(Coordinate $point, Coordinate $compareAgainst): bool
|
|
{
|
|
return $point->getLng() > $compareAgainst->getLng();
|
|
}
|
|
|
|
public function pointIsWestOf(Coordinate $point, Coordinate $compareAgainst): bool
|
|
{
|
|
return $point->getLng() < $compareAgainst->getLng();
|
|
}
|
|
}
|