visit-dav / visit

VisIt - Visualization and Data Analysis for Mesh-based Scientific Data
https://visit.llnl.gov
BSD 3-Clause "New" or "Revised" License
422 stars 109 forks source link

Add ability to cap-off shell-like objects when they are clipped #19584

Open markcmiller86 opened 2 months ago

markcmiller86 commented 2 months ago

Is your feature request related to a problem?

When we clip a solid, volumetric object, we get a nice flat surface where the clip was performed.

When we clip a surface object (e.g. shell surface of a sphere), we wind up seeing inside the clipped object...such as shown in the image below...

image

ASC users would like the option to "cap" such surfaces when they are clipped. I assume this would be an option on the Clip operator. But, that supports spherical clips and I honestly don't know if "cap"ing on a clipped sphere is necessary (or easy).

The solution is more complicated than introducing a single polygonal facet because the cap may be non-convex. In addition, if the surface is composed of non-triangular facets (e.g. quads) and those quads are not planar, thats an additional complexity.

markcmiller86 commented 2 months ago

ASC user would like in the next few months.

markcmiller86 commented 1 month ago

The user is Scott McKinely.

And, I have a thought how to do this. Take the intersection of the clip plane with the surface elements. This will define a set of line segments. Each segment is the intersection of the clip plane with one of the elements and each segment can know which element produced it. We know the element connectivity of the surface. So, we transfer that connectivity knowledge to the resulting line segments. The resulting information defines a loop traversal of the points defining the line segments that we can use to define the cap polygon. This works for concave cases fine as long as there are no internal surfaces which the example here (probably poorly selected) does have.

markcmiller86 commented 1 month ago

Now that I think about it though, even in parallel decomposed case, after each MPI rank intersects the clip plane with the surface facets, we can make a legitimate case I think that all the resulting line segments can be collected to a single MPI rank. If the surface is water tight, then discovering the correct right-hand-ruled-loop walk of the segments to form the vertices of an uber-polygon end-cap would be fairly straightforward I think.

JustinPrivitera commented 1 month ago

Can't we even go further, and collect all watertight surfaces and make a polygon for each of them?

markcmiller86 commented 1 month ago

Can't we even go further, and collect all watertight surfaces and make a polygon for each of them?

You are talking about a case where the surface object involves multiple disparate pieces to be capped...like maybe the legs of an octopus getting cut? I think under the right conditions that should be doable too. If the line segment data being gathered to one rank carried along the topological relationships of the surface entities from which the line segments came, then very doable.

JustinPrivitera commented 1 month ago

You are talking about a case where the surface object involves multiple disparate pieces to be capped...like maybe the legs of an octopus getting cut?

Yup.

If the line segment data being gathered to one rank carried along the topological relationships of the surface entities from which the line segments came, then very doable.

I think the way to approach this is to form a graph (or graphs) based on the vertices and edges in the plane where the slice was performed. Then find all chordless cycles in the graphs and create a polygon for each one.

JustinPrivitera commented 1 month ago

So in the picture you have up above, that approach would yield two polygons, one for the top half and one for the bottom half.

markcmiller86 commented 1 month ago

Then find all chordless cycles in the graphs and create a polygon for each one.

What is a "chordless cycle"?

JustinPrivitera commented 1 month ago

What is a "chordless cycle"?

https://en.wikipedia.org/wiki/Cycle_(graph_theory)#Chordless_cycle

JustinPrivitera commented 1 month ago

There are algorithms to find all of them. Here is the first result off of duckduckgo: https://stackoverflow.com/questions/4022662/find-all-chordless-cycles-in-an-undirected-graph