Skip to content

Commit

Permalink
deprecated DMesh3.vertex_is_boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
rms80 committed Dec 2, 2017
1 parent 7e5af8f commit 502ce02
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
6 changes: 3 additions & 3 deletions mesh/DMesh3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,10 +1462,10 @@ public int edge_other_t(int eID, int tid) {
}


// ugh need to deprecate this...weird API!
public bool vertex_is_boundary(int vID) {
[System.Obsolete("vertex_is_boundary will be removed in future, use IsBoundaryVertex instead")]
public bool vertex_is_boundary(int vID) {
return IsBoundaryVertex(vID);
}
}
public bool IsBoundaryVertex(int vID) {
foreach (int e in vertex_edges.ValueItr(vID)) {
if (edges[4 * e + 3] == InvalidID)
Expand Down
6 changes: 3 additions & 3 deletions mesh/DMesh3_edge_operators.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public MeshResult RemoveVertex(int vID, bool bRemoveAllTriangles = true, bool bP
int eid = find_edge(oa,ob);
if (edge_is_boundary(eid))
continue;
if (vertex_is_boundary(oa) || vertex_is_boundary(ob))
if (IsBoundaryVertex(oa) || IsBoundaryVertex(ob))
return MeshResult.Failed_WouldCreateBowtie;
}
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public MeshResult RemoveTriangle(int tID, bool bRemoveIsolatedVertices = true, b
// (that vtx already has 2 boundary edges, and we would add two more)
if (bPreserveManifold) {
for (int j = 0; j < 3; ++j) {
if (vertex_is_boundary(tv[j])) {
if (IsBoundaryVertex(tv[j])) {
if (edge_is_boundary(te[j]) == false && edge_is_boundary(te[(j + 2) % 3]) == false)
return MeshResult.Failed_WouldCreateBowtie;
}
Expand Down Expand Up @@ -628,7 +628,7 @@ public MeshResult CollapseEdge(int vKeep, int vRemove, out EdgeCollapseInfo coll
//
// NOTE: potentially scanning all edges here...couldn't we
// pick up eac/bc/ad/bd as we go? somehow?
if ( bIsBoundaryEdge == false && vertex_is_boundary(a) && vertex_is_boundary(b) )
if ( bIsBoundaryEdge == false && IsBoundaryVertex(a) && IsBoundaryVertex(b) )
return MeshResult.Failed_InvalidNeighbourhood;


Expand Down
6 changes: 3 additions & 3 deletions mesh/MeshEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@ public bool ReinsertSubmesh(DSubmesh3 sub, ref int[] new_tris, out IndexMap SubT
if (done_v[sub_v] == false) {

// first check if this is a boundary vtx on submesh and maps to a bdry vtx on base mesh
if (submesh.vertex_is_boundary(sub_v)) {
if (submesh.IsBoundaryVertex(sub_v)) {
int base_v = (sub_v < sub.SubToBaseV.size) ? sub.SubToBaseV[sub_v] : -1;
if ( base_v >= 0 && Mesh.IsVertex(base_v) && sub.BaseBorderV[base_v] == true ) {
// [RMS] this should always be true, but assert in tests to find out
Debug.Assert(Mesh.vertex_is_boundary(base_v));
if (Mesh.vertex_is_boundary(base_v)) {
Debug.Assert(Mesh.IsBoundaryVertex(base_v));
if (Mesh.IsBoundaryVertex(base_v)) {
new_v = base_v;
}
}
Expand Down
2 changes: 1 addition & 1 deletion mesh/RegionRemesher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void RepairPossibleNonManifoldEdges()
if (Region.SubMesh.IsBoundaryEdge(eid))
continue;
Index2i edgev = Region.SubMesh.GetEdgeV(eid);
if (Region.SubMesh.vertex_is_boundary(edgev.a) && Region.SubMesh.vertex_is_boundary(edgev.b)) {
if (Region.SubMesh.IsBoundaryVertex(edgev.a) && Region.SubMesh.IsBoundaryVertex(edgev.b)) {
// ok, we have an internal edge where both verts are on the boundary
// now check if it is an edge in the base mesh
int base_a = Region.MapVertexToBaseMesh(edgev.a);
Expand Down
22 changes: 10 additions & 12 deletions mesh/Remesher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,13 @@ protected virtual ProcessResult ProcessEdge(int edgeID)
return ProcessResult.Failed_NotAnEdge;
bool bIsBoundaryEdge = (t1 == DMesh3.InvalidID);

// look up 'other' verts c (from t0) and d (from t1, if it exists)
Index3i T0tv = mesh.GetTriangle(t0);
int c = IndexUtil.find_tri_other_vtx(a, b, T0tv);
Index3i T1tv = (bIsBoundaryEdge) ? DMesh3.InvalidTriangle : mesh.GetTriangle(t1);
int d = (bIsBoundaryEdge) ? DMesh3.InvalidID : IndexUtil.find_tri_other_vtx( a, b, T1tv );
// look up 'other' verts c (from t0) and d (from t1, if it exists)
Index2i ov = mesh.GetEdgeOpposingV(edgeID);
int c = ov.a, d = ov.b;

Vector3d vA = mesh.GetVertex(a);
Vector3d vB = mesh.GetVertex(b);
double edge_len_sqr = (vA-vB).LengthSquared;
double edge_len_sqr = vA.DistanceSquared(vB);

begin_collapse();

Expand Down Expand Up @@ -358,10 +356,10 @@ protected virtual ProcessResult ProcessEdge(int edgeID)
// don't want to flip if it will invert triangle...tetrahedron sign??

// can we do this more efficiently somehow?
bool a_is_boundary_vtx = (MeshIsClosed) ? false : (bIsBoundaryEdge || mesh.vertex_is_boundary(a));
bool b_is_boundary_vtx = (MeshIsClosed) ? false : (bIsBoundaryEdge || mesh.vertex_is_boundary(b));
bool c_is_boundary_vtx = (MeshIsClosed) ? false : mesh.vertex_is_boundary(c);
bool d_is_boundary_vtx = (MeshIsClosed) ? false : mesh.vertex_is_boundary(d);
bool a_is_boundary_vtx = (MeshIsClosed) ? false : (bIsBoundaryEdge || mesh.IsBoundaryVertex(a));
bool b_is_boundary_vtx = (MeshIsClosed) ? false : (bIsBoundaryEdge || mesh.IsBoundaryVertex(b));
bool c_is_boundary_vtx = (MeshIsClosed) ? false : mesh.IsBoundaryVertex(c);
bool d_is_boundary_vtx = (MeshIsClosed) ? false : mesh.IsBoundaryVertex(d);
int valence_a = mesh.GetVtxEdgeCount(a), valence_b = mesh.GetVtxEdgeCount(b);
int valence_c = mesh.GetVtxEdgeCount(c), valence_d = mesh.GetVtxEdgeCount(d);
int valence_a_target = (a_is_boundary_vtx) ? valence_a : 6;
Expand Down Expand Up @@ -402,7 +400,7 @@ protected virtual ProcessResult ProcessEdge(int edgeID)
COUNT_SPLITS++;
MeshResult result = mesh.SplitEdge(edgeID, out splitInfo);
if ( result == MeshResult.Ok ) {
update_after_split(edgeID, a, b, splitInfo);
update_after_split(edgeID, a, b, ref splitInfo);
OnEdgeSplit(edgeID, a, b, splitInfo);
DoDebugChecks();
return ProcessResult.Ok_Split;
Expand All @@ -425,7 +423,7 @@ protected virtual ProcessResult ProcessEdge(int edgeID)
// The edge needs to inherit the constraint on the other pre-existing edge that we kept.
// In addition, if the edge vertices were both constrained, then we /might/
// want to also constrain this new vertex, possibly project to constraint target.
void update_after_split(int edgeID, int va, int vb, DMesh3.EdgeSplitInfo splitInfo)
void update_after_split(int edgeID, int va, int vb, ref DMesh3.EdgeSplitInfo splitInfo)
{
bool bPositionFixed = false;
if (constraints != null && constraints.HasEdgeConstraint(edgeID)) {
Expand Down
2 changes: 1 addition & 1 deletion mesh_ops/RegionOperator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void RepairPossibleNonManifoldEdges()
if (Region.SubMesh.IsBoundaryEdge(eid))
continue;
Index2i edgev = Region.SubMesh.GetEdgeV(eid);
if (Region.SubMesh.vertex_is_boundary(edgev.a) && Region.SubMesh.vertex_is_boundary(edgev.b)) {
if (Region.SubMesh.IsBoundaryVertex(edgev.a) && Region.SubMesh.IsBoundaryVertex(edgev.b)) {
// ok, we have an internal edge where both verts are on the boundary
// now check if it is an edge in the base mesh
int base_a = Region.MapVertexToBaseMesh(edgev.a);
Expand Down
2 changes: 1 addition & 1 deletion queries/MeshValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static ValidationStatus IsBoundaryLoop(DMesh3 mesh, EdgeLoop loop)
int N = loop.Vertices.Length;

for ( int i = 0; i < N; ++i ) {
if ( ! mesh.vertex_is_boundary(loop.Vertices[i]) )
if ( ! mesh.IsBoundaryVertex(loop.Vertices[i]) )
return ValidationStatus.NotBoundaryVertex;
}

Expand Down

0 comments on commit 502ce02

Please sign in to comment.