holoviz-topics / EarthSim

Tools for working with and visualizing environmental simulations.
https://earthsim.holoviz.org
BSD 3-Clause "New" or "Revised" License
65 stars 21 forks source link

Editing large meshes #323

Open philippjfr opened 4 years ago

philippjfr commented 4 years ago

Through several discussions with scientists and engineers in the space of environmental simulation we have narrowed down several approaches to editing large meshes (1M+ vertices). Here I will describe the three main approaches and then discuss the work that will go into making some of these workflows feasible.

Editing through boundary conditions

This is one of the most common approaches and one of the main goals behind the annotators. This approach has the advantage that it allows the mesh to be regenerated automatically whenever the specification changes, without requiring any manual re-work. The workflow can be broken down into a linear pipeline:

  1. Draw multiple connecting arcs and refine points
  2. Add properties to arcs, feature vertices, nodes and refine points
  3. Generate Polygon from connecting arcs
  4. Mesh polygon (e.g. using xmsmesh)
  5. Go back and make further edits to arcs and refine points to regenerate mesh until desired mesh is achieved

We will perform some additional work to build such a full workflow. Specifically step 3. still needs to be demonstrated.

Editing individual mesh nodes

Another common task when working with large meshes is the ability to edit or delete some portion of the mesh. Existing tools rarely scale well for truly large meshes of 1M+ nodes, so some users were using workaround of breaking up meshes, editing some portion of a smaller mesh and then stitching them back together. A tool that can handle a full sized mesh without manual splitting would therefore be very useful. Through discussion we settled on the following specification for this workflow:

  1. Once a mesh is loaded you should have the ability to render a subset of mesh as editable nodes. This subset should be selected using a tool, e.g. box-select, lasso-select, polygon; zooming is not sufficient here since a) subsetting would have to be redone on every zoom (very expensive) and mesh density can differ by a lot, so it can be difficult to get a region containing the nodes you want to edit without also getting a high-density region that makes editing difficult.
  2. Editing mode should be modal: you select a region, enter editing mode, make changes then exit editing mode which applies the changes to the full mesh.
  3. In editing mode the editor should allow dragging nodes, select and delete nodes, flip edges associated with the node.
    • Edge flipping should occur when tapping an edge.
    • When deleting a node it should redistribute edges
    • When deleting a region of nodes, need to consider what happens to holes, should ideally allow remeshing hole.
  4. When editing is done the full mesh is edited on the Python side and is re-rendered with datashader

**Might consider the ability to filter the mesh by some property (e.g. material)

Bulk editing

The last approach to mesh editing is bulk editing which roughly consists of:

  1. Allow selecting some subset of mesh nodes
  2. Run some algorithm on the subset to clean up/reorganize edges
  3. Rerender mesh

We are currently not considering supporting this workflow. This approach is used frequently not for editing the geometry but instead for smoothing bathymetry data.

Other tools to consider and look at