[GRASS-SVN] r57630 - grass/trunk/vector/v.voronoi
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 10 13:29:47 PDT 2013
Author: mmetz
Date: 2013-09-10 13:29:47 -0700 (Tue, 10 Sep 2013)
New Revision: 57630
Modified:
grass/trunk/vector/v.voronoi/main.c
grass/trunk/vector/v.voronoi/sw_geometry.c
grass/trunk/vector/v.voronoi/sw_voronoi.c
grass/trunk/vector/v.voronoi/vo_write.c
Log:
v.voronoi: change option segf to smoothness, clean up code
Modified: grass/trunk/vector/v.voronoi/main.c
===================================================================
--- grass/trunk/vector/v.voronoi/main.c 2013-09-10 14:13:53 UTC (rev 57629)
+++ grass/trunk/vector/v.voronoi/main.c 2013-09-10 20:29:47 UTC (rev 57630)
@@ -102,7 +102,7 @@
struct Flag *line, *table, *area;
} flag;
struct {
- struct Option *in, *out, *field, *segf;
+ struct Option *in, *out, *field, *smooth;
} opt;
struct GModule *module;
struct line_pnts *Points;
@@ -132,12 +132,12 @@
opt.out = G_define_standard_option(G_OPT_V_OUTPUT);
- opt.segf = G_define_option();
- opt.segf->type = TYPE_DOUBLE;
- opt.segf->key = "segment";
- opt.segf->answer = "0.25";
- opt.segf->label = _("Factor to control boundary interpolation");
- opt.segf->description = _("Applies to input areas only. Smaller values produce smoother output but can cause numerical instability.");
+ opt.smooth = G_define_option();
+ opt.smooth->type = TYPE_DOUBLE;
+ opt.smooth->key = "smoothness";
+ opt.smooth->answer = "0.25";
+ opt.smooth->label = _("Factor for output smoothness");
+ opt.smooth->description = _("Applies to input areas only. Smaller values produce smoother output but can cause numerical instability.");
flag.area = G_define_flag();
flag.area->key = 'a';
@@ -160,10 +160,10 @@
Type = GV_BOUNDARY;
in_area = flag.area->answer;
- segf = atof(opt.segf->answer);
+ segf = atof(opt.smooth->answer);
if (segf < GRASS_EPSILON) {
segf = 0.25;
- G_warning(_("Option '%s' is too small, set to %g"), opt.segf->key, segf);
+ G_warning(_("Option '%s' is too small, set to %g"), opt.smooth->key, segf);
}
Points = Vect_new_line_struct();
@@ -387,6 +387,7 @@
Vect_close(&In);
/* cleaning part 1: count errors */
+ G_message(_("Searching for topology errors..."));
G_set_verbose(0);
Vect_build_partial(&Out, GV_BUILD_CENTROIDS);
G_set_verbose(verbose);
Modified: grass/trunk/vector/v.voronoi/sw_geometry.c
===================================================================
--- grass/trunk/vector/v.voronoi/sw_geometry.c 2013-09-10 14:13:53 UTC (rev 57629)
+++ grass/trunk/vector/v.voronoi/sw_geometry.c 2013-09-10 20:29:47 UTC (rev 57630)
@@ -215,7 +215,7 @@
int makevertex(struct Site *v)
{
- v->sitenbr = nvertices;
+ v->sitenbr = -1;
nvertices++;
out_vertex(v);
return 0;
Modified: grass/trunk/vector/v.voronoi/sw_voronoi.c
===================================================================
--- grass/trunk/vector/v.voronoi/sw_voronoi.c 2013-09-10 14:13:53 UTC (rev 57629)
+++ grass/trunk/vector/v.voronoi/sw_voronoi.c 2013-09-10 20:29:47 UTC (rev 57630)
@@ -102,6 +102,8 @@
e = lbnd->ELedge;
out_ep(e);
}
+
+ /* TODO: free memory */
return 0;
}
Modified: grass/trunk/vector/v.voronoi/vo_write.c
===================================================================
--- grass/trunk/vector/v.voronoi/vo_write.c 2013-09-10 14:13:53 UTC (rev 57629)
+++ grass/trunk/vector/v.voronoi/vo_write.c 2013-09-10 20:29:47 UTC (rev 57630)
@@ -59,11 +59,6 @@
}
if (knownPointAtLeft == -1) {
-
- /*
- G_warning("Dead edge!");
- return 1;
- */
x2 = (e->reg[le]->coord.x + e->reg[re]->coord.x) / 2.0;
y2 = (e->reg[le]->coord.y + e->reg[re]->coord.y) / 2.0;
knownPointAtLeft = 0;
@@ -75,7 +70,6 @@
return 0;
}
- G_debug(0, "x1 = %g, y1 = %g, x2 = %g, y2 = %g", x1, y1, x2, y2);
knownPointAtLeft = 1;
}
if (extend_line(Box.S, Box.N, Box.W, Box.E,
More information about the grass-commit
mailing list