1
-- Library for miscellaneous utilitiy functions
2
3
-- Check if a gear is inside a box
4
function gearIsInBox(gear, x, y, w, h)
5
gx, gy = GetGearPosition(gear)
6
if gx >= x and gy >= y and gx <= x + w and gy <= y + h then
7
return true
8
end
9
return false
10
11
12
-- Check if a gear is inside a circle
13
function gearIsInCircle(gear, x, y, r, useRadius)
14
15
if useRadius then
16
r = r + GetGearRadius(gear)
17
18
if r ^ 2 >= (x - gx) ^ 2 + (y - gy) ^ 2 then
19
20
21
22