poly2tri use std::runtime_error, fixes builds on many Linux distributions

This commit is contained in:
Tomasz Włostowski 2017-12-14 02:14:35 +01:00
parent eed924fe45
commit a83ece88fd
2 changed files with 8 additions and 8 deletions

View File

@ -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;
}

View File

@ -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)) {