isaacscript-common 1.2.92 → 1.2.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/functions/math.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function getAngleDifference(angle1: float, angle2: float): float;
|
|
|
13
13
|
* this can be optionally changed by specifying this argument.
|
|
14
14
|
*/
|
|
15
15
|
export declare function getCircleDiscretizedPoints(centerPos: Vector, radius: float, numPoints: int, xMultiplier?: number, yMultiplier?: number, initialDirection?: Direction): Vector[];
|
|
16
|
+
export declare function getSetBits(n: int): int;
|
|
16
17
|
/**
|
|
17
18
|
* Helper function to check if a given position is within a given rectangle. This is an inclusive
|
|
18
19
|
* check, meaning that it will return true if the position is on the border of the rectangle.
|
package/dist/functions/math.lua
CHANGED
|
@@ -74,6 +74,14 @@ function ____exports.getCircleDiscretizedPoints(self, centerPos, radius, numPoin
|
|
|
74
74
|
end
|
|
75
75
|
return positions
|
|
76
76
|
end
|
|
77
|
+
function ____exports.getSetBits(self, n)
|
|
78
|
+
local count = 0
|
|
79
|
+
while n > 0 do
|
|
80
|
+
n = n & n - 1
|
|
81
|
+
count = count + 1
|
|
82
|
+
end
|
|
83
|
+
return count
|
|
84
|
+
end
|
|
77
85
|
function ____exports.inRectangle(self, position, topLeft, bottomRight)
|
|
78
86
|
return position.X >= topLeft.X and position.X <= bottomRight.X and position.Y <= topLeft.Y and position.Y >= bottomRight.Y
|
|
79
87
|
end
|