Skip to content

Commit 3f42c8f

Browse files
committed
A couple of bug fixes courtesy of Jochen Wild.
1 parent ef79e71 commit 3f42c8f

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AC_ARG_ENABLE([debug],
1919
AC_CHECK_LIB([m], [sqrt])
2020

2121
AC_ARG_ENABLE(64bit-ints,
22-
[AS_HELP_STRING([--enable-64bits-ints],[Use 64 bit integers instead of 32 bit])])
22+
[AS_HELP_STRING([--enable-64bit-ints],[Use 64 bit integers instead of 32 bit])])
2323
if test "x$enable_64bit_ints" == "xyes" ; then
2424
CXXFLAGS+=" -DGMGW_INT64"
2525
else

geom_utils.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ triArea(const double coords[][3], const GMGW_int v0, const GMGW_int v1,
201201
}
202202
assert(e0 >= e1);
203203
assert(e1 >= e2);
204+
if (e2 - (e0 -e1) < 0) {
205+
// These three edge lengths can't be a real triangle, because e0
206+
// is larger than the sum of e1 and e2. Treat this triangle as
207+
// exactly linear, and return zero area.
208+
return 0;
209+
}
204210
// The parentheses enforce a numerically stable order of operations.
205211
double Area = 0.25
206212
* sqrt(

0 commit comments

Comments
 (0)