Skip to main content
1 of 4
Taiki
  • 5.3k
  • 26
  • 34

I think this may work though I'm not sure why. I made it up through trial and error, aiding by #18514. You'll need nextCandidate and FindFace from there.

First of all since you haven't provide some example data, let me generate some wireframe:

mesh = MeshRegion[
  MeshCoordinates[#],
  MeshCells[#, 1]
]& @ VoronoiMesh[RandomReal[{0, 1}, {100, 2}]]

Wireframe

Then,

graph1 = Graph[
  MeshCoordinates[mesh],
  MeshCells[mesh, 1] /. Line[{start_, end_}] -> {start, end},
  VertexCoordinates -> MeshCoordinates[mesh],
  GraphLayout -> "PlanarEmbedding"
];
graph2 = Graph[
  MeshCells[mesh, 1] /. Line[{start_, end_}] -> start <-> end
];
adj = AdjacencyMatrix[graph2];
graph3 = AdjacencyGraph[adj, GraphLayout -> "PlanarEmbedding"];
faces = FindFace[graph3];
meshpolygons = MeshRegion[
  VertexList[graph1][[VertexList[graph2]]],
  Polygon /@ Most[SortBy[faces, Length]]
]

Filled wireframe

Let's see if the method works for your specific wireframe.

Taiki
  • 5.3k
  • 26
  • 34