[GRASS-SVN] r33367 - in grass-addons/vector: v.buffer2 v.parallel2
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 10 04:59:00 EDT 2008
Author: rmatev
Date: 2008-09-10 04:59:00 -0400 (Wed, 10 Sep 2008)
New Revision: 33367
Modified:
grass-addons/vector/v.buffer2/dgraph.c
grass-addons/vector/v.buffer2/e_intersect.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/vlib_buffer.c
Log:
Removed C99 calls.
Modified: grass-addons/vector/v.buffer2/dgraph.c
===================================================================
--- grass-addons/vector/v.buffer2/dgraph.c 2008-09-10 07:34:42 UTC (rev 33366)
+++ grass-addons/vector/v.buffer2/dgraph.c 2008-09-10 08:59:00 UTC (rev 33367)
@@ -1,5 +1,4 @@
#include <stdlib.h>
-#include <math.h>
#include <grass/Vect.h>
#include <grass/gis.h>
#include "dgraph.h"
Modified: grass-addons/vector/v.buffer2/e_intersect.c
===================================================================
--- grass-addons/vector/v.buffer2/e_intersect.c 2008-09-10 07:34:42 UTC (rev 33366)
+++ grass-addons/vector/v.buffer2/e_intersect.c 2008-09-10 08:59:00 UTC (rev 33367)
@@ -1,9 +1,14 @@
#include <stdlib.h>
-#include <math.h>
#include <grass/gis.h>
#include "e_intersect.h"
#define SWAP(a,b) {t = a; a = b; b = t;}
+#ifndef MIN
+ #define MIN(X,Y) ((X<Y)?X:Y)
+#endif
+#ifndef MAX
+ #define MAX(X,Y) ((X>Y)?X:Y)
+#endif
#define D (ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2)
#define DA (bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2)
#define DB (ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1)
@@ -118,11 +123,11 @@
return 1;
}
- if ((fmax(ax1, ax2) < fmin(bx1, bx2)) || (fmax(bx1, bx2) < fmin(ax1, ax2))) {
+ if ((MAX(ax1, ax2) < MIN(bx1, bx2)) || (MAX(bx1, bx2) < MIN(ax1, ax2))) {
G_debug(3, " no intersection (disjoint bounding boxes)");
return 0;
}
- if ((fmax(ay1, ay2) < fmin(by1, by2)) || (fmax(by1, by2) < fmin(ay1, ay2))) {
+ if ((MAX(ay1, ay2) < MIN(by1, by2)) || (MAX(by1, by2) < MIN(ay1, ay2))) {
G_debug(3, " no intersection (disjoint bounding boxes)");
return 0;
}
@@ -349,8 +354,8 @@
G_debug(2, " d1 = %.18g", d1);
G_debug(2, " d2 = %.18g", d2);
- tola = tol/fmax(fabs(ax2-ax1), fabs(ay2-ay1));
- tolb = tol/fmax(fabs(bx2-bx1), fabs(by2-by1));
+ tola = tol/MAX(fabs(ax2-ax1), fabs(ay2-ay1));
+ tolb = tol/MAX(fabs(bx2-bx1), fabs(by2-by1));
G_debug(2, " tol = %.18g", tol);
G_debug(2, " tola = %.18g", tola);
G_debug(2, " tolb = %.18g", tolb);
@@ -366,7 +371,7 @@
return 0;
}
- ra = fmin(fmax(ra, 0), 1);
+ ra = MIN(MAX(ra, 0), 1);
*x1 = ax1 + ra*(ax2 - ax1);
*y1 = ay1 + ra*(ay2 - ay1);
@@ -595,11 +600,11 @@
return 1;
}
- if ((fmax(ax1, ax2) < fmin(bx1, bx2)) || (fmax(bx1, bx2) < fmin(ax1, ax2))) {
+ if ((MAX(ax1, ax2) < MIN(bx1, bx2)) || (MAX(bx1, bx2) < MIN(ax1, ax2))) {
G_debug(DLEVEL, " no intersection (disjoint bounding boxes)");
return 0;
}
- if ((fmax(ay1, ay2) < fmin(by1, by2)) || (fmax(by1, by2) < fmin(ay1, ay2))) {
+ if ((MAX(ay1, ay2) < MIN(by1, by2)) || (MAX(by1, by2) < MIN(ay1, ay2))) {
G_debug(DLEVEL, " no intersection (disjoint bounding boxes)");
return 0;
}
@@ -828,11 +833,11 @@
return 1;
}
- if ((fmax(ax1, ax2) < fmin(bx1, bx2)) || (fmax(bx1, bx2) < fmin(ax1, ax2))) {
+ if ((MAX(ax1, ax2) < MIN(bx1, bx2)) || (MAX(bx1, bx2) < MIN(ax1, ax2))) {
G_debug(0, " no intersection (disjoint bounding boxes)");
return 0;
}
- if ((fmax(ay1, ay2) < fmin(by1, by2)) || (fmax(by1, by2) < fmin(ay1, ay2))) {
+ if ((MAX(ay1, ay2) < MIN(by1, by2)) || (MAX(by1, by2) < MIN(ay1, ay2))) {
G_debug(0, " no intersection (disjoint bounding boxes)");
return 0;
}
Modified: grass-addons/vector/v.buffer2/vlib_buffer.c
===================================================================
--- grass-addons/vector/v.buffer2/vlib_buffer.c 2008-09-10 07:34:42 UTC (rev 33366)
+++ grass-addons/vector/v.buffer2/vlib_buffer.c 2008-09-10 08:59:00 UTC (rev 33367)
@@ -5,7 +5,6 @@
**
*/
#include <stdlib.h>
-#include <math.h>
#include <grass/Vect.h>
#include <grass/gis.h>
#include "dgraph.h"
@@ -909,7 +908,7 @@
int i, res, winding, isle;
int more = 8;
int isles_allocated = 0;
- double max = fmax(da, db);
+ 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 07:34:42 UTC (rev 33366)
+++ grass-addons/vector/v.parallel2/dgraph.c 2008-09-10 08:59:00 UTC (rev 33367)
@@ -1,5 +1,4 @@
#include <stdlib.h>
-#include <math.h>
#include <grass/Vect.h>
#include <grass/gis.h>
#include "dgraph.h"
Modified: grass-addons/vector/v.parallel2/e_intersect.c
===================================================================
--- grass-addons/vector/v.parallel2/e_intersect.c 2008-09-10 07:34:42 UTC (rev 33366)
+++ grass-addons/vector/v.parallel2/e_intersect.c 2008-09-10 08:59:00 UTC (rev 33367)
@@ -1,9 +1,14 @@
#include <stdlib.h>
-#include <math.h>
#include <grass/gis.h>
#include "e_intersect.h"
#define SWAP(a,b) {t = a; a = b; b = t;}
+#ifndef MIN
+ #define MIN(X,Y) ((X<Y)?X:Y)
+#endif
+#ifndef MAX
+ #define MAX(X,Y) ((X>Y)?X:Y)
+#endif
#define D (ax2-ax1)*(by1-by2) - (ay2-ay1)*(bx1-bx2)
#define DA (bx1-ax1)*(by1-by2) - (by1-ay1)*(bx1-bx2)
#define DB (ax2-ax1)*(by1-ay1) - (ay2-ay1)*(bx1-ax1)
@@ -118,11 +123,11 @@
return 1;
}
- if ((fmax(ax1, ax2) < fmin(bx1, bx2)) || (fmax(bx1, bx2) < fmin(ax1, ax2))) {
+ if ((MAX(ax1, ax2) < MIN(bx1, bx2)) || (MAX(bx1, bx2) < MIN(ax1, ax2))) {
G_debug(3, " no intersection (disjoint bounding boxes)");
return 0;
}
- if ((fmax(ay1, ay2) < fmin(by1, by2)) || (fmax(by1, by2) < fmin(ay1, ay2))) {
+ if ((MAX(ay1, ay2) < MIN(by1, by2)) || (MAX(by1, by2) < MIN(ay1, ay2))) {
G_debug(3, " no intersection (disjoint bounding boxes)");
return 0;
}
@@ -349,8 +354,8 @@
G_debug(2, " d1 = %.18g", d1);
G_debug(2, " d2 = %.18g", d2);
- tola = tol/fmax(fabs(ax2-ax1), fabs(ay2-ay1));
- tolb = tol/fmax(fabs(bx2-bx1), fabs(by2-by1));
+ tola = tol/MAX(fabs(ax2-ax1), fabs(ay2-ay1));
+ tolb = tol/MAX(fabs(bx2-bx1), fabs(by2-by1));
G_debug(2, " tol = %.18g", tol);
G_debug(2, " tola = %.18g", tola);
G_debug(2, " tolb = %.18g", tolb);
@@ -366,7 +371,7 @@
return 0;
}
- ra = fmin(fmax(ra, 0), 1);
+ ra = MIN(MAX(ra, 0), 1);
*x1 = ax1 + ra*(ax2 - ax1);
*y1 = ay1 + ra*(ay2 - ay1);
@@ -595,11 +600,11 @@
return 1;
}
- if ((fmax(ax1, ax2) < fmin(bx1, bx2)) || (fmax(bx1, bx2) < fmin(ax1, ax2))) {
+ if ((MAX(ax1, ax2) < MIN(bx1, bx2)) || (MAX(bx1, bx2) < MIN(ax1, ax2))) {
G_debug(DLEVEL, " no intersection (disjoint bounding boxes)");
return 0;
}
- if ((fmax(ay1, ay2) < fmin(by1, by2)) || (fmax(by1, by2) < fmin(ay1, ay2))) {
+ if ((MAX(ay1, ay2) < MIN(by1, by2)) || (MAX(by1, by2) < MIN(ay1, ay2))) {
G_debug(DLEVEL, " no intersection (disjoint bounding boxes)");
return 0;
}
@@ -828,11 +833,11 @@
return 1;
}
- if ((fmax(ax1, ax2) < fmin(bx1, bx2)) || (fmax(bx1, bx2) < fmin(ax1, ax2))) {
+ if ((MAX(ax1, ax2) < MIN(bx1, bx2)) || (MAX(bx1, bx2) < MIN(ax1, ax2))) {
G_debug(0, " no intersection (disjoint bounding boxes)");
return 0;
}
- if ((fmax(ay1, ay2) < fmin(by1, by2)) || (fmax(by1, by2) < fmin(ay1, ay2))) {
+ if ((MAX(ay1, ay2) < MIN(by1, by2)) || (MAX(by1, by2) < MIN(ay1, ay2))) {
G_debug(0, " no intersection (disjoint bounding boxes)");
return 0;
}
Modified: grass-addons/vector/v.parallel2/vlib_buffer.c
===================================================================
--- grass-addons/vector/v.parallel2/vlib_buffer.c 2008-09-10 07:34:42 UTC (rev 33366)
+++ grass-addons/vector/v.parallel2/vlib_buffer.c 2008-09-10 08:59:00 UTC (rev 33367)
@@ -5,7 +5,6 @@
**
*/
#include <stdlib.h>
-#include <math.h>
#include <grass/Vect.h>
#include <grass/gis.h>
#include "dgraph.h"
@@ -909,7 +908,7 @@
int i, res, winding, isle;
int more = 8;
int isles_allocated = 0;
- double max = fmax(da, db);
+ double max = MAX(da, db);
G_debug(2, "Vect_area_buffer()");
More information about the grass-commit
mailing list