www.mooseframework.org
LineSegment.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* DO NOT MODIFY THIS HEADER */
3 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
4 /* */
5 /* (c) 2010 Battelle Energy Alliance, LLC */
6 /* ALL RIGHTS RESERVED */
7 /* */
8 /* Prepared by Battelle Energy Alliance, LLC */
9 /* Under Contract No. DE-AC07-05ID14517 */
10 /* With the U. S. Department of Energy */
11 /* */
12 /* See COPYRIGHT for full restrictions */
13 /****************************************************************/
14 
15 #ifndef LINESEGMENT_H
16 #define LINESEGMENT_H
17 
18 // MOOSE includes
19 #include "Moose.h" // using namespace libMesh
20 
21 #include "libmesh/point.h"
22 
23 // forward declarations
24 namespace libMesh
25 {
26 class Plane;
27 }
28 
34 {
35 public:
36  LineSegment(const Point & p0, const Point & p1);
37 
38  virtual ~LineSegment() = default;
39 
45  Point closest_point(const Point & p) const;
46 
52  bool closest_normal_point(const Point & p, Point & closest_p) const;
53 
57  bool contains_point(const Point & p) const;
58 
59  bool intersect(const Plane & pl, Point & intersect_p) const;
60 
61  bool intersect(const LineSegment & l1, Point & intersect_p) const;
62 
66  const Point & start() const { return _p0; }
67 
71  const Point & end() const { return _p1; }
72 
76  Real length() const { return (_p0 - _p1).norm(); }
77 
78 private:
79  bool closest_point(const Point & p, bool clamp_to_segment, Point & closest_p) const;
80 
81  Point _p0, _p1;
82 };
83 
84 #endif // LINESEGMENT_H
The LineSegment class is used by the LineMaterialSamplerBase class and for some ray tracing stuff...
Definition: LineSegment.h:33
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
Real length() const
Length of segment.
Definition: LineSegment.h:76
const Point & start() const
Beginning of the line segment.
Definition: LineSegment.h:66
const Point & end() const
Ending of the line segment.
Definition: LineSegment.h:71