Skip to content

Commit 0197257

Browse files
committed
add random shifts to find_intersection()
closes libMesh#3496
1 parent bc2b494 commit 0197257

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/mesh/mesh_triangle_holes.C

+4-1
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,14 @@ namespace
105105
//
106106
// If the intersection is a "glancing" one at a corner, return -1.
107107
Real find_intersection(const Point & source,
108-
const Point & ray_target,
108+
const Point & ray_target_0,
109109
const Point & edge_pt0,
110110
const Point & edge_pt1,
111111
const Point & edge_pt2)
112112
{
113+
// Add a random small shift to the source and three points
114+
const Point ray_target = ray_target_0 + Point((Real)(rand() % 5000 + 5000) / 5000.0 * libMesh::TOLERANCE * libMesh::TOLERANCE, (Real)(rand() % 5000 + 5000) / 5000.0 * libMesh::TOLERANCE * libMesh::TOLERANCE, 0.0);
115+
113116
// Quick and more numerically stable check
114117
if (!is_intersection(source, ray_target, edge_pt0, edge_pt1))
115118
return -1;

0 commit comments

Comments
 (0)