mirror of
https://github.com/jhasse/poly2tri.git
synced 2025-02-07 07:53:28 +01:00
Support touching holes
This commit is contained in:
parent
13d64e75a8
commit
141ade3b01
@ -49,11 +49,16 @@ void SweepContext::AddHole(const std::vector<Point*>& polyline)
|
|||||||
{
|
{
|
||||||
InitEdges(polyline);
|
InitEdges(polyline);
|
||||||
for (auto i : polyline) {
|
for (auto i : polyline) {
|
||||||
points_.push_back(i);
|
if (point_set_.insert(i).second) {
|
||||||
|
points_.push_back(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SweepContext::AddPoint(Point* point) {
|
void SweepContext::AddPoint(Point* point) {
|
||||||
|
if (!point_set_.insert(point).second) {
|
||||||
|
throw std::runtime_error("Point already exists");
|
||||||
|
}
|
||||||
points_.push_back(point);
|
points_.push_back(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
namespace p2t {
|
namespace p2t {
|
||||||
|
|
||||||
@ -136,6 +137,7 @@ friend class Sweep;
|
|||||||
std::vector<Triangle*> triangles_;
|
std::vector<Triangle*> triangles_;
|
||||||
std::list<Triangle*> map_;
|
std::list<Triangle*> map_;
|
||||||
std::vector<Point*> points_;
|
std::vector<Point*> points_;
|
||||||
|
std::unordered_set<Point*> point_set_;
|
||||||
|
|
||||||
// Advancing front
|
// Advancing front
|
||||||
AdvancingFront* front_;
|
AdvancingFront* front_;
|
||||||
|
Loading…
Reference in New Issue
Block a user