I'm not entirely sure if your problem is fully defined, but here's one approach to start with, discretizing boundaries of finite components and showing them:. CylindricalDecomposition
is not limited to supporting only infinite lines, when it is provided with suitable exact definitions line segments are fine too.
With[{lines =
ArrayMesh[{{1, 1, 0, 1}, {1, 1, 1, 1}, {0, 1, 0, 1}}] //
MeshPrimitives[#, 1] &},
RegionDifference[FullRegion[2],
RegionUnion[Rationalize[lines, 0]]] //
Refine[RegionMember[#, {x, y}], Element[x | y, Reals]] & //
CylindricalDecomposition[#, {x, y}, "Components"] &] //
Map[ImplicitRegion[#, {x, y}] &] // Select[BoundedRegionQ] //
Map[Quiet@*BoundaryDiscretizeRegion] // Show
With[{lines = {Line[{{0., 92.2227}, {431.147, 750.}}],
Line[{{301.72, 750.}, {446.159, 0.}}],
Line[{{123.934, 750.}, {390.253, 0.}}],
Line[{{494., 432.03}, {0.470817, 750.}}],
Line[{{0., 388.081}, {494., 308.166}}]}},
RegionDifference[FullRegion[2],
RegionUnion[Rationalize[lines, 0]]] //
Refine[RegionMember[#, {x, y}], Element[x | y, Reals]] & //
CylindricalDecomposition[#, {x, y}, "Components"] &] //
Map[ImplicitRegion[#, {x, y}] &] // Select[BoundedRegionQ] //
Map[Quiet@*BoundaryDiscretizeRegion] // Show
You can also replace FullRegion[2]
with Quiet@BoundingRegion[RegionUnion[Rationalize[lines, 0]]]
in the latter case (Quiet
is for surpressing a strange, spurious error message) for getting tiles which would otherwise seem to be part of the unbounded exterior:
One might ask why this implicit bounding rectangle would be assumed. One could also consider, for instance, in this case a convex hull (like ConvexHullRegion[Join @@ Rationalize[lines[[All, 1]], 0]]
):