POV-Ray : Newsgroups : povray.beta-test : v3.8b2. height_field input values at 0.0 not clean. : Re: v3.8b2. height_field input values at 0.0 not clean. Server Time
3 May 2024 11:02:55 EDT (-0400)
  Re: v3.8b2. height_field input values at 0.0 not clean.  
From: Bald Eagle
Date: 16 Feb 2023 20:00:00
Message: <web.63eed0b51428d28b1f9dae3025979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> > #include "functions.inc"
> > #declare FnChkVals = function (x) {
> >      select(((x<0.0) | (x>1.0)),
> >          0,
> >          0,
> >          f_boom(x,2,3,4,5,6)
> >      )
> > }


Kenneth, I use select all the time.

This is how it works:

select (N, -1, 0, 1)

When your comparison function gets evaluated, it returns a Boolean state (in
POV-Ray it's a 0 or a 1).

So what he's doing, is checking if x is less than 0 or greater than 1.
If it is, then the Boolean result is true, which in POV-Ray is 1.
If it's not, then the result is false, or zero.
The negative option in the select statement never gets used - it's just there to
force the select function to have a zero option that's separate from the 1
option, since a 3-term select statement is divided into 2 results:  negative or
>= 0.

I hope that helps.


Post a reply to this message

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