[GRASS-CVS] hamish: grass/src/raster/r.coin/cmd prnt_entry.c,
1.1.1.1, 1.2
grass at intevation.de
grass at intevation.de
Mon Nov 19 22:06:20 EST 2007
Author: hamish
Update of /grassrepository/grass/src/raster/r.coin/cmd
In directory doto:/tmp/cvs-serv23370/grass/src/raster/r.coin/cmd
Modified Files:
prnt_entry.c
Log Message:
more precise conversions to feet, square miles and acres
(merge from 6.3 HEAD)
Index: prnt_entry.c
===================================================================
RCS file: /grassrepository/grass/src/raster/r.coin/cmd/prnt_entry.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- prnt_entry.c 29 Dec 1999 15:11:06 -0000 1.1.1.1
+++ prnt_entry.c 20 Nov 2007 03:06:17 -0000 1.2
@@ -1,8 +1,10 @@
#include "coin.h"
#define F_CTOK(C) ((double)(C))/1000000.0
-#define F_CTOM(C) F_CTOK(C) * 0.3861
-#define F_CTOA(C) F_CTOK(C) * 247.1000
+ /* sq km -> sq miles = 1000^2 / (0.0254 * 12 * 5280)^2 */
+#define F_CTOM(C) F_CTOK(C) * 0.386102158542446
+ /* sq km -> acres = sq miles * 640 */
+#define F_CTOA(C) F_CTOK(C) * 247.105381467165
#define F_CTOH(C) F_CTOK(C) * 100.0000
#define F_CTOP(C,R) ((int)R) ? (double)C / (double)R * 100.0 : 0.0
@@ -26,7 +28,7 @@
case 'k':
print_area(F_CTOK(area));
break;
- case 'm':
+ case 'm': /* square miles */
print_area(F_CTOM(area));
break;
case 'p':
@@ -40,7 +42,7 @@
row_total(Rndex,1,&total_count,&total_area);
print_percent(F_CTOY(area,total_area));
break;
- default:
+ default: /* case 'c' */
fprintf(dumpfile," %9ld |", count);
break;
}
More information about the grass-commit
mailing list