[geos-commits] r4121 - in trunk: include/geos/triangulate/quadedge src/triangulate/quadedge

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Nov 30 02:00:36 PST 2015


Author: strk
Date: 2015-11-30 02:00:36 -0800 (Mon, 30 Nov 2015)
New Revision: 4121

Modified:
   trunk/include/geos/triangulate/quadedge/Vertex.h
   trunk/src/triangulate/quadedge/Vertex.cpp
Log:
Fix incorrect logic in Vertex::classify, sync to r705

Patch by Nyall Dawson <nyall.dawson at gmail.com>

Modified: trunk/include/geos/triangulate/quadedge/Vertex.h
===================================================================
--- trunk/include/geos/triangulate/quadedge/Vertex.h	2015-11-21 16:01:35 UTC (rev 4120)
+++ trunk/include/geos/triangulate/quadedge/Vertex.h	2015-11-30 10:00:36 UTC (rev 4121)
@@ -12,7 +12,7 @@
  *
  **********************************************************************
  *
- * Last port: triangulate/quadedge/Vertex.java r524
+ * Last port: triangulate/quadedge/Vertex.java r705
  *
  **********************************************************************/
 
@@ -248,7 +248,17 @@
 			const Vertex &v2) const;
 
 	/**
-	 * Interpolates the Z value of a point enclosed in a 3D triangle.
+	 * Interpolates the Z-value (height) of a point enclosed in a triangle
+	 * whose vertices all have Z values.
+	 * The containing triangle must not be degenerate
+	 * (in other words, the three vertices must enclose a
+	 * non-zero area).
+	 *
+	 * @param p the point to interpolate the Z value of
+	 * @param v0 a vertex of a triangle containing the p
+	 * @param v1 a vertex of a triangle containing the p
+	 * @param v2 a vertex of a triangle containing the p
+	 * @return the interpolated Z-value (height) of the point
 	 */
 	static double interpolateZ(const geom::Coordinate &p, const geom::Coordinate &v0, 
 			const geom::Coordinate &v1, const geom::Coordinate &v2);
@@ -259,7 +269,7 @@
 	 * @param p
 	 * @param p0
 	 * @param p1
-	 * @return
+	 * @return the interpolated Z value
 	 */
 	static double interpolateZ(const geom::Coordinate &p, const geom::Coordinate &p0, 
 			const geom::Coordinate &p1);

Modified: trunk/src/triangulate/quadedge/Vertex.cpp
===================================================================
--- trunk/src/triangulate/quadedge/Vertex.cpp	2015-11-21 16:01:35 UTC (rev 4120)
+++ trunk/src/triangulate/quadedge/Vertex.cpp	2015-11-30 10:00:36 UTC (rev 4121)
@@ -12,7 +12,7 @@
  *
  **********************************************************************
  *
- * Last port: triangulate/Vertex.java r524
+ * Last port: triangulate/Vertex.java r705
  *
  **********************************************************************/
 
@@ -51,24 +51,21 @@
 	std::auto_ptr<Vertex> a = p1.sub(p0);
 	std::auto_ptr<Vertex> b = p2.sub(p0);
 	double sa = a->crossProduct(*b);
-	int ret;
 
 	if (sa > 0.0)
-		ret =  LEFT;
+		return LEFT;
 	if (sa < 0.0)
-		ret =  RIGHT;
+		return RIGHT;
 	if ((a->getX() * b->getX() < 0.0) || (a->getY() * b->getY() < 0.0))
-		ret =  BEHIND;
+		return BEHIND;
 	if (a->magn() < b->magn())
-		ret =  BEYOND;
+		return BEYOND;
 	if (p0.equals(p2))
-		ret =  ORIGIN;
+		return ORIGIN;
 	if (p1.equals(p2))
-		ret =  DESTINATION;
+		return DESTINATION;
 	else
-		ret =  BETWEEN;
-
-	return ret;
+		return BETWEEN;
 }
 
 bool Vertex::isInCircle(const Vertex &a, const Vertex &b, const Vertex &c) const



More information about the geos-commits mailing list