JuliaAttic / Color.jl

Basic color manipulation utilities.
Other
47 stars 21 forks source link

MSC fix and README update #19

Closed natj closed 10 years ago

natj commented 10 years ago

This is a relatively simple fix for #17 by checking if we are on the edge of the RGB cube and returning the related color without any further calculations.

I also added a description of colormap and related functions to README. Feel free to correct me in case of possible typos, as I am not a native english speaker.

natj commented 10 years ago

I dunno, for me the wrap-around seemed more intuitive but I can change it to your method too, if you think it is more suitable.

natj commented 10 years ago

On a more general scale, I think we should pick one method and stick to that with every function that has a hue defined using the angle...

jiahao commented 10 years ago

I'm not an expert in color spaces, but it's really a question of whether if the boundaries wrap around in h.

glennsweeney commented 10 years ago

Hue is defined differently in various color spaces. However, in terms of CIELUV, hue is just atan(v/u). As a result, h=n and h=n+360 are the same [u,v] coordinate. From a color point of view, wrapping should be the preferred treatment.

jiahao commented 10 years ago

In which case, it looks like the entire while !(0 <= h <= 360) ... end block can be replaced by h = mod(h, 360). The code generated by the latter is more efficient.

natj commented 10 years ago

Ugh, you are completely right @jiahao! I'll change that part to use mod in a sec...

natj commented 10 years ago

If you need, I can squeeze these into a single commit. However, I think these should also merge without any conflict separately.

natj commented 10 years ago

I squashed everything into a one big commit for easier merge.

dcjones commented 10 years ago

Looks good to me.