-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves the error in EPA when the query point is colinear with an ed…
…ge (#417) When the query point is colinear with an edge, treat this edge as an internal edge, and continue to expand the boundary.
- Loading branch information
1 parent
8cc285f
commit 08d0bb2
Showing
3 changed files
with
122 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1160,7 +1160,6 @@ static bool ComputeVisiblePatchRecursiveSanityCheck( | |
return true; | ||
} | ||
#endif | ||
|
||
/** | ||
* This function contains the implementation detail of ComputeVisiblePatch() | ||
* function. It should not be called by any function other than | ||
|
@@ -1187,19 +1186,40 @@ static void ComputeVisiblePatchRecursive( | |
if (!isOutsidePolytopeFace(&polytope, g, &query_point)) { | ||
// Cannot see the neighbouring face from the new vertex. | ||
|
||
// TODO([email protected]): when the new vertex is colinear with a | ||
// border edge, we should remove the degenerate triangle. We could remove | ||
// the middle vertex on that line from the polytope, and then reconnect | ||
// the polytope. | ||
if (triangle_area_is_zero(query_point, f.edge[edge_index]->vertex[0]->v.v, | ||
f.edge[edge_index]->vertex[1]->v.v)) { | ||
FCL_THROW_FAILED_AT_THIS_CONFIGURATION( | ||
"The new vertex is colinear with an existing edge. The added " | ||
"triangle would be degenerate."); | ||
if (!triangle_area_is_zero(query_point, | ||
f.edge[edge_index]->vertex[0]->v.v, | ||
f.edge[edge_index]->vertex[1]->v.v)) { | ||
// If query point is outside of the face g, and the triangle | ||
// (query_point, v[0], v[1]) has non-zero area, then the edge | ||
// f.edge[edge_index] is a border edge, and we will connect the query | ||
// point with this border edge to form a triangle. Otherwise, this edge | ||
// is not a border edge. | ||
border_edges->insert(f.edge[edge_index]); | ||
return; | ||
} | ||
border_edges->insert(f.edge[edge_index]); | ||
return; | ||
} | ||
// We regard the edge f.edge[edge_index] not as an internal edge (not a | ||
// border edge), if it satisfies one of the following two conditions | ||
// 1. The face g is visible to the query point. | ||
// 2. The triangle formed by the edge and the query point has zero area. | ||
// The first condition is obvious. Here we explain the second condition: | ||
// For this triangle to have no area, the query point must be co-linear with | ||
// a candidate border edge. That means it is simultaneously co-planar with | ||
// the two faces adjacent to that edge. But to be in this branch, one face | ||
// was considered to be visible and the other to not be visible -- an | ||
// inconsistent classification. | ||
|
||
// The solution is to unify that classification. We can consider both | ||
// faces as being visible or not. If we were to consider them not | ||
// visible, we would shrink the size of the visible patch (making this | ||
// slightly faster), but would risk introducing co-planar faces into the | ||
// polytope. We choose to consider both faces as being visible. At the | ||
// cost of a patch boundary with more edges, we guarantee that we don't | ||
// add co-planar faces. | ||
|
||
// It may be that co-planar faces are permissible and a smaller | ||
// patch is preferred. This is still an open problem.For now, we go with | ||
// the "safe" choice. | ||
visible_faces->insert(g); | ||
internal_edges->insert(f.edge[edge_index]); | ||
for (int i = 0; i < 3; ++i) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters