poly2tri use std::runtime_error, fixes builds on many Linux distributions
This commit is contained in:
parent
eed924fe45
commit
a83ece88fd
|
@ -53,7 +53,7 @@ void Triangle::MarkNeighbor(Point* p1, Point* p2, Triangle* t)
|
||||||
else if ((p1 == points_[0] && p2 == points_[1]) || (p1 == points_[1] && p2 == points_[0]))
|
else if ((p1 == points_[0] && p2 == points_[1]) || (p1 == points_[1] && p2 == points_[0]))
|
||||||
neighbors_[2] = t;
|
neighbors_[2] = t;
|
||||||
else
|
else
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exhaustive search to update neighbor pointers
|
// Exhaustive search to update neighbor pointers
|
||||||
|
@ -151,7 +151,7 @@ void Triangle::Legalize(Point& opoint, Point& npoint)
|
||||||
points_[2] = points_[1];
|
points_[2] = points_[1];
|
||||||
points_[1] = &npoint;
|
points_[1] = &npoint;
|
||||||
} else {
|
} else {
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ int Triangle::Index(const Point* p)
|
||||||
} else if (p == points_[2]) {
|
} else if (p == points_[2]) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ Point* Triangle::PointCW(Point& point)
|
||||||
} else if (&point == points_[2]) {
|
} else if (&point == points_[2]) {
|
||||||
return points_[1];
|
return points_[1];
|
||||||
}
|
}
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ Point* Triangle::PointCCW(Point& point)
|
||||||
} else if (&point == points_[2]) {
|
} else if (&point == points_[2]) {
|
||||||
return points_[0];
|
return points_[0];
|
||||||
}
|
}
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -701,7 +701,7 @@ void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t,
|
||||||
Point& op = *ot->OppositePoint(*t, p);
|
Point& op = *ot->OppositePoint(*t, p);
|
||||||
|
|
||||||
if (ot == nullptr) {
|
if (ot == nullptr) {
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) {
|
if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) {
|
||||||
|
@ -761,7 +761,7 @@ Point& Sweep::NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op)
|
||||||
// Left
|
// Left
|
||||||
return *ot.PointCW(op);
|
return *ot.PointCW(op);
|
||||||
} else{
|
} else{
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
return ep; // Arbitrary return val -- fixes warning
|
return ep; // Arbitrary return val -- fixes warning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle&
|
||||||
Point& op = *ot->OppositePoint(t, p);
|
Point& op = *ot->OppositePoint(t, p);
|
||||||
|
|
||||||
if (ot == NULL) {
|
if (ot == NULL) {
|
||||||
throw std::invalid_argument("Polygon contains overlapping hole vertices.");
|
throw std::runtime_error("Polygon contains overlapping hole vertices.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) {
|
if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) {
|
||||||
|
|
Loading…
Reference in New Issue