How to create planar regions from a dense set of intersecting lines?

Hi everyone,
I’m working on a workflow to calculate cut and fill volumes between two terrain surfaces:

  • One mesh represents the existing topography.
  • The other mesh represents the design surface (building pad levels).

To compare them, I want to generate two topologically similar meshes so I can analyze elevation differences face by face.
My idea is to:

  1. Project all edges from both meshes onto a base plane.
  2. Find all the regions (closed loops) formed by the intersections of these edges.
  3. Use those regions as faces for a new mesh, which I can then project upward to match both original meshes.

So far, I’ve tried using the “Geometric Cell (Create Regions from a List of Curves)” component from Heteroptera, and it works only when the input lines are clearly distinct.
However, when edges are very close but not identical, the component struggles or fails to generate proper regions.

:red_question_mark:My main question:
How can I robustly compute planar regions (closed curves) from a set of intersecting polylines — especially when many are nearly overlapping?

Any tips or alternative approaches are appreciated.
Thanks!

would you mind attaching a sample with meshes to play with?

landscape ex.gh (15.3 KB)

this is a random example of my algorithm. the key point I’m asking about is this

In this example it works but when I have 2 set of lines with lot of density in certain areas with some lines very close to each other it doesn’t work properly, so I’m searching for a more consistent solution for getting the regions.

Maybe later when I have the chance I’ll post a case where it doesn’t work

the attached script doesn’t work in my R8 Rhino because of the many Nulls that are generated in the Hit/Miss output of MeshRay:


[edit]@wim in R8 SR22 (8.22.25196.13001, 2025-07-15) MeshRay component outputs Nulls instead of Falses: the hit/miss output lists only True or Nulls, no Falses


but if I Replace hit/miss Nulls with Falses it produces a result:

landscape ex_Replace_Nulls.gh (18.5 KB)

[edit] instead of using Heteroptera’s Geometric Region + Boundary Surface (which I guess becomes progressively slower the more dense your Meshes are) you could shatter the projected Mesh Edges into smaller Line fragments using Multiple Curve Intersections, then triangulate those fragments directly? something like this, with noobish use of Mesh.CreateFromLines (but note that you need to increase the Face Valence -in the example to 6: Y variable- to have it working…)

landscape ex_inno.gh (22.5 KB)

I have rhino7 and my HIT output in the mesh ray component is True or False. I don’t know why you get nulls instead of false in rhino8, but you already solve this thing

landscape_topoIDENT_jvs.gh (25.7 KB)
not sure if that works with rhino7 but think it should.

…playing with different seeds i found a mistake.
sorry.
improved a bit:
landscape_topoIDENT_jvs_02.gh (27.2 KB)