|
|
On 02/11/2023 12:33, William F Pokorny wrote:
> On 11/2/23 02:40, kurtz le pirate wrote:
>> Last remark. To reduce the hue between 0 and 360, I use my "mod2"
>> function, which ALWAYS returns a positive value.
>>
>> #declare mod2 = function (x,y) { select(mod(x,y),mod(x,y)+y,mod(x,y)) }
>>
>> Too many troubles with the standard mod() function ...
>
> Thanks! I've made your updates and done a couple, hsb2rgb vs CHSV2RGB,
> image compares. I too see the results matching perfectly.
>
> Your mod2 function is a good candidate to make an inbuilt parser
> function. I've already implemented an inbuilt function in my fork called
> f_npmod which matches the internal pattern mechanism's version of:
>
> [0, n] = {x | 0 <= x <= n} (n == 1 always inside the pattern mechanism)
>
> rather than mod's usual:
>
> [0, n) = {x | 0 <= x < n}
>
> and there is perhaps a place for a fourth form I suppose which would
> functionally be a combination of both mod2 and f_npmod.
>
> The color manipulation macros like hsb2rgb() - traditionally in
> colors.inc - I see as better existing in an include called
> color_manipulations.inc (or similar) apart from any general color
> definitions.
>
> The color_manipulations.inc then being a part of a separately maintained
> 'extended includes' package for my yuqk fork. Who knows though, if I'll
> ever get around to maintaining and shipping such a package.
>
> Still, I've been capturing SDL code I think would be good as part of
> such a package though - and your implementation of hsb2rgb saved aside
> for that eventual purpose.
>
> Bill P.
>
Yes, a "color_manipulations.inc" is a very good idea.
You can use my code as you like.
I can code other colors conversion method found on
<https://www.rapidtables.com/convert/color/index.html>
Tell me if it's worth it...
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|