From d77778ed7d702d4d6e77a1eacc1d374de5e081fa Mon Sep 17 00:00:00 2001 From: unittensor Date: Wed, 24 Apr 2024 15:24:06 -0400 Subject: [PATCH] btest and minmax alias --- src/shared/Algebra.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shared/Algebra.lua b/src/shared/Algebra.lua index 8eb8837..2146c0a 100644 --- a/src/shared/Algebra.lua +++ b/src/shared/Algebra.lua @@ -30,19 +30,22 @@ export type Math = { IsEven: (n: number) -> boolean, RotationMatrix: (X: number, Y: number, Z: number) -> RotationMatrix, Scalar: (X1: number, Y1: number, X2: number, Y2: number) -> Scalar, - maxmin: (min: number, n: number, max: number) -> number + maxmin: (min: number, n: number, max: number) -> number, + minmax: (min: number, n: number, max: number) -> number } local Math = {} :: Math function Math.IsEven(n) - return bit32.band(n, 1) == 0 + return bit32.btest(bit32.band(n, 1)) end function Math.maxmin(min, n, max) return math.max(min, math.min(n, max)) end +Math.minmax = Math.maxmin + function Math.RotationMatrix(X: number, Y: number, Z: number): RotationMatrix local cosX, sinX = math.cos(X), math.sin(X) local cosY, sinY = math.cos(Y), math.sin(Y)