Namespace gs
Classes
AutoHoleFill
Work in progress. Idea is that this class will analyze the hole and choose correct filling strategy. Mainly just calling other fillers.
Also contains prototype of filler that decomposes hole into spans based on normals and then uses PlanarSpansFiller. See comments, is not really functional.
EditMeshSpatial
For use case where we are making local edits to a source mesh. We mask out removed triangles from base mesh SpatialDS, and raycast new triangles separately.
LinearFalloff
returns 1 in range [0,ConstantRange], and then falls off to 0 in range [ConstantRange,1]
MarchingCubesPro
MergeCoincidentEdges
Merge coincident edges.
MeshAssembly
Given an input mesh, try to decompose it's connected components into parts with some semantics - solids, open meshes, etc.
MeshAutoRepair
Mesh Auto Repair top-level driver.
TODO:
- remove degenerate faces (which may still have all edges > length)
- this is tricky, in many CAD meshes these faces can't just be collapsed. But can often remove via flipping...?
MeshInsertProjectedPolygon
Inserts a polygon into a mesh using a planar projection. You provide a projection frame and either the polygon in the frame's XY-coordinate system, or a DCurve3 space curve that will be projected.
Currently you must also provide a seed triangle, that intersects the curve. We flood-fill from the vertices of that triangle to find the interior vertices, and hence the set of faces that are modified.
The insertion operation splits the existing mesh edges, so the inserted polygon will have more segments than the input polygon, in general. If you set SimplifyInsertion = true, then we collapse these extra edges, so you (should) get back an edge loop with the same number of vertices. However, on a non-planar mesh this means the edges will no longer lie on the input surface.
If RemovePolygonInterior = true, the faces inside the polygon are deleted
returns: ModifiedRegion: this is the RegionOperator created to subset the mesh for editing. You can use this to access the modified mesh
InsertedPolygonVerts: the output vertex ID for Polygon[i]. This does not include the intermediate vertices, it's a 1-1 correspondence.
InsertedLoop: inserted edge loop on output mesh
InteriorTriangles: the triangles inside the polygon, null if RemovePolygonInterior=true
If you would like to change the behavior after the insertion is computed, you can subclass and override BackPropagate().
[TODO] currently we construct a planar BVTree (but 3D) to map the new vertices to 3D via barycentric interpolation. However we could do this inline. MeshInsertUVPolyCurve needs to fully support working on separate coordinate set (it tries via Get/Set PointF, but it is not 100% working), and it needs to let client know about poke and split events, w/ bary-coords, so that we can compute the new 3D positions.
MeshRepairOrientation
MeshScalarSamplingGrid
Sample a scalar function on a discrete grid. Can sample full grid, or compute values around a specific iso-contour and then fill in rest of grid with correctly-signed values via fast sweeping (this is the default)
TODO:
- I think we are over-exploring the grid most of the time. eg along an x-ray that intersects the surface, we only need at most 2 cells, but we are computing at least 3, and possibly 5.
- it may be better to use something like bloomenthal polygonizer continuation? where we are keeping track of active edges instead of active cells?
MeshSpatialSort
This class sorts a set of mesh components.
MeshSpatialSort.ComponentMesh
MeshSpatialSort.MeshSolid
MeshStitchLoops
Stitch together two edge loops without any constraint that they have the same vertex count (otherwise can use MeshEditor.StitchLoop / StitchUnorderedEdges).
[TODO]
- something smarter than stitch_span_simple(). For example, equalize length we have travelled along the span. Could also use normals to try to keep span "smooth"
- currently Loop0 and Loop1 need to be reversed/not depending on whether we are stitching "through" mesh or not. If not set properly, then fill self-intersects. Could we (optionally) resolve this automatically, eg by checking total of the two alternatives?
MeshTopology
Extract topological information about the mesh based on identifying semantic edges/vertices/etc
WIP
MeshWindingNumberGrid
Sample mesh winding number (MWN) on a discrete grid. Can sample full grid, or compute MWN values along a specific iso-contour and then fill in rest of grid with correctly-signed values via fast sweeping (this is the default)
TODO:
- I think we are over-exploring the grid most of the time. eg along an x-ray that intersects the surface, we only need at most 2 cells, but we are computing at least 3, and possibly 5.
- it may be better to use something like bloomenthal polygonizer continuation? where we are keeping track of active edges instead of active cells?
MinimalHoleFill
Construct a "minimal" fill surface for the hole. This surface is often quasi-developable, reconstructs sharp edges, etc. There are various options.
PointSetHashtable
PointSetHashtable.PointList
RemesherPro
Extension to Remesher that is smarter about which edges/vertices to touch:
- queue tracks edges that were affected on last pass, and hence might need to be updated
- FastSplitIteration() just does splits, to reach target edge length as quickly as possible
- RemeshIteration() applies remesh pass for modified edges
- TrackedSmoothPass() smooths all vertices but only adds to queue if edge changes enough
- TrackedProjectionPass() same
RemoveDuplicateTriangles
Remove duplicate triangles.
RemoveOccludedTriangles
Remove "occluded" triangles, ie triangles on the "inside" of the mesh. This is a fuzzy definition, current implementation is basically computing something akin to ambient occlusion, and if face is fully occluded, then we classify it as inside and remove it.
SmoothedHoleFill
This fills a hole in a mesh by doing a trivial fill, optionally offsetting along a fixed vector, then doing a remesh, then a laplacian smooth, then a second remesh.
WyvillFalloff
returns 1 in range [0,ConstantRange], and then falls off to 0 in range [ConstantRange,1]