From 15a12f9d7b5c7f7fb92429f57c156530372d9cf6 Mon Sep 17 00:00:00 2001 From: erg Date: Fri, 14 Jan 2011 22:40:02 +0000 Subject: [PATCH] Add patch from Stefan Kost, so that if triangulation fails, the code doesn't abort but uses a line segment. --- lib/pathplan/shortest.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/pathplan/shortest.c b/lib/pathplan/shortest.c index 1da98f7ea..84a9f25e3 100644 --- a/lib/pathplan/shortest.c +++ b/lib/pathplan/shortest.c @@ -199,7 +199,12 @@ int Pshortestpath(Ppoly_t * polyp, Ppoint_t * eps, Ppolyline_t * output) /* mark the strip of triangles from eps[0] to eps[1] */ if (!marktripath(ftrii, ltrii)) { prerror("cannot find triangle path"); - abort(); + /* a straight line is better than failing */ + growops(2); + output->pn = 2; + ops[0] = eps[0], ops[1] = eps[1]; + output->ps = ops; + return 0; } /* if endpoints in same triangle, use a single line */ @@ -310,7 +315,7 @@ static void triangulate(pointnlink_t ** pnlps, int pnln) return; } } - abort(); + prerror("triangulation failed"); } else loadtriangle(pnlps[0], pnlps[1], pnlps[2]); -- 2.40.0