[geos-commits] r2411 - in trunk/source: headers/geos/index/quadtree index/quadtree

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Apr 27 11:39:42 EDT 2009


Author: strk
Date: 2009-04-27 11:39:42 -0400 (Mon, 27 Apr 2009)
New Revision: 2411

Modified:
   trunk/source/headers/geos/index/quadtree/IntervalSize.h
   trunk/source/index/quadtree/IntervalSize.cpp
Log:
Port info and check, doxygen.


Modified: trunk/source/headers/geos/index/quadtree/IntervalSize.h
===================================================================
--- trunk/source/headers/geos/index/quadtree/IntervalSize.h	2009-04-27 15:30:52 UTC (rev 2410)
+++ trunk/source/headers/geos/index/quadtree/IntervalSize.h	2009-04-27 15:39:42 UTC (rev 2411)
@@ -11,6 +11,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: index/quadtree/IntervalSize.java rev 1.7 (JTS-1.10)
+ *
  **********************************************************************/
 
 #ifndef GEOS_IDX_QUADTREE_INTERVALSIZE_H
@@ -39,10 +43,16 @@
 	 * This value is chosen to be a few powers of 2 less than the
 	 * number of bits available in the double representation (i.e. 53).
 	 * This should allow enough extra precision for simple computations
-	 * to be correct,
-	 * at least for comparison purposes.
+	 * to be correct, at least for comparison purposes.
 	 */
-	static const int MIN_BINARY_EXPONENT=-50;
+	static const int MIN_BINARY_EXPONENT = -50;
+
+	/**
+	 * Computes whether the interval [min, max] is effectively zero width.
+	 * I.e. the width of the interval is so much less than the
+	 * location of the interval that the midpoint of the interval
+	 * cannot be represented precisely.
+	 */
 	static bool isZeroWidth(double min, double max);
 };
 

Modified: trunk/source/index/quadtree/IntervalSize.cpp
===================================================================
--- trunk/source/index/quadtree/IntervalSize.cpp	2009-04-27 15:30:52 UTC (rev 2410)
+++ trunk/source/index/quadtree/IntervalSize.cpp	2009-04-27 15:39:42 UTC (rev 2411)
@@ -12,6 +12,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: index/quadtree/IntervalSize.java rev 1.7 (JTS-1.10)
+ *
  **********************************************************************/
 
 #include <geos/index/quadtree/IntervalSize.h>
@@ -26,13 +30,17 @@
 namespace index { // geos.index
 namespace quadtree { // geos.index.quadtree
 
-bool IntervalSize::isZeroWidth(double mn,double mx){
-	double width=mx-mn;
-	if (width==0.0) return true;
-	double maxAbs=max(fabs(mn),fabs(mx));
-	double scaledInterval=width/maxAbs;
-	int level=DoubleBits::exponent(scaledInterval);
-	return level<=MIN_BINARY_EXPONENT;
+/* public static */
+bool
+IntervalSize::isZeroWidth(double mn, double mx)
+{
+	double width = mx - mn;
+	if (width == 0.0) return true;
+
+	double maxAbs = max(fabs(mn), fabs(mx));
+	double scaledInterval = width / maxAbs;
+	int level = DoubleBits::exponent(scaledInterval);
+	return level <= MIN_BINARY_EXPONENT;
 }
 
 } // namespace geos.index.quadtree



More information about the geos-commits mailing list