Checking whether a location is inside a fence is typically a two-step process:
        1: Check if the location is inside of the 2D projection of the fence.
        2: If 1 is true, check if the location is inside the z range of the fence.
    

The z range is defined by the extrusion of the fence and the min/max range of the fence in z direction. The following sketches illustrate the checks.

Location outside     Location inside     Fence


The check of the 2D projection supports holes. Locations inside of holes are considered to be outside of the fence.



The check for flat fences with extrusions, for example a shelf, returns locations as inside which are inside the 2D projection of the fence and within the extrusion. Points above the extrusion are outside.



The check for fences that are tilted again starts with the 2D projection. If a location is inside the 2D projection, the check in z direction is effectively performed on the bounding box given by the z range of the fence plus the extrusion. This might return locations as inside which are technically outside.