14 #include "libmesh/plane.h" 15 #include "libmesh/vector_value.h" 24 Real p0_p1_2 = p0_p1.norm_sq();
25 Real perp = p0_p(0) * p0_p1(0) + p0_p(1) * p0_p1(1) + p0_p(2) * p0_p1(2);
26 Real t = perp / p0_p1_2;
27 bool on_segment =
true;
29 if (t < 0.0 || t > 1.0)
40 closest_p =
_p0 + p0_p1 * t;
62 return closest_point(p,
false, closest_p) && closest_p.absolute_fuzzy_equals(p);
82 Point pl0 = pl.get_planar_point();
87 Real denominator = I *
N;
102 Real d = numerator / denominator;
105 if (d + libMesh::TOLERANCE < 0 || d - libMesh::TOLERANCE > (
_p1 -
_p0).norm())
108 intersect_p = d * I +
_p0;
164 if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
166 intersect_p =
_p0 + s * a;
void setEnd(const Point &p1)
Sets the end of the line segment.
const Point & end() const
Ending of the line segment.
auto norm() const -> decltype(std::norm(Real()))
void to_json(nlohmann::json &json, const LineSegment &l)
The LineSegment class is used by the LineMaterialSamplerBase class and for some ray tracing stuff...
Point closest_point(const Point &p) const
Returns the closest point on the LineSegment to the passed in point.
ADRealEigenVector< T, D, asd > abs(const ADRealEigenVector< T, D, asd > &)
void dataStore(std::ostream &stream, LineSegment &l, void *context)
bool intersect(const Plane &pl, Point &intersect_p) const
void setStart(const Point &p0)
Sets the beginning of the line segment.
void set(const Point &p0, const Point &p1)
Sets the points on the line segment.
bool closest_normal_point(const Point &p, Point &closest_p) const
Finds the closest point on the Line determined by the Line Segments.
const Point & start() const
Beginning of the line segment.
TypeVector< typename CompareTypes< Real, T2 >::supertype > cross(const TypeVector< T2 > &v) const
bool contains_point(const Point &p) const
Determines whether a point is in a line segment or not.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void dataLoad(std::istream &stream, LineSegment &l, void *context)