RegionClearCircle
not ratedSimilar to RegionAddCircle, this function clears all previously added cells in a circle in a region. The two functions are separate because of simplicity and consistency.
function RegionClearCircle takes region whichRegion, real x, real y, real radius returns nothing
local real r = 16.00
local real w = 0
local rect t = Rect(0, 0, 0, 0)
loop
exitwhen r > radius
set w = Cos(Asin(r / radius)) * radius
call SetRect(t, x - w, y + r - 16.00, x + w, y + r + 16.00)
call RegionClearRect(whichRegion, t)
call SetRect(t, x - w, y - r - 16.00, x + w, y - r + 16.00)
call RegionClearRect(whichRegion, t)
set r = r + 32.00
endloop
call RemoveRect(t)
set t = null
endfunctionNo comments.