| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef _TRIANGULATOR_H_ |
| #define _TRIANGULATOR_H_ |
| |
| #include <vector> |
| |
| #include "geometry.h" |
| #include "contour.h" |
| |
| class Triangulator { |
| public: |
| class Vertex { |
| public: |
| int index; |
| Vector p; |
| Vertex *next; |
| Vertex(): index(), next() { } |
| }; |
| |
| typedef std::vector<Vertex> Path; |
| typedef std::vector<int> TriangleList; |
| |
| static bool intersect_lines(Vector a0, Vector a1, Vector b0, Vector b1); |
| static void build_path(const Contour &contour, Path &path, int index_offset); |
| static bool check_triangle(Vertex *first, TriangleList &triangles); |
| static void split_path(Vertex *first, TriangleList &triangles); |
| static void triangulate(const Contour &contour, TriangleList &triangles, int index_offset); |
| }; |
| |
| #endif |