[Rd] Bug in hsv() (PR#712)

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
27 Oct 2000 19:04:15 +0200


murdoch@stats.uwo.ca writes:

> Ross posted this code:
> 
>  persp(x, y, z, col = cm.colors(10)[floor(9 * hgt + 1)], theta = 35)
> 
> I hadn't seen the cm.colors function before; it's very nice!  I wanted
> to modify it a bit to allow the start and end colors as well as the
> max saturation to be specified, and I think I may have turned up a bug
> in the hsv() function.  Here's the evidence of the bug:
> 
> Look at the results of these two calls to hsv:
> 
> > hsv(h=0.833333333333333,s=0.5,v=1)
> [1] "#FF8080"
> > hsv(h=0.8333333333333333,s=0.5,v=1)
> [1] "#FF80FF"
> 
> I think the 3 color components are listed as hex values in Blue,
> Green, Red order here.  The two calls have nearly identical parameters
> (differing in hue only in the 16th decimal place), but the red
> component is twice as strong in the second one.

Yes, this is a bug. It is also visible by viewing (h,hsv(h)) for
values of h close to 5/6. There appears to be a small window from
about 0.8333317 to 0.8333333 where the 3rd component is 00 instead of
FF. (The order of the components are Red, Green, Blue though....)

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._