mirror of
https://github.com/jhasse/poly2tri.git
synced 2024-12-31 23:23:30 +01:00
Throw an exception instead of assert(false) for repeat points
This commit is contained in:
parent
76b3b53bc6
commit
f0a16419c5
@ -29,6 +29,8 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include "shapes.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
namespace p2t {
|
||||
@ -362,4 +364,4 @@ void Triangle::DebugPrint()
|
||||
cout << points_[2]->x << "," << points_[2]->y << endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,10 +33,10 @@
|
||||
#ifndef SHAPES_H
|
||||
#define SHAPES_H
|
||||
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <assert.h>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
|
||||
namespace p2t {
|
||||
|
||||
@ -136,7 +136,7 @@ struct Edge {
|
||||
p = &p2;
|
||||
} else if (p1.x == p2.x) {
|
||||
// Repeat points
|
||||
assert(false);
|
||||
throw std::runtime_error("Edge::Edge: p1 == p2");
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,4 +320,4 @@ inline void Triangle::IsInterior(bool b)
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -30,6 +30,8 @@
|
||||
*/
|
||||
#include "advancing_front.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace p2t {
|
||||
|
||||
AdvancingFront::AdvancingFront(Node& head, Node& tail)
|
||||
@ -105,4 +107,4 @@ AdvancingFront::~AdvancingFront()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,14 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#include <stdexcept>
|
||||
#include "sweep.h"
|
||||
#include "sweep_context.h"
|
||||
#include "advancing_front.h"
|
||||
#include "../common/utils.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace p2t {
|
||||
|
||||
// Triangulate simple polygon with holes
|
||||
|
Loading…
Reference in New Issue
Block a user