protected override void begin_smooth() { base.begin_smooth(); if (LocalSmoothingRings > 0) { smoothV.Clear(); if (LocalSmoothingRings == 1) { for (int i = 0; i < CurrentLoopV.Count; ++i) { smoothV.Add(CurrentLoopV[i]); foreach (int nbrv in mesh.VtxVerticesItr(CurrentLoopV[i])) { smoothV.Add(nbrv); } } } else { MeshVertexSelection select = new MeshVertexSelection(mesh); select.Select(CurrentLoopV); select.ExpandToOneRingNeighbours(LocalSmoothingRings); foreach (int vid in select) { smoothV.Add(vid); } } } }
protected bool check_for_cracks(DMesh3 mesh, out int boundary_edge_count, double crack_tol = MathUtil.ZeroTolerancef) { boundary_edge_count = 0; var boundary_verts = new MeshVertexSelection(mesh); foreach (int eid in mesh.BoundaryEdgeIndices()) { Index2i ev = mesh.GetEdgeV(eid); boundary_verts.Select(ev.a); boundary_verts.Select(ev.b); boundary_edge_count++; } if (boundary_verts.Count == 0) { return(false); } AxisAlignedBox3d bounds = mesh.CachedBounds; var borderV = new PointHashGrid3d <int>(bounds.MaxDim / 128, -1); foreach (int vid in boundary_verts) { Vector3d v = mesh.GetVertex(vid); var result = borderV.FindNearestInRadius(v, crack_tol, (existing_vid) => { return(v.Distance(mesh.GetVertex(existing_vid))); }); if (result.Key != -1) { return(true); // we found a crack vertex! } borderV.InsertPoint(vid, v); } // found no cracks return(false); }