| |
| |
| #ifndef TCG_TRIANGULATE_H |
| #define TCG_TRIANGULATE_H |
| |
| |
| #include "tcg_mesh.h" |
| |
| namespace tcg |
| { |
| |
| namespace TriMeshStuff |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| template <typename vertex_type> |
| struct glu_vertex_traits { |
| static inline double(&vertex3d(vertex_type &vx))[3] |
| { |
| return vx.m_pos; |
| } |
| |
| static inline int &index(vertex_type &vx) { return vx.m_idx; } |
| }; |
| |
| |
| |
| template <typename TriMesh_type> |
| struct ActionEvaluator { |
| enum Action { NONE, |
| SWAP, |
| COLLAPSE, |
| SPLIT }; |
| |
| |
| |
| |
| |
| |
| virtual void actionSort(const TriMesh_type &mesh, int e, Action *actionSequence) = 0; |
| }; |
| |
| |
| |
| template <typename TriMesh_type> |
| struct DefaultEvaluator : public ActionEvaluator<TriMesh_type> { |
| double m_collapseValue; |
| double m_splitValue; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| DefaultEvaluator(double collapseValue, double splitValue) |
| : m_collapseValue(collapseValue), m_splitValue(splitValue) {} |
| |
| void actionSort(const TriMesh_type &mesh, int e, typename ActionEvaluator<TriMesh_type>::Action *actionSequence); |
| }; |
| |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| template <typename ForIt, typename ContainersReader> |
| void gluTriangulate(ForIt polygonsTribeBegin, ForIt polygonsTribeEnd, ContainersReader &meshes_reader); |
| |
| template <typename TriMesh_type> |
| void refineMesh( |
| TriMesh_type &mesh, |
| TriMeshStuff::ActionEvaluator<TriMesh_type> &eval, |
| unsigned long maxActions = (std::numeric_limits<unsigned long>::max)()); |
| |
| } |
| |
| #endif // TCG_TRIANGULATE_H |
| |
| #ifdef INCLUDE_HPP |
| #include "hpp/triangulate.hpp" |
| #endif |
| |