Same as this example, but supporting the intersection of three regions. The code could be easily generalized to more regions.