diff --git a/src/mesh/mesh_triangle_holes.C b/src/mesh/mesh_triangle_holes.C index 0250c1ea29d..9b7d5289930 100644 --- a/src/mesh/mesh_triangle_holes.C +++ b/src/mesh/mesh_triangle_holes.C @@ -123,7 +123,7 @@ namespace const Real denom = edgedx * raydy - edgedy * raydx; // divide-by-zero means the segments are parallel - if (denom == 0) + if (std::abs(denom) <= libMesh::TOLERANCE * libMesh::TOLERANCE) return -1; const Real one_over_denom = 1 / denom; @@ -136,12 +136,13 @@ namespace const Real t = t_num * one_over_denom; // There's an intersection between the ray line and the edge? - if (t >= 0 && t < 1) + if (t >= -libMesh::TOLERANCE * libMesh::TOLERANCE && + t - 1.0 < libMesh::TOLERANCE * libMesh::TOLERANCE) { // There's an intersection right on a vertex? We'll count it // if and only if it isn't a "double-intersection", if the // *next* edge in line is on the other side of our ray. - if (!t) + if (std::abs(t) <= libMesh::TOLERANCE * libMesh::TOLERANCE) { const Real prevdx = edge_pt0(0)-ray_target(0), prevdy = edge_pt0(1)-ray_target(1);