[GRASS-SVN] r30916 - grass/trunk/lib/gis

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Apr 9 12:39:21 EDT 2008


Author: glynn
Date: 2008-04-09 12:39:21 -0400 (Wed, 09 Apr 2008)
New Revision: 30916

Modified:
   grass/trunk/lib/gis/color_xform.c
Log:
Eliminate inaccuracies at ends of range for G_log_colors()



Modified: grass/trunk/lib/gis/color_xform.c
===================================================================
--- grass/trunk/lib/gis/color_xform.c	2008-04-09 15:46:19 UTC (rev 30915)
+++ grass/trunk/lib/gis/color_xform.c	2008-04-09 16:39:21 UTC (rev 30916)
@@ -161,8 +161,15 @@
 	y = min + (max - min) * i / samples;
 	G_get_d_raster_color(&y, &red2, &grn2, &blu2, src);
 
-	lx = lmin + (lmax - lmin) * i / samples;
-	x = exp(lx);
+	if (i == 0)
+	    x = min;
+	else if (i == samples)
+	    x = max;
+	else
+	{
+	    lx = lmin + (lmax - lmin) * i / samples;
+	    x = exp(lx);
+	}
 
 	if (i > 0)
 	    G_add_d_raster_color_rule(&prev, red, grn, blu, &x, red2, grn2, blu2, dst);



More information about the grass-commit mailing list