[GRASS-SVN] r33389 - in grass-addons/vector: v.buffer2 v.parallel2

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Sep 10 13:45:57 EDT 2008


Author: rmatev
Date: 2008-09-10 13:45:57 -0400 (Wed, 10 Sep 2008)
New Revision: 33389

Modified:
   grass-addons/vector/v.buffer2/dgraph.c
   grass-addons/vector/v.buffer2/e_intersect.c
   grass-addons/vector/v.buffer2/main.c
   grass-addons/vector/v.buffer2/vlib_buffer.c
   grass-addons/vector/v.parallel2/dgraph.c
   grass-addons/vector/v.parallel2/e_intersect.c
   grass-addons/vector/v.parallel2/main.c
   grass-addons/vector/v.parallel2/vlib_buffer.c
Log:
Removed unused variables, and other cosmetics.

Modified: grass-addons/vector/v.buffer2/dgraph.c
===================================================================
--- grass-addons/vector/v.buffer2/dgraph.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.buffer2/dgraph.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -180,8 +180,9 @@
     double EPSILON = 0.00000001;
     double *x, *y;
     double x1, y1, x2, y2;
-    int res, res2;
-    double x1_, y1_, x2_, y2_, z1_, z2_;
+    int res;
+    /*int res2
+    double x1_, y1_, x2_, y2_, z1_, z2_;*/
     struct seg_intersections *si;
     struct seg_intersection_list *il;
     struct intersection_point **sorted;
@@ -291,7 +292,6 @@
 /* trying to add more than e edges, produces fatal error */
 struct planar_graph* pg_create_struct(int n, int e) {
     struct planar_graph *pg;
-    int i;
     
     pg = G_malloc(sizeof(struct planar_graph));
     pg->vcount = n;

Modified: grass-addons/vector/v.buffer2/e_intersect.c
===================================================================
--- grass-addons/vector/v.buffer2/e_intersect.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.buffer2/e_intersect.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <math.h>
 #include <grass/gis.h>
 #include "e_intersect.h"
 
@@ -561,10 +562,8 @@
 int segment_intersection_2d(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2,
     double *x1, double *y1, double *x2, double *y2)
 {
-    const DLEVEL = 4;
+    const int DLEVEL = 4;
     double t;
-    double max_ax, min_ax, max_ay, min_ay;
-    double max_bx, min_bx, max_by, min_by;
     int vertical;
     int f11, f12, f21, f22;
     double d, da, db;

Modified: grass-addons/vector/v.buffer2/main.c
===================================================================
--- grass-addons/vector/v.buffer2/main.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.buffer2/main.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -20,9 +20,17 @@
 #include <grass/Vect.h>
 #include <grass/dbmi.h>
 #include <grass/glocale.h>
+#include "local_proto.h"
 
 #define PI M_PI
+#ifndef MIN
+    #define MIN(X,Y) ((X<Y)?X:Y)
+#endif
+#ifndef MAX
+    #define MAX(X,Y) ((X>Y)?X:Y)
+#endif    
 
+
 void stop(struct Map_info *In, struct Map_info *Out) {
     Vect_close (In);
 
@@ -44,7 +52,6 @@
 }
 
 int db_CatValArray_get_value_di(dbCatValArray *cvarr, int cat, double *value) {
-    double val_d;
     int t;
     int ctype = cvarr->ctype;
     int ret;
@@ -107,8 +114,8 @@
     struct Option *in_opt, *out_opt, *type_opt, *dista_opt, *distb_opt, *angle_opt;
     struct Flag *straight_flag, *nocaps_flag;
     struct Option *tol_opt, *bufcol_opt, *scale_opt, *field_opt;
-    double da, db, dalpha, tolerance, unit_tolerance, dtmp;
-    int type, debug;
+    double da, db, dalpha, tolerance, unit_tolerance;
+    int type;
     int i, j, ret, nareas, area, nlines, line;
     char *Areas, *Lines;
     int field;
@@ -120,7 +127,6 @@
     struct field_info *Fi;
     dbDriver *Driver;
     dbCatValArray cvarr;
-    int size_val_int;
     double size_val, scale;
 
 
@@ -227,7 +233,7 @@
         else
             dalpha = 0;
         
-        unit_tolerance = tolerance * fmin(da, db);
+        unit_tolerance = tolerance * MIN(da, db);
         G_message(_("The tolerance in map units = %g"), unit_tolerance);
     }
 
@@ -335,7 +341,7 @@
                 da = size_val * scale;
                 db = da;
                 dalpha = 0;
-                unit_tolerance = tolerance * fmin(da, db);
+                unit_tolerance = tolerance * MIN(da, db);
                 
                 G_debug(2, "    dynamic buffer size = %.2f", da);                
                 G_debug(2, _("The tolerance in map units: %g"), unit_tolerance);
@@ -389,7 +395,7 @@
                 da = size_val * scale;
                 db = da;
                 dalpha = 0;
-                unit_tolerance = tolerance * fmin(da, db);
+                unit_tolerance = tolerance * MIN(da, db);
                 
                 G_debug(2, "    dynamic buffer size = %.2f", da);                
                 G_debug(2, _("The tolerance in map units: %g"), unit_tolerance);

Modified: grass-addons/vector/v.buffer2/vlib_buffer.c
===================================================================
--- grass-addons/vector/v.buffer2/vlib_buffer.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.buffer2/vlib_buffer.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -127,11 +127,8 @@
 
 static double angular_tolerance(double tol, double da, double db) {
     double a = MAX(da, db);
-    double b = MIN(da, db);
     if (tol > a)
         tol = a;
-/*    t = b*sqrt(tol*(2*a - tol))/(a*(a-tol));
-    return 2*atan(t);*/
     return 2*acos(1-tol/a);
 }
 
@@ -156,7 +153,6 @@
     double a0, b0, c0, a1, b1, c1;
     double phi1, phi2, delta_phi;
     double nsegments, angular_tol, angular_step;
-    double cosa, sina, r;
     int inner_corner, turns360;
     
     G_debug(3, "parallel_line()");
@@ -307,7 +303,6 @@
     double a0, b0, c0, a1, b1, c1;
     double phi1, phi2, delta_phi;
     double nsegments, angular_tol, angular_step;
-    double cosa, sina, r;
     double angle0, angle1;
     int inner_corner, turns360;
     
@@ -448,7 +443,7 @@
 * else if it is inner contour, it is returned in cw order
 */
 static void extract_contour(struct planar_graph *pg, struct pg_edge *first, int side, int winding, int stop_at_line_end, struct line_pnts *nPoints) {
-    int i, j;
+    int j;
     int v; /* current vertex number */
     int v0;
     int eside; /* side of the current edge */
@@ -456,8 +451,8 @@
     struct pg_vertex *vert; /* current vertex */
     struct pg_vertex *vert0; /* last vertex */
     struct pg_edge *edge; /* current edge; must be edge of vert */
-/*    int cs; /* on which side are we turning along the contour
-    we will always turn right */
+/*    int cs;*/ /* on which side are we turning along the contour */
+    /* we will always turn right and dont need that one */
     double opt_angle, tangle;
     int opt_j, opt_side, opt_flag;
     
@@ -578,7 +573,7 @@
     int v;
     struct pg_vertex *vert;
     struct pg_edge *edge;
-    double min_x, min_angle, ta;
+    double min_x, min_angle;
 
     G_debug(3, "extract_outer_contour()");
 
@@ -905,10 +900,9 @@
     struct line_pnts *tPoints, *outer;
     struct line_pnts **isles;
     int isles_count = 0;
-    int i, res, winding, isle;
+    int i, isle;
     int more = 8;
     int isles_allocated = 0;
-    double max = MAX(da, db);
     
     G_debug(2, "Vect_area_buffer()");
     

Modified: grass-addons/vector/v.parallel2/dgraph.c
===================================================================
--- grass-addons/vector/v.parallel2/dgraph.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.parallel2/dgraph.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -180,8 +180,9 @@
     double EPSILON = 0.00000001;
     double *x, *y;
     double x1, y1, x2, y2;
-    int res, res2;
-    double x1_, y1_, x2_, y2_, z1_, z2_;
+    int res;
+    /*int res2
+    double x1_, y1_, x2_, y2_, z1_, z2_;*/
     struct seg_intersections *si;
     struct seg_intersection_list *il;
     struct intersection_point **sorted;
@@ -291,7 +292,6 @@
 /* trying to add more than e edges, produces fatal error */
 struct planar_graph* pg_create_struct(int n, int e) {
     struct planar_graph *pg;
-    int i;
     
     pg = G_malloc(sizeof(struct planar_graph));
     pg->vcount = n;

Modified: grass-addons/vector/v.parallel2/e_intersect.c
===================================================================
--- grass-addons/vector/v.parallel2/e_intersect.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.parallel2/e_intersect.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <math.h>
 #include <grass/gis.h>
 #include "e_intersect.h"
 
@@ -561,10 +562,8 @@
 int segment_intersection_2d(double ax1, double ay1, double ax2, double ay2, double bx1, double by1, double bx2, double by2,
     double *x1, double *y1, double *x2, double *y2)
 {
-    const DLEVEL = 4;
+    const int DLEVEL = 4;
     double t;
-    double max_ax, min_ax, max_ay, min_ay;
-    double max_bx, min_bx, max_by, min_by;
     int vertical;
     int f11, f12, f21, f22;
     double d, da, db;

Modified: grass-addons/vector/v.parallel2/main.c
===================================================================
--- grass-addons/vector/v.parallel2/main.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.parallel2/main.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -19,6 +19,7 @@
 #include <grass/gis.h>
 #include <grass/Vect.h>
 #include <grass/glocale.h>
+#include "local_proto.h"
 
 int main (int argc, char *argv[])
 {

Modified: grass-addons/vector/v.parallel2/vlib_buffer.c
===================================================================
--- grass-addons/vector/v.parallel2/vlib_buffer.c	2008-09-10 15:41:39 UTC (rev 33388)
+++ grass-addons/vector/v.parallel2/vlib_buffer.c	2008-09-10 17:45:57 UTC (rev 33389)
@@ -127,11 +127,8 @@
 
 static double angular_tolerance(double tol, double da, double db) {
     double a = MAX(da, db);
-    double b = MIN(da, db);
     if (tol > a)
         tol = a;
-/*    t = b*sqrt(tol*(2*a - tol))/(a*(a-tol));
-    return 2*atan(t);*/
     return 2*acos(1-tol/a);
 }
 
@@ -156,7 +153,6 @@
     double a0, b0, c0, a1, b1, c1;
     double phi1, phi2, delta_phi;
     double nsegments, angular_tol, angular_step;
-    double cosa, sina, r;
     int inner_corner, turns360;
     
     G_debug(3, "parallel_line()");
@@ -307,7 +303,6 @@
     double a0, b0, c0, a1, b1, c1;
     double phi1, phi2, delta_phi;
     double nsegments, angular_tol, angular_step;
-    double cosa, sina, r;
     double angle0, angle1;
     int inner_corner, turns360;
     
@@ -448,7 +443,7 @@
 * else if it is inner contour, it is returned in cw order
 */
 static void extract_contour(struct planar_graph *pg, struct pg_edge *first, int side, int winding, int stop_at_line_end, struct line_pnts *nPoints) {
-    int i, j;
+    int j;
     int v; /* current vertex number */
     int v0;
     int eside; /* side of the current edge */
@@ -456,8 +451,8 @@
     struct pg_vertex *vert; /* current vertex */
     struct pg_vertex *vert0; /* last vertex */
     struct pg_edge *edge; /* current edge; must be edge of vert */
-/*    int cs; /* on which side are we turning along the contour
-    we will always turn right */
+/*    int cs;*/ /* on which side are we turning along the contour */
+    /* we will always turn right and dont need that one */
     double opt_angle, tangle;
     int opt_j, opt_side, opt_flag;
     
@@ -578,7 +573,7 @@
     int v;
     struct pg_vertex *vert;
     struct pg_edge *edge;
-    double min_x, min_angle, ta;
+    double min_x, min_angle;
 
     G_debug(3, "extract_outer_contour()");
 
@@ -905,10 +900,9 @@
     struct line_pnts *tPoints, *outer;
     struct line_pnts **isles;
     int isles_count = 0;
-    int i, res, winding, isle;
+    int i, isle;
     int more = 8;
     int isles_allocated = 0;
-    double max = MAX(da, db);
     
     G_debug(2, "Vect_area_buffer()");
     



More information about the grass-commit mailing list