/// <summary> /// Constructor taking in List of List of vertices. The first list will be the outer boundary and the rest are the inner boundaries /// </summary> /// <param name="vertxIndices">List of List of vertices. The first list will be the outer boundary and the rest are the inner boundaries</param> public IndexFace(IList <IList <int> > vertxIndices, ref IDictionary <int, XYZ> meshVertices) { int vertexCount = vertxIndices?.Count ?? 0; if (vertexCount == 0) { return; } IndexOuterBoundary = vertxIndices[0]; SetupEdges(IndexOuterBoundary, 0); if (vertexCount > 1) { vertxIndices.RemoveAt(0); IndexedInnerBoundaries = vertxIndices; foreach (IList <int> innerBound in IndexedInnerBoundaries) { int idxOffset = OuterAndInnerBoundaries.Count; SetupEdges(innerBound, idxOffset); } } // Create normal from only the outer boundary IList <XYZ> vertices = new List <XYZ>(); foreach (int idx in IndexOuterBoundary) { vertices.Add(meshVertices[idx]); } Normal = TriangleMergeUtil.NormalByNewellMethod(vertices); }
/// <summary> /// Constructor taking a list of vertex indices (face without hole) /// </summary> /// <param name="vertxIndices">the list of vertex indices (face without hole)</param> public IndexFace(IList <int> vertxIndices, ref IDictionary <int, XYZ> meshVertices) { IndexOuterBoundary = vertxIndices; SetupEdges(IndexOuterBoundary, 0); IList <XYZ> vertices = new List <XYZ>(); foreach (int idx in IndexOuterBoundary) { vertices.Add(meshVertices[idx]); } Normal = TriangleMergeUtil.NormalByNewellMethod(vertices); }