[GRASS-SVN] r38591 -
grass/branches/develbranch_6/lib/rst/interp_float
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 2 17:09:44 EDT 2009
Author: neteler
Date: 2009-08-02 17:09:44 -0400 (Sun, 02 Aug 2009)
New Revision: 38591
Modified:
grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c
Log:
code layout prettified with tools/grass_indent.sh
Modified: grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c
===================================================================
--- grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c 2009-08-02 21:09:11 UTC (rev 38590)
+++ grass/branches/develbranch_6/lib/rst/interp_float/segmen2d.c 2009-08-02 21:09:44 UTC (rev 38591)
@@ -190,33 +190,33 @@
return -1;
}
}
- /* allocate memory for CV points only if cv is performed */
- if (params->cv){
- if (!
- (point =
- (struct triple *)G_malloc(sizeof(struct triple) *
- data->n_points))) {
- fprintf(stderr, "Cannot allocate memory for point\n");
- return -1;
- }
- }
+ /* allocate memory for CV points only if cv is performed */
+ if (params->cv) {
+ if (!
+ (point =
+ (struct triple *)G_malloc(sizeof(struct triple) *
+ data->n_points))) {
+ fprintf(stderr, "Cannot allocate memory for point\n");
+ return -1;
+ }
+ }
/*normalize the data so that the side of average segment is about 1m */
- /* put data_points into point only if CV is performed */
+ /* put data_points into point only if CV is performed */
for (i = 0; i < data->n_points; i++) {
data->points[i].x = (data->points[i].x - data->x_orig) / dnorm;
data->points[i].y = (data->points[i].y - data->y_orig) / dnorm;
- if (params->cv){
- point[i].x = data->points[i].x; /*cv stuff */
- point[i].y = data->points[i].y; /*cv stuff */
- point[i].z = data->points[i].z; /*cv stuff */
- }
+ if (params->cv) {
+ point[i].x = data->points[i].x; /*cv stuff */
+ point[i].y = data->points[i].y; /*cv stuff */
+ point[i].z = data->points[i].z; /*cv stuff */
+ }
/* commented out by Helena january 1997 as this is not necessary
- although it may be useful to put normalization of z back?
+ although it may be useful to put normalization of z back?
data->points[i].z = data->points[i].z / dnorm;
- this made smoothing self-adjusting based on dnorm
+ this made smoothing self-adjusting based on dnorm
if (params->rsm < 0.) data->points[i].sm = data->points[i].sm / dnorm;
*/
}
@@ -227,36 +227,38 @@
else
m_skip = 1;
- /* remove after cleanup - this is just for testing */
- skip_point.x = 0.;
- skip_point.y = 0.;
- skip_point.z = 0.;
+ /* remove after cleanup - this is just for testing */
+ skip_point.x = 0.;
+ skip_point.y = 0.;
+ skip_point.z = 0.;
for (skip_index = 0; skip_index < m_skip; skip_index++) {
- if (params->cv) {
- segtest = 0;
- j = 0;
- xx = point[skip_index].x * dnorm + data->x_orig + params->x_orig;
- yy = point[skip_index].y * dnorm + data->y_orig + params->y_orig;
- zz = point[skip_index].z;
- if (xx >= data->x_orig + params->x_orig &&
- xx <= data->xmax + params->x_orig &&
- yy >= data->y_orig + params->y_orig &&
- yy <= data->ymax + params->y_orig) {
- segtest = 1;
- skip_point.x = point[skip_index].x;
- skip_point.y = point[skip_index].y;
- skip_point.z = point[skip_index].z;
- for (k = 0; k < m_skip; k++) {
- if (k != skip_index && params->cv) {
- data->points[j].x = point[k].x;
- data->points[j].y = point[k].y;
- data->points[j].z = point[k].z;
- j++;
+ if (params->cv) {
+ segtest = 0;
+ j = 0;
+ xx = point[skip_index].x * dnorm + data->x_orig +
+ params->x_orig;
+ yy = point[skip_index].y * dnorm + data->y_orig +
+ params->y_orig;
+ zz = point[skip_index].z;
+ if (xx >= data->x_orig + params->x_orig &&
+ xx <= data->xmax + params->x_orig &&
+ yy >= data->y_orig + params->y_orig &&
+ yy <= data->ymax + params->y_orig) {
+ segtest = 1;
+ skip_point.x = point[skip_index].x;
+ skip_point.y = point[skip_index].y;
+ skip_point.z = point[skip_index].z;
+ for (k = 0; k < m_skip; k++) {
+ if (k != skip_index && params->cv) {
+ data->points[j].x = point[k].x;
+ data->points[j].y = point[k].y;
+ data->points[j].z = point[k].z;
+ j++;
+ }
}
- }
- } /* segment area test */
- }
+ } /* segment area test */
+ }
if (!params->cv) {
if (params->
matrix_create(params, data->points, data->n_points,
@@ -271,11 +273,11 @@
}
if (!params->cv) {
for (i = 0; i < data->n_points; i++)
- b[i + 1] = data->points[i].z;
- b[0] = 0.;
- G_lubksb(matrix, data->n_points + 1, indx, b);
-/* put here condition to skip ertot if not needed */
- params->check_points(params, data, b, ertot, zmin, dnorm,
+ b[i + 1] = data->points[i].z;
+ b[0] = 0.;
+ G_lubksb(matrix, data->n_points + 1, indx, b);
+ /* put here condition to skip ertot if not needed */
+ params->check_points(params, data, b, ertot, zmin, dnorm,
skip_point);
}
else if (segtest == 1) {
More information about the grass-commit
mailing list