 OGS
Triangle.h
Go to the documentation of this file.
1
10 #pragma once
11
12 #include <vector>
13
14 #include "MathLib/Point3d.h"
15
16 namespace GeoLib {
17
18 class Point;
19
25 class Triangle final
26 {
27 public:
32  Triangle(std::vector<Point*> const& pnt_vec,
33  std::size_t pnt_a,
34  std::size_t pnt_b,
35  std::size_t pnt_c);
36
40  const std::size_t& operator[](std::size_t i) const
41  {
42  assert (i < 3);
43  return _pnt_ids[i];
44  }
45
49  const Point* getPoint(std::size_t i) const
50  {
51  assert (i < 3);
52  return _pnts[_pnt_ids[i]];
53  }
54
61  bool containsPoint(
62  MathLib::Point3d const& q,
63  double eps = std::numeric_limits<float>::epsilon()) const;
64
65 private:
67  std::vector<Point*> const& _pnts;
69  std::array<std::size_t, 3> _pnt_ids;
70 };
71 } // namespace GeoLib
Definition of the Point3d class.
Class Triangle consists of a reference to a point vector and a vector that stores the indices in the ...
Definition: Triangle.h:26
const std::size_t & operator[](std::size_t i) const
const access operator to access the index of the i-th triangle point
Definition: Triangle.h:40
const Point * getPoint(std::size_t i) const
const access operator to access the i-th triangle Point
Definition: Triangle.h:49
bool containsPoint(MathLib::Point3d const &q, double eps=std::numeric_limits< float >::epsilon()) const
Definition: Triangle.cpp:29
Triangle(std::vector< Point * > const &pnt_vec, std::size_t pnt_a, std::size_t pnt_b, std::size_t pnt_c)
Definition: Triangle.cpp:20
std::array< std::size_t, 3 > _pnt_ids
position of pointers to the geometric points
Definition: Triangle.h:69
std::vector< Point * > const & _pnts
a vector of pointers to points the triangle is based on
Definition: Triangle.h:67
static const double q
TemplateElement< PointRule1 > Point
Definition: Point.h:20