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
16namespace GeoLib
17{
18
19class Point;
20
26class Triangle final
27{
28public:
33 Triangle(std::vector<Point*> const& pnt_vec,
34 std::size_t pnt_a,
35 std::size_t pnt_b,
36 std::size_t pnt_c);
37
41 const std::size_t& operator[](std::size_t i) const
42 {
43 assert(i < 3);
44 return _pnt_ids[i];
45 }
46
50 const Point* getPoint(std::size_t i) const
51 {
52 assert(i < 3);
53 return _pnts[_pnt_ids[i]];
54 }
55
63 bool containsPoint(
64 MathLib::Point3d const& q,
65 double eps = std::numeric_limits<float>::epsilon()) const;
66
67private:
69 std::vector<Point*> const& _pnts;
71 std::array<std::size_t, 3> _pnt_ids;
72};
73} // 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:27
const Point * getPoint(std::size_t i) const
const access operator to access the i-th triangle Point
Definition Triangle.h:50
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
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:41
std::array< std::size_t, 3 > _pnt_ids
position of pointers to the geometric points
Definition Triangle.h:71
std::vector< Point * > const & _pnts
a vector of pointers to points the triangle is based on
Definition Triangle.h:69
TemplateElement< PointRule1 > Point
Definition Point.h:20