[geos-commits] r2359 - in trunk/source: algorithm headers/geos/algorithm

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Apr 14 09:35:21 EDT 2009


Author: strk
Date: 2009-04-14 09:35:21 -0400 (Tue, 14 Apr 2009)
New Revision: 2359

Modified:
   trunk/source/algorithm/LineIntersector.cpp
   trunk/source/headers/geos/algorithm/LineIntersector.h
Log:
Sync (Robust)LineIntersector to JTS-1.9

Modified: trunk/source/algorithm/LineIntersector.cpp
===================================================================
--- trunk/source/algorithm/LineIntersector.cpp	2009-04-14 13:23:07 UTC (rev 2358)
+++ trunk/source/algorithm/LineIntersector.cpp	2009-04-14 13:35:21 UTC (rev 2359)
@@ -14,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: algorithm/RobustLineIntersector.java rev. 1.35
+ * Last port: algorithm/RobustLineIntersector.java rev. 1.37 (JTS-1.9)
  *
  **********************************************************************/
 
@@ -692,36 +692,13 @@
 
 /*private*/
 void
-LineIntersector::intersection(const Coordinate& p1, const Coordinate& p2,
-	const Coordinate& q1, const Coordinate& q2, Coordinate &intPt) const
+LineIntersector::intersection(const Coordinate& p1,
+	const Coordinate& p2, const Coordinate& q1, const Coordinate& q2,
+	Coordinate &intPt) const
 {
-	Coordinate n1=p1;
-	Coordinate n2=p2;
-	Coordinate n3=q1;
-	Coordinate n4=q2;
-	Coordinate normPt;
 
-	//normalize(&n1, &n2, &n3, &n4, &normPt);
-	normalizeToEnvCentre(n1, n2, n3, n4, normPt);
+	intersectionWithNormalization(p1, p2, q1, q2, intPt);
 
-#if GEOS_DEBUG
-	cerr<<"RobustIntersector::intersection(p1,p2,q1,q2,intPt) called:"<<endl;
-	cerr<<" p1:"<<p1.toString()<<endl;
-	cerr<<" p2:"<<p2.toString()<<endl;
-	cerr<<" q1:"<<q1.toString()<<endl;
-	cerr<<" q2:"<<q2.toString()<<endl;
-
-	cerr<<" n1:"<<n1.toString()<<endl;
-	cerr<<" n2:"<<n2.toString()<<endl;
-	cerr<<" n3:"<<n3.toString()<<endl;
-	cerr<<" n4:"<<n4.toString()<<endl;
-#endif
-
-	safeHCoordinateIntersection(n1,n2,n3,n4,intPt);
-
-	intPt.x+=normPt.x;
-	intPt.y+=normPt.y;
-
 	/*
 	 * Due to rounding it can happen that the computed intersection is
 	 * outside the envelopes of the input segments.  Clearly this
@@ -746,7 +723,9 @@
 #endif
 	}
  
-	if (precisionModel!=NULL) precisionModel->makePrecise(intPt);
+	if (precisionModel!=NULL) {
+		precisionModel->makePrecise(intPt);
+	}
 
 
 #if COMPUTE_Z
@@ -761,7 +740,26 @@
 
 }
 
+/*private*/
+void
+LineIntersector::intersectionWithNormalization(const Coordinate& p1,
+	const Coordinate& p2, const Coordinate& q1, const Coordinate& q2,
+	Coordinate &intPt) const
+{
+	Coordinate n1=p1;
+	Coordinate n2=p2;
+	Coordinate n3=q1;
+	Coordinate n4=q2;
+	Coordinate normPt;
+	normalizeToEnvCentre(n1, n2, n3, n4, normPt);
 
+	safeHCoordinateIntersection(n1, n2, n3, n4, intPt);
+
+	intPt.x += normPt.x;
+	intPt.y += normPt.y;
+}
+
+
 /*private*/
 double
 LineIntersector::smallestInAbsValue(double x1,double x2,double x3,double x4) const

Modified: trunk/source/headers/geos/algorithm/LineIntersector.h
===================================================================
--- trunk/source/headers/geos/algorithm/LineIntersector.h	2009-04-14 13:23:07 UTC (rev 2358)
+++ trunk/source/headers/geos/algorithm/LineIntersector.h	2009-04-14 13:35:21 UTC (rev 2359)
@@ -14,7 +14,7 @@
  *
  **********************************************************************
  *
- * Last port: algorithm/RobustLineIntersector.java rev. 1.35
+ * Last port: algorithm/RobustLineIntersector.java rev. 1.37 (JTS-1.9)
  *
  **********************************************************************/
 
@@ -232,6 +232,12 @@
 
 private:
 
+	void intersectionWithNormalization(const geom::Coordinate& p1,
+		const geom::Coordinate& p2,
+		const geom::Coordinate& q1,
+		const geom::Coordinate& q2,
+		geom::Coordinate &ret) const;
+
 	/**
 	 * If makePrecise is true, computed intersection coordinates
 	 * will be made precise using Coordinate#makePrecise



More information about the geos-commits mailing list