44 std::vector<GeoLib::Point*>
const& ref_pnts_vec(polygon.
getPointsVec());
49 const std::size_t i0(polygon.
getPointID(t[0]));
50 const std::size_t i1(polygon.
getPointID(t[1]));
51 const std::size_t i2(polygon.
getPointID(t[2]));
52 triangles.emplace_back(ref_pnts_vec, i0, i1, i2);
57 std::size_t n_pnts(
_pnts.size() - 1);
60 const std::size_t i0(polygon.
getPointID(n_pnts - t[0]));
61 const std::size_t i1(polygon.
getPointID(n_pnts - t[1]));
62 const std::size_t i2(polygon.
getPointID(n_pnts - t[2]));
63 triangles.emplace_back(ref_pnts_vec, i0, i1, i2);
80 for (std::size_t k(0); k < n_pnts; k++)
88 std::size_t n_pnts(
_pnts.size());
90 std::size_t min_x_max_y_idx(0);
91 for (std::size_t k(0); k < n_pnts; k++)
93 if ((*(
_pnts[k]))[0] <= (*(
_pnts[min_x_max_y_idx]))[0])
95 if ((*(
_pnts[k]))[0] < (*(
_pnts[min_x_max_y_idx]))[0])
101 if ((*(
_pnts[k]))[1] > (*(
_pnts[min_x_max_y_idx]))[1])
109 if (0 < min_x_max_y_idx && min_x_max_y_idx < n_pnts - 1)
113 *
_pnts[min_x_max_y_idx],
114 *
_pnts[min_x_max_y_idx + 1]);
118 if (0 == min_x_max_y_idx)
132 for (std::size_t k(0); k < n_pnts / 2; k++)
140 std::size_t v2)
const
144 if (v != v0 && v != v1 && v != v2)
185 "EarClippingTriangulation::initLists(): collinear points "
186 "({:f}, {:f}, {:f}), ({:f}, {:f}, {:f}), ({:f}, {:f}, {:f})",
198 if (
isEar(*prev, *it, *next))
242 auto prevprev = prev;
257 if (
isEar(*prevprev, *prev, *next))
289 auto nextnext = next;
306 if (
isEar(*prev, *next, *nextnext))
Definition of the EarClippingTriangulation class.
Definition of the Point class.
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the Polygon class.
std::list< std::size_t > _vertex_list
void ensureCWOrientation()
~EarClippingTriangulation()
bool isEar(std::size_t v0, std::size_t v1, std::size_t v2) const
std::vector< GeoLib::Point * > _pnts
GeoLib::Orientation _original_orientation
EarClippingTriangulation(GeoLib::Polygon const &polygon, std::list< GeoLib::Triangle > &triangles, bool rot=true)
std::list< std::size_t > _ear_list
std::list< std::size_t > _convex_vertex_list
void copyPolygonPoints(GeoLib::Polygon const &polygon)
std::list< GeoLib::Triangle > _triangles
std::size_t getPointID(std::size_t const i) const
std::size_t getNumberOfPoints() const
const Point * getPoint(std::size_t i) const
returns the i-th point contained in the polyline
std::vector< Point * > const & getPointsVec() const
void uniquePushBack(Container &container, typename Container::value_type const &element)
Eigen::Matrix3d rotatePointsToXY(InputIterator1 p_pnts_begin, InputIterator1 p_pnts_end, InputIterator2 r_pnts_begin, InputIterator2 r_pnts_end)
Orientation getOrientation(MathLib::Point3d const &p0, MathLib::Point3d const &p1, MathLib::Point3d const &p2)
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)