Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "Ball.h" 13 : #include "GeometryBase.h" 14 : #include "libmesh/point.h" 15 : 16 : class LineSegment; 17 : 18 : /** 19 : * Triangle geometry helper. 20 : */ 21 : class Triangle : public GeometryBase 22 : { 23 : public: 24 : Triangle() = default; 25 : Triangle(const libMesh::Point & p0, const libMesh::Point & p1, const libMesh::Point & p2); 26 : 27 0 : ~Triangle() override = default; 28 : 29 : /** 30 : * Normal vector of the triangle. 31 : */ 32 : libMesh::Point normal() const; 33 : 34 : /** 35 : * Check if a line segment intersects this triangle. 36 : */ 37 : bool intersect(const LineSegment & l, libMesh::Point & intersect_p) const; 38 : 39 : /** 40 : * Check if a line segment intersects this triangle, without returning the intersection point. 41 : */ 42 : bool intersect(const LineSegment & line_segment) const override; 43 : 44 : /** 45 : * Compute a bounding ball for this triangle. 46 : */ 47 : Ball computeBoundingBall() const override; 48 : 49 : private: 50 : libMesh::Point _p0, _p1, _p2; 51 : };