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

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Apr 14 08:42:43 EDT 2009


Author: strk
Date: 2009-04-14 08:42:42 -0400 (Tue, 14 Apr 2009)
New Revision: 2356

Modified:
   trunk/source/algorithm/RayCrossingCounter.cpp
   trunk/source/headers/geos/algorithm/RayCrossingCounter.h
Log:
Update port info, checked against JTS-1.9


Modified: trunk/source/algorithm/RayCrossingCounter.cpp
===================================================================
--- trunk/source/algorithm/RayCrossingCounter.cpp	2009-04-14 11:03:14 UTC (rev 2355)
+++ trunk/source/algorithm/RayCrossingCounter.cpp	2009-04-14 12:42:42 UTC (rev 2356)
@@ -11,6 +11,10 @@
  * by the Free Software Foundation. 
  * See the COPYING file for more information.
  *
+ **********************************************************************
+ *
+ * Last port: algorithm/RayCrossingCounter.java rev. 1.2 (JTS-1.9)
+ *
  **********************************************************************/
 
 #include <geos/algorithm/RayCrossingCounter.h>
@@ -54,10 +58,12 @@
 
 
 void 
-RayCrossingCounter::countSegment( const geom::Coordinate * p1, const geom::Coordinate * p2) 
+RayCrossingCounter::countSegment(const geom::Coordinate * p1,
+                                 const geom::Coordinate * p2) 
 {
 	// For each segment, check if it crosses 
-	// a horizontal ray running from the test point in the positive x direction.
+	// a horizontal ray running from the test point in
+	// the positive x direction.
 	
 	// check if the segment is strictly to the left of the test point
 	if (p1->x < point->x && p2->x < point->x)
@@ -89,9 +95,9 @@
 		return;
 	}
 
-	// Evaluate all non-horizontal segments which cross a horizontal ray to the
-	// right of the test pt. To avoid double-counting shared vertices, we use the
-	// convention that
+	// Evaluate all non-horizontal segments which cross a horizontal ray
+	// to the right of the test pt.
+	// To avoid double-counting shared vertices, we use the convention that
 	// - an upward edge includes its starting endpoint, and excludes its
 	//   final endpoint
 	// - a downward edge excludes its starting endpoint, and includes its
@@ -99,17 +105,19 @@
 	if (((p1->y > point->y) && (p2->y <= point->y)) ||
 		((p2->y > point->y) && (p1->y <= point->y)) ) 
 	{
-		// translate the segment so that the test point lies on the origin
+		// translate the segment so that the test point lies
+		// on the origin
 		double x1 = p1->x - point->x;
 		double y1 = p1->y - point->y;
 		double x2 = p2->x - point->x;
 		double y2 = p2->y - point->y;
 
-		// The translated segment straddles the x-axis. Compute the sign of the
-		// ordinate of intersection with the x-axis. (y2 != y1, so denominator
+		// The translated segment straddles the x-axis.
+		// Compute the sign of the ordinate of intersection
+		// with the x-axis. (y2 != y1, so denominator
 		// will never be 0.0)
-		double xIntSign = RobustDeterminant::signOfDet2x2( x1, y1, x2, y2);
-
+                        // MD - faster & more robust computation?
+                double xIntSign = RobustDeterminant::signOfDet2x2(x1, y1, x2, y2);
 		if (xIntSign == 0.0) 
 		{
 			isPointOnSegment = true;

Modified: trunk/source/headers/geos/algorithm/RayCrossingCounter.h
===================================================================
--- trunk/source/headers/geos/algorithm/RayCrossingCounter.h	2009-04-14 11:03:14 UTC (rev 2355)
+++ trunk/source/headers/geos/algorithm/RayCrossingCounter.h	2009-04-14 12:42:42 UTC (rev 2356)
@@ -12,6 +12,10 @@
  * See the COPYING file for more information.
  *
  *
+ **********************************************************************
+ *
+ * Last port: algorithm/RayCrossingCounter.java rev. 1.2 (JTS-1.9)
+ *
  **********************************************************************/
 
 #ifndef GEOS_ALGORITHM_RAYCROSSINGCOUNTER_H
@@ -77,7 +81,8 @@
 	 * @param ring an array of Coordinates forming a ring 
 	 * @return the location of the point in the ring
 	 */
-	static int locatePointInRing( const geom::Coordinate * p, const geom::CoordinateSequence * ring);
+	static int locatePointInRing(const geom::Coordinate * p,
+	                             const geom::CoordinateSequence * ring);
 
 	RayCrossingCounter( const geom::Coordinate * point)
 	:	point( point),



More information about the geos-commits mailing list