79713371

Date: 2025-07-24 12:47:29
Score: 0.5
Natty:
Report link

Thanks all for the comments!

It's really easier than I think:

-- check if an arc intersects a circle
local function isArcCircleIntersection(arc, circle, rightDir)
    -- arc.x, arc.y, arc.radius is a first circle
    local intersectionPoints = findCircleIntersections(arc, circle) -- returns array of collision points
    for _, point in ipairs(intersectionPoints) do
        local angle = math.atan2(point.y - arc.y, point.x - arc.x)
        local da1 = normalizeAngle(angle - arc.angle1) -- above
        local da2 = normalizeAngle(arc.angle2 - angle) -- below
        if rightDir then -- the other direction
            da1, da2 = da2, da1
        end
        if da1 >= 0 and da2 >= 0 then
            return true -- the given angle was between of two angles
        end
    end
    return false
end

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: darkfrei