OGS
Triangle.cpp
Go to the documentation of this file.
1
10#include "Triangle.h"
11
12#include <Eigen/Dense>
13
14#include "AnalyticalGeometry.h"
16#include "Point.h"
17
18namespace GeoLib
19{
20Triangle::Triangle(std::vector<Point*> const& pnt_vec, std::size_t pnt_a,
21 std::size_t pnt_b, std::size_t pnt_c)
22 : _pnts(pnt_vec), _pnt_ids({{pnt_a, pnt_b, pnt_c}})
23{
24 assert(!_pnts.empty());
25 assert(pnt_a < _pnts.size() && pnt_b < _pnts.size() &&
26 pnt_c < _pnts.size());
27}
28
29bool Triangle::containsPoint(MathLib::Point3d const& q, double eps) const
30{
31 GeoLib::Point const& a(*(_pnts[_pnt_ids[0]]));
32 GeoLib::Point const& b(*(_pnts[_pnt_ids[1]]));
33 GeoLib::Point const& c(*(_pnts[_pnt_ids[2]]));
34 return MathLib::isPointInTriangle(q, a, b, c, eps);
35}
36} // namespace GeoLib
Definition of analytical geometry functions.
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
bool isPointInTriangle(MathLib::Point3d const &p, MathLib::Point3d const &a, MathLib::Point3d const &b, MathLib::Point3d const &c, double eps_pnt_out_of_plane, double eps_pnt_out_of_tri, MathLib::TriangleTest algorithm)