[GRASS-SVN] r37946 - grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jun 19 06:46:58 EDT 2009


Author: hamish
Date: 2009-06-19 06:46:58 -0400 (Fri, 19 Jun 2009)
New Revision: 37946

Modified:
   grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.c
   grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.h
Log:
use M_PI

Modified: grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.c
===================================================================
--- grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.c	2009-06-19 10:42:41 UTC (rev 37945)
+++ grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.c	2009-06-19 10:46:58 UTC (rev 37946)
@@ -49,7 +49,7 @@
     g[0][1] = partial[1];
 
     gradPto = sqrt(g[0][0] * g[0][0] + g[0][1] * g[0][1]);
-    dirPto = atan(g[0][1] / g[0][0]) + PI / 2;	/* radiants */
+    dirPto = atan(g[0][1] / g[0][0]) + M_PI / 2;	/* radiants */
 
     Elaboration = elaboration_reg;
 
@@ -66,58 +66,58 @@
 	    g[2][1] = gradient[1];
 
 	    gradient =
-		Get_Gradient(Elaboration, obsX + passoE * cos(dirPto + PI),
-			     obsY + passoN * sin(dirPto + PI), parBilin);
+		Get_Gradient(Elaboration, obsX + passoE * cos(dirPto + M_PI),
+			     obsY + passoN * sin(dirPto + M_PI), parBilin);
 	    g[7][0] = gradient[0];
 	    g[7][1] = gradient[1];
 
-	    if ((fabs(atan(g[2][1] / g[2][0]) + PI / 2 - dirPto) < alpha) &&
-		(fabs(atan(g[7][1] / g[7][0]) + PI / 2 - dirPto) < alpha)) {
+	    if ((fabs(atan(g[2][1] / g[2][0]) + M_PI / 2 - dirPto) < alpha) &&
+		(fabs(atan(g[7][1] / g[7][0]) + M_PI / 2 - dirPto) < alpha)) {
 
 		gradient =
 		    Get_Gradient(Elaboration,
-				 obsX + passoE * cos(dirPto + PI / 4),
-				 obsY + passoN * sin(dirPto + PI / 4),
+				 obsX + passoE * cos(dirPto + M_PI / 4),
+				 obsY + passoN * sin(dirPto + M_PI / 4),
 				 parBilin);
 		g[1][0] = gradient[0];
 		g[1][1] = gradient[1];
 
 		gradient =
 		    Get_Gradient(Elaboration,
-				 obsX + passoE * cos(dirPto - PI / 4),
-				 obsY + passoN * sin(dirPto - PI / 4),
+				 obsX + passoE * cos(dirPto - M_PI / 4),
+				 obsY + passoN * sin(dirPto - M_PI / 4),
 				 parBilin);
 		g[3][0] = gradient[0];
 		g[3][1] = gradient[1];
 
 		gradient =
 		    Get_Gradient(Elaboration,
-				 obsX + passoE * cos(dirPto + PI / 2),
-				 obsY + passoN * sin(dirPto + PI / 2),
+				 obsX + passoE * cos(dirPto + M_PI / 2),
+				 obsY + passoN * sin(dirPto + M_PI / 2),
 				 parBilin);
 		g[4][0] = gradient[0];
 		g[4][1] = gradient[1];
 
 		gradient =
 		    Get_Gradient(Elaboration,
-				 obsX + passoE * cos(dirPto - PI / 2),
-				 obsY + passoN * sin(dirPto - PI / 2),
+				 obsX + passoE * cos(dirPto - M_PI / 2),
+				 obsY + passoN * sin(dirPto - M_PI / 2),
 				 parBilin);
 		g[5][0] = gradient[0];
 		g[5][1] = gradient[1];
 
 		gradient =
 		    Get_Gradient(Elaboration,
-				 obsX + passoE * cos(dirPto + PI * 3 / 4),
-				 obsY + passoN * sin(dirPto + PI * 3 / 4),
+				 obsX + passoE * cos(dirPto + M_PI * 3 / 4),
+				 obsY + passoN * sin(dirPto + M_PI * 3 / 4),
 				 parBilin);
 		g[6][0] = gradient[0];
 		g[6][1] = gradient[1];
 
 		gradient =
 		    Get_Gradient(Elaboration,
-				 obsX + passoE * cos(dirPto - PI * 3 / 4),
-				 obsY + passoN * sin(dirPto - PI * 3 / 4),
+				 obsX + passoE * cos(dirPto - M_PI * 3 / 4),
+				 obsY + passoN * sin(dirPto - M_PI * 3 / 4),
 				 parBilin);
 		g[8][0] = gradient[0];
 		g[8][1] = gradient[1];

Modified: grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.h
===================================================================
--- grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.h	2009-06-19 10:42:41 UTC (rev 37945)
+++ grass/branches/develbranch_6/vector/lidar/v.lidar.edgedetection/edgedetection.h	2009-06-19 10:46:58 UTC (rev 37946)
@@ -28,7 +28,6 @@
 #include <grass/dbmi.h>
 #include <grass/glocale.h>
 #include <grass/PolimiFunct.h>
-#define PI 3.141592
 
 /*---------------------------------------------------------------------------------------*/
 int edge_detection(struct Cell_head, /**/



More information about the grass-commit mailing list