From a83ece88fd47cf8b3215c04cc9380155e1eb2e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Thu, 14 Dec 2017 02:14:35 +0100 Subject: [PATCH] poly2tri use std::runtime_error, fixes builds on many Linux distributions --- polygon/poly2tri/common/shapes.cc | 10 +++++----- polygon/poly2tri/sweep/sweep.cc | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/polygon/poly2tri/common/shapes.cc b/polygon/poly2tri/common/shapes.cc index 1890776ef1..2c5508a6c6 100644 --- a/polygon/poly2tri/common/shapes.cc +++ b/polygon/poly2tri/common/shapes.cc @@ -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])) neighbors_[2] = t; 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 @@ -151,7 +151,7 @@ void Triangle::Legalize(Point& opoint, Point& npoint) points_[2] = points_[1]; points_[1] = &npoint; } 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]) { return 2; } - throw std::invalid_argument("Polygon contains overlapping hole vertices."); + throw std::runtime_error("Polygon contains overlapping hole vertices."); return 0; } @@ -224,7 +224,7 @@ Point* Triangle::PointCW(Point& point) } else if (&point == points_[2]) { return points_[1]; } - throw std::invalid_argument("Polygon contains overlapping hole vertices."); + throw std::runtime_error("Polygon contains overlapping hole vertices."); return NULL; } @@ -238,7 +238,7 @@ Point* Triangle::PointCCW(Point& point) } else if (&point == points_[2]) { return points_[0]; } - throw std::invalid_argument("Polygon contains overlapping hole vertices."); + throw std::runtime_error("Polygon contains overlapping hole vertices."); return NULL; } diff --git a/polygon/poly2tri/sweep/sweep.cc b/polygon/poly2tri/sweep/sweep.cc index 6afa6d7b83..7d4e6adbe0 100644 --- a/polygon/poly2tri/sweep/sweep.cc +++ b/polygon/poly2tri/sweep/sweep.cc @@ -701,7 +701,7 @@ void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Point& op = *ot->OppositePoint(*t, p); 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)) { @@ -761,7 +761,7 @@ Point& Sweep::NextFlipPoint(Point& ep, Point& eq, Triangle& ot, Point& op) // Left return *ot.PointCW(op); } 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 } } @@ -773,7 +773,7 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& Point& op = *ot->OppositePoint(t, p); 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)) {