s3d (0.2.1.1-5) libs3d_small-infinity.patch

Summary

 libs3d/sei_construct.c   |    8 ++++----
 libs3d/sei_triangulate.h |    1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

    
download this patch

Patch contents

Description: Don't accidently used INFINITY from math.h
 math.h has a constant defined under the name INFINITY which is only defined for
 floats and not for double. As result the triangulation of some segments failed
 from time to time.
 .
 This happens because we also include math.h and it may override our definition
 of INFINITY. To solve this we just can use HUGE_VAL from math.h which is
 defined as the largest possible positive double.
Origin: backport, http://git.berlios.de/cgi-bin/gitweb.cgi?p=s3d;a=commit;h=16c64e65ff64f92179b7ed65ae07d504d95ac5f2
Author: Sven Eckelmann <sven.eckelmann@gmx.de>

---
diff --git a/libs3d/sei_construct.c b/libs3d/sei_construct.c
index ed6a3460bf0261c4235170655d89ef3a8578e856..c1818b446564cdb74298cfefedb2682fc0c7dea2 100644
--- a/libs3d/sei_construct.c
+++ b/libs3d/sei_construct.c
@@ -207,10 +207,10 @@ static int init_query_structure(int segnum)
 
 	tr[t1].hi = tr[t2].hi = tr[t4].lo = qs[i1].yval;
 	tr[t1].lo = tr[t2].lo = tr[t3].hi = qs[i3].yval;
-	tr[t4].hi.y = (double)(INFINITY);
-	tr[t4].hi.x = (double)(INFINITY);
-	tr[t3].lo.y = (double) - 1 * (INFINITY);
-	tr[t3].lo.x = (double) - 1 * (INFINITY);
+	tr[t4].hi.y = HUGE_VAL;
+	tr[t4].hi.x = HUGE_VAL;
+	tr[t3].lo.y = -HUGE_VAL;
+	tr[t3].lo.x = -HUGE_VAL;
 	tr[t1].rseg = tr[t2].lseg = segnum;
 	tr[t1].u0 = tr[t2].u0 = t4;
 	tr[t1].d0 = tr[t2].d0 = t3;
diff --git a/libs3d/sei_triangulate.h b/libs3d/sei_triangulate.h
index f6fd55340e537ac6a6b41cebf74dc8926fb28ad7..0609de0744351437a98c59dc0f4500c9b2051ce8 100644
--- a/libs3d/sei_triangulate.h
+++ b/libs3d/sei_triangulate.h
@@ -130,7 +130,6 @@ typedef struct {
 #define LASTPT  2
 
 
-#define INFINITY 1<<30
 #define C_EPS 1.0e-7  /* tolerance value: Used for making */
 /* all decisions about collinearity or */
 /* left/right of segment. Decrease */