mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 17:58:41 +00:00
Implement circular absolute position
This commit is contained in:
parent
22d6040dca
commit
e47ece41af
|
|
@ -206,15 +206,17 @@ class Functions
|
|||
return $t;
|
||||
}
|
||||
|
||||
public static function mod($a, $b) {
|
||||
if($a < 0) {
|
||||
public static function mod($a, $b)
|
||||
{
|
||||
if ($a < 0) {
|
||||
return ($a + $b) % $b;
|
||||
}
|
||||
|
||||
return $a % $b;
|
||||
}
|
||||
|
||||
public static function isOdd($a) : int {
|
||||
public static function isOdd($a) : bool
|
||||
{
|
||||
if ($a & 1) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -222,11 +224,17 @@ class Functions
|
|||
return false;
|
||||
}
|
||||
|
||||
public static function isEven($a) : int {
|
||||
public static function isEven($a) : bool
|
||||
{
|
||||
if ($a & 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getRelativeDegree($value, $length, $start = 0)
|
||||
{
|
||||
return abs(self::mod($value - $start, $length));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user