From c6d60ecd5b13d6cd639df3b6ed9d2d8495bc4de9 Mon Sep 17 00:00:00 2001 From: Peter Sadrozinski Date: Tue, 6 Nov 2012 19:32:17 -0500 Subject: [PATCH] fix for the til matching issue created when converting from SGVec3d to SGGeod for bounding box --- src/Lib/Geometry/point3d.hxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Lib/Geometry/point3d.hxx b/src/Lib/Geometry/point3d.hxx index 7c6aa86c..e1a912e4 100644 --- a/src/Lib/Geometry/point3d.hxx +++ b/src/Lib/Geometry/point3d.hxx @@ -431,12 +431,26 @@ inline bool Point3D::HasElevation() const inline bool Point3D::IsWithin( Point3D min, Point3D max ) const { + // make sure we take epsilon into account + min.n[PX] -= fgPoint3_Epsilon; + min.n[PY] -= fgPoint3_Epsilon; + + max.n[PX] += fgPoint3_Epsilon; + max.n[PY] += fgPoint3_Epsilon; + return ( (min.n[PX] <= n[PX]) && (min.n[PY] <= n[PY]) && (max.n[PX] >= n[PX]) && (max.n[PY] >= n[PY]) ); } inline bool Point3D::IsWithin( double xmin, double xmax, double ymin, double ymax ) const { + // make sure we take epsilon into account + xmin -= fgPoint3_Epsilon; + ymin -= fgPoint3_Epsilon; + + xmax += fgPoint3_Epsilon; + ymax += fgPoint3_Epsilon; + return ( (xmin <= n[PX]) && (ymin <= n[PY]) && (xmax >= n[PX]) && (ymax >= n[PY]) ); }