[geos-commits] r3733 - trunk/src/operation/buffer

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Dec 4 23:56:41 PST 2012


Author: strk
Date: 2012-12-04 23:56:41 -0800 (Tue, 04 Dec 2012)
New Revision: 3733

Modified:
   trunk/src/operation/buffer/BufferOp.cpp
Log:
Do not reduce precision below 6 significant digits.

Avoids gross results (preferring an exception)
See http://trac.osgeo.org/geos/ticket/605

Modified: trunk/src/operation/buffer/BufferOp.cpp
===================================================================
--- trunk/src/operation/buffer/BufferOp.cpp	2012-12-05 07:41:45 UTC (rev 3732)
+++ trunk/src/operation/buffer/BufferOp.cpp	2012-12-05 07:56:41 UTC (rev 3733)
@@ -152,8 +152,11 @@
 BufferOp::bufferReducedPrecision()
 {
 
-	// try and compute with decreasing precision
-	for (int precDigits=MAX_PRECISION_DIGITS; precDigits >= 0; precDigits--)
+	// try and compute with decreasing precision,
+	// up to a min, to avoid gross results
+	// (not in JTS, see http://trac.osgeo.org/geos/ticket/605)
+#define MIN_PRECISION_DIGITS 6
+	for (int precDigits=MAX_PRECISION_DIGITS; precDigits >= MIN_PRECISION_DIGITS; precDigits--)
 	{
 #if GEOS_DEBUG
 		std::cerr<<"BufferOp::computeGeometry: trying with precDigits "<<precDigits<<std::endl;



More information about the geos-commits mailing list