mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-08 05:18:40 +00:00
Implement circular absolute position
This commit is contained in:
parent
22d6040dca
commit
e47ece41af
|
|
@ -206,15 +206,17 @@ class Functions
|
||||||
return $t;
|
return $t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function mod($a, $b) {
|
public static function mod($a, $b)
|
||||||
if($a < 0) {
|
{
|
||||||
|
if ($a < 0) {
|
||||||
return ($a + $b) % $b;
|
return ($a + $b) % $b;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $a % $b;
|
return $a % $b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isOdd($a) : int {
|
public static function isOdd($a) : bool
|
||||||
|
{
|
||||||
if ($a & 1) {
|
if ($a & 1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -222,11 +224,17 @@ class Functions
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isEven($a) : int {
|
public static function isEven($a) : bool
|
||||||
|
{
|
||||||
if ($a & 1) {
|
if ($a & 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
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