|
|
8cd87e |
/*
|
|
|
8cd87e |
......... 2015 Ivan Mahonin
|
|
|
8cd87e |
|
|
|
8cd87e |
This program is free software: you can redistribute it and/or modify
|
|
|
8cd87e |
it under the terms of the GNU General Public License as published by
|
|
|
8cd87e |
the Free Software Foundation, either version 3 of the License, or
|
|
|
8cd87e |
(at your option) any later version.
|
|
|
8cd87e |
|
|
|
8cd87e |
This program is distributed in the hope that it will be useful,
|
|
|
8cd87e |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
8cd87e |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
8cd87e |
GNU General Public License for more details.
|
|
|
8cd87e |
|
|
|
8cd87e |
You should have received a copy of the GNU General Public License
|
|
|
8cd87e |
along with this program. If not, see <http: licenses="" www.gnu.org="">.</http:>
|
|
|
8cd87e |
*/
|
|
|
8cd87e |
|
|
|
8cd87e |
#ifndef _TRIANGULATOR_H_
|
|
|
8cd87e |
#define _TRIANGULATOR_H_
|
|
|
8cd87e |
|
|
|
8cd87e |
#include <vector></vector>
|
|
|
8cd87e |
|
|
|
8cd87e |
#include "geometry.h"
|
|
|
8cd87e |
#include "contour.h"
|
|
|
8cd87e |
|
|
|
8cd87e |
class Triangulator {
|
|
|
8cd87e |
public:
|
|
|
8cd87e |
class Vertex {
|
|
|
8cd87e |
public:
|
|
|
8cd87e |
int index;
|
|
|
8cd87e |
Vector p;
|
|
|
8cd87e |
Vertex *next;
|
|
|
8cd87e |
Vertex(): index(), next() { }
|
|
|
8cd87e |
};
|
|
|
8cd87e |
|
|
|
8cd87e |
typedef std::vector<vertex> Path;</vertex>
|
|
|
8cd87e |
typedef std::vector<int> TriangleList;</int>
|
|
|
8cd87e |
|
|
|
8cd87e |
static bool intersect_lines(Vector a0, Vector a1, Vector b0, Vector b1);
|
|
|
8cd87e |
static void build_path(const Contour &contour, Path &path, int index_offset);
|
|
|
8cd87e |
static bool check_triangle(Vertex *first, TriangleList &triangles);
|
|
|
8cd87e |
static void split_path(Vertex *first, TriangleList &triangles);
|
|
|
8cd87e |
static void triangulate(const Contour &contour, TriangleList &triangles, int index_offset);
|
|
|
8cd87e |
};
|
|
|
8cd87e |
|
|
|
8cd87e |
#endif
|