public function equals(LatLng $other, $maxMargin = null, $ignoreAltitude = true)
    {
        if ($maxMargin !== null) {
            $margin = max(
                abs(($this->getLatitude() - $other->getLatitude())),
                abs(($this->getLongitude() - $other->getLongitude()))
            );
            
            if (!$ignoreAltitude) {
                $margin = max(
                    $margin,
                    abs(($this->getAltitude() - $other->getLongitude()))
                );
            }

            return ($margin <= $maxMargin);
        }

        if ($this->getLatitude() !== $other->getLatitude()) {
            return false;
        }

        if ($this->getLongitude() !== $other->getLongitude()) {
            return false;
        }

        if (!$ignoreAltitude && $this->getAltitude() !== $other->getAltitude()) {
            return false;
        }

        return true;
    }