29 const auto n = v1.
cross(v2);
30 const Real norm = n.norm();
32 mooseError(
"Triangle: cannot compute the normal of a degenerate triangle.");
40 const auto & a = line_segment.
start();
41 const auto & b = line_segment.
end();
44 const Point dir = b - a;
52 const Real det = edge1 * pvec;
53 if (std::abs(det) < eps)
56 const Real inv_det = 1.0 / det;
60 const Real u = (tvec * pvec) * inv_det;
61 if (!MooseUtils::absoluteFuzzyGreaterEqual(u, 0.0, eps) ||
62 !MooseUtils::absoluteFuzzyLessEqual(u, 1.0, eps))
67 const Real v = (dir * qvec) * inv_det;
68 if (!MooseUtils::absoluteFuzzyGreaterEqual(v, 0.0, eps) ||
69 !MooseUtils::absoluteFuzzyLessEqual(u + v, 1.0, eps))
73 const Real t = (edge2 * qvec) * inv_det;
74 if (!MooseUtils::absoluteFuzzyGreaterEqual(t, 0.0, eps) ||
75 !MooseUtils::absoluteFuzzyLessEqual(t, 1.0, eps))
79 intersect_p = a + dir * t;
95 Real max_sq_dist = 0.0;
98 const Real dist_sq = (*p - centroid).norm_sq();
99 if (dist_sq > max_sq_dist)
100 max_sq_dist = dist_sq;
103 const Real
radius = std::sqrt(max_sq_dist);
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Ball primitive: a circle in 2D or a sphere in 3D.
The LineSegment class is used by the LineMaterialSamplerBase class and for some ray tracing stuff.
const Point & end() const
Ending of the line segment.
const Point & start() const
Beginning of the line segment.
libMesh::Point normal() const
Normal vector of the triangle.
bool intersect(const LineSegment &l, libMesh::Point &intersect_p) const
Check if a line segment intersects this triangle.
Ball computeBoundingBall() const override
Compute a bounding ball for this triangle.
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
static constexpr Real TOLERANCE
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real