4 ms·
The chosen visualization complicates it. In a perfectly square room, a beam in any direction, originating from some interior point p0, will hit the four mirrors
by kazinator 5y ago
The chosen visualization complicates it. In a perfectly square room, a beam in any direction, originating from some interior point p0, will hit the four mirrors and form a rectangle, passing through the original p0 at the same angle. When tracing a beam, we don't have to consider more than five mirror strikes.
Moreover, this rectangle can only pass through another distinct point p1 exactly once. If we know that if p1 lies on a beam rectangle that is interrupted by an obstacle, there are only two possibilities: p1 lies on the unobstructed part of the rectangle between p0 and the obstruction. Or else it lies on the shaded part. We can determine which rectangles that pass through p0 also pass through p1, and then for each one determine whether p1 is in the shaded part.
I suspect this can be done with some computational geometry (with a fair number of cases in it) without resorting to a brute-force ray-casting technique.