POV-Ray : Newsgroups : povray.general : #switch #case in function? : Re: Using splines to map arbitrary value (was Re: #switch #caseinfunction?) Server Time
27 Jul 2024 12:34:39 EDT (-0400)
  Re: Using splines to map arbitrary value (was Re: #switch #caseinfunction?)  
From: Ilya Razmanov
Date: 18 Jun 2024 10:10:24
Message: <66719550$1@news.povray.org>
On 18.06.2024 16:31, William F Pokorny wrote:

> 
> On your original question about #switch inside a function{} block, I saw 
> your switch by multiplication as good as anything else for clarity.

Too many math operators in a row make it difficult for me to remember 
"what was that and what I did it for?" Besides, it allows non-continous 
functions to be created, which, in my particular case, is a disadvantage 
- I'm not going to think of what POVRay will do in areas where function 
is not defined, and debug all this. With splines I only have to watch 
for endpoints 0 and 1 to exist.

In fact, I made a decision to remove all various mapping functions and 
replace them with just spline. Using it completely match Photoshop and 
GIMP "Curves" so is absolutely intuitively clear to me and hopefully 
clear enough for other people, and instead of several algorithms with 
explanatory comments I'll be having just one control points table. The 
only problem is that in POVRay input-output pairs are written left to 
right, while in Photoshop visualized as 2D plot, but I think I can stand 
it :-)

-- 
Ilyich the Toad
https://dnyarri.github.io/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.