Skip to content

Commit

Permalink
IsBoundaryLoop can now take a different mesh to check
Browse files Browse the repository at this point in the history
  • Loading branch information
rms80 committed May 9, 2018
1 parent 5d97cc4 commit bff0f42
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions mesh/EdgeLoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,18 @@ public bool IsInternalLoop()


/// <summary>
/// Check if all edges of this loop are boundary edges
/// Check if all edges of this loop are boundary edges.
/// If testMesh != null, will check that mesh instead of internal Mesh
/// </summary>
public bool IsBoundaryLoop()
public bool IsBoundaryLoop(DMesh3 testMesh = null)
{
DMesh3 useMesh = (testMesh != null) ? testMesh : Mesh;

int NV = Vertices.Length;
for (int i = 0; i < NV; ++i ) {
int eid = Mesh.FindEdge(Vertices[i], Vertices[(i + 1) % NV]);
int eid = useMesh.FindEdge(Vertices[i], Vertices[(i + 1) % NV]);
Debug.Assert(eid != DMesh3.InvalidID);
if (Mesh.IsBoundaryEdge(eid) == false)
if (useMesh.IsBoundaryEdge(eid) == false)
return false;
}
return true;
Expand Down
8 changes: 5 additions & 3 deletions mesh/EdgeSpan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ public bool IsInternalSpan()
}


public bool IsBoundarySpan()
public bool IsBoundarySpan(DMesh3 testMesh = null)
{
DMesh3 useMesh = (testMesh != null) ? testMesh : Mesh;

int NV = Vertices.Length;
for (int i = 0; i < NV-1; ++i ) {
int eid = Mesh.FindEdge(Vertices[i], Vertices[i + 1]);
int eid = useMesh.FindEdge(Vertices[i], Vertices[i + 1]);
Debug.Assert(eid != DMesh3.InvalidID);
if (Mesh.IsBoundaryEdge(eid) == false)
if (useMesh.IsBoundaryEdge(eid) == false)
return false;
}
return true;
Expand Down

0 comments on commit bff0f42

Please sign in to comment.