From 73b5316c6c7a08f614d0cd336721a55f46bc192d Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 2 Apr 2019 21:25:08 +0200 Subject: [PATCH] gobj: add margin to float comparison in lens.project() Fixes unit tests in double-precision build. Cherry-picked from fa53e013cbc795dcccc57bc8503ca4788408fb86 --- panda/src/gobj/lens.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/gobj/lens.cxx b/panda/src/gobj/lens.cxx index f66f2ba6b9..6fabc0cf8f 100644 --- a/panda/src/gobj/lens.cxx +++ b/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)); } /**