POV-Ray : Newsgroups : povray.general : select, is this logical? : Re: select, is this logical? Server Time
29 Apr 2024 02:17:07 EDT (-0400)
  Re: select, is this logical?  
From: William F Pokorny
Date: 3 Oct 2016 11:34:24
Message: <57f27a80$1@news.povray.org>
On 10/03/2016 10:11 AM, Bald Eagle wrote:
> William F Pokorny <ano### [at] anonymousorg> wrote:
>> On 10/03/2016 08:06 AM, John Greenwood wrote:
>
>>>   #declare Change = true;
>>>   #declare Function = function( F){select(Change,F,-F)}
>
>> Note there are two select variants. ....
>> Then a second form which supports both such transitions and the boolean
>> form.
>
>
> So, the thing(s) to try would be:
>
> #declare Change = true;
> #declare Function = function (F) { select(Change, F, F, -F) }
>
> or
>
> #declare Function = function (F) { select(Change, F, -F, -F) }
>
> Correct?
>
>

The 'boolean' returns 0 or 1 and so triggers only the last two of the 
negative, zero or positive selections in order.

Perhaps play with this code:

#version 3.7;
global_settings { assumed_gamma 1 }
#include "functions.inc"
#debug "\n---\n"
#debug concat("select((1<0),-1.0,0.0,1.0) ==> ",
        str(select((1<0),-1.0,0.0,1.0),0,4)," \n")
#debug concat("select(false,-1.0,0.0,1.0) ==> ",
        str(select(false,-1.0,0.0,1.0),0,4)," \n")
#debug concat("select((1>0),-1.0,0.0,1.0) ==> ",
        str(select((1>0),-1.0,0.0,1.0),0,4)," \n")
#debug concat("select(true,-1.0,0.0,1.0)  ==> ",
        str(select(true,-1.0,0.0,1.0),0,4)," \n")
#debug concat("select(-1,-1.0,0.0,1.0)    ==> ",
        str(select(-1,-1.0,0.0,1.0),0,4)," \n")
#debug "---\n"
#error "Stop before actual render for demonstration code."


Bill P.


Post a reply to this message

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