Răsfoiți Sursa

gobj: add margin to float comparison in lens.project()

Fixes unit tests in double-precision build.
rdb 6 ani în urmă
părinte
comite
fa53e013cb
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      panda/src/gobj/lens.cxx

+ 2 - 2
panda/src/gobj/lens.cxx

@@ -1221,8 +1221,8 @@ do_project(const CData *cdata, const LPoint3 &point3d, LPoint3 &point2d) const {
   point2d.set(full[0] * recip_full3, full[1] * recip_full3, full[2] * recip_full3);
   return
     (full[3] > 0.0f) &&
-    (point2d[0] >= -1.0f) && (point2d[0] <= 1.0f) &&
-    (point2d[1] >= -1.0f) && (point2d[1] <= 1.0f);
+    (point2d[0] >= -1.0f - NEARLY_ZERO(PN_stdfloat)) && (point2d[0] <= 1.0f + NEARLY_ZERO(PN_stdfloat)) &&
+    (point2d[1] >= -1.0f - NEARLY_ZERO(PN_stdfloat)) && (point2d[1] <= 1.0f + NEARLY_ZERO(PN_stdfloat));
 }
 
 /**