If you only want to see if the point is inside one of the circle's quadrants, it can be done really simple.
If you want to check for any sector, I have made the following, where you define the sector from two angles. It would also be possible to define the sectors from vectors instead.
local sx, sy = guiGetScreenSize( )
function isMouseInCircleSector(cx, cy, r, angleStart, angleEnd)
local mx, my = getCursorPosition()
if not mx then return end
-- Relativise mouse position to circle center
mx = mx * sx - cx
my = my * sy - cy
-- Convert angles to vectors
local x1, y1 = r * math.cos(angleStart), r * math.sin(angleStart)
local x2, y2 = r * math.cos(angleEnd), r * math.sin(angleEnd)
return mx^2 + my^2 <= r^2 and -- Check if within radius
-x1*my + y1*mx <= 0 and -- Check if counterclockwise to angleStart
-x2*my + y2*mx > 0 -- Check if clockwise to angleEnd
end
Where:
cx, cy = Circle center
r = Circle radius
angleStart = start of sector, in radians
angleEnd = end of sector, in radians
So as an example, here are the angleStart and angleEnd values for each quadrant
270, 0 - First quadrant
180, 270 - Second quadrant
90, 180 - Third quadrant
0, 90 - Fourth quadrant
Hope it's useful