Effective area for each boundary (similar to voronoi for points)

I am trying to split a surface something similar to what voronoi does, but without having to split in multiple zones. I basically need to create 4 zones for a rectangle and 3 zones for a triangle. Of course it would be amazing if it could be generalized for any geometry.

I uploaded the file that i was working on but there is not much to it.

Effective surface on line.gh (17.8 KB)

Something like that ¿