Example #1
0
        /// <summary>
        /// find base-mesh interior vertices of region (ie does not include region boundary vertices)
        /// </summary>
        public HashSet <int> CurrentBaseInteriorVertices()
        {
            var          verts   = new HashSet <int>();
            IndexHashSet borderv = Region.BaseBorderV;

            foreach (int tid in cur_base_tris)
            {
                Index3i tv = BaseMesh.GetTriangle(tid);
                if (borderv[tv.a] == false)
                {
                    verts.Add(tv.a);
                }

                if (borderv[tv.b] == false)
                {
                    verts.Add(tv.b);
                }

                if (borderv[tv.c] == false)
                {
                    verts.Add(tv.c);
                }
            }
            return(verts);
        }
Example #2
0
        public void ComputeBoundaryInfo(IEnumerable <int> triangles, int tri_count)
        {
            // set of base-mesh triangles that are in submesh
            IndexFlagSet sub_tris = new IndexFlagSet(BaseMesh.MaxTriangleID, tri_count);

            foreach (int ti in triangles)
            {
                sub_tris[ti] = true;
            }

            BaseBorderV   = new IndexHashSet();
            BaseBorderE   = new IndexHashSet();
            BaseBoundaryE = new IndexHashSet();

            // Iterate through edges in submesh roi on base mesh. If
            // one of the tris of the edge is not in submesh roi, then this
            // is a boundary edge.
            //
            // (edge iteration via triangle iteration processes each internal edge twice...)
            foreach (int ti in triangles)
            {
                Index3i tedges = BaseMesh.GetTriEdges(ti);
                for (int j = 0; j < 3; ++j)
                {
                    int     eid  = tedges[j];
                    Index2i tris = BaseMesh.GetEdgeT(eid);
                    if (tris.b == DMesh3.InvalidID || sub_tris[tris.a] != sub_tris[tris.b])
                    {
                        if (tris.b == DMesh3.InvalidID)
                        {
                            BaseBoundaryE[eid] = true;
                        }
                        else
                        {
                            BaseBorderE[eid] = true;
                        }

                        Index2i ve = BaseMesh.GetEdgeV(eid);
                        BaseBorderV[ve.a] = true;
                        BaseBorderV[ve.b] = true;
                    }
                }
            }
        }