POV-Ray : Newsgroups : povray.advanced-users : isosurface: Does the order of multiple functions matter? : Re: isosurface: Does the order of multiple functions matter? Server Time
18 May 2024 20:38:34 EDT (-0400)
  Re: isosurface: Does the order of multiple functions matter?  
From: Kenneth
Date: 30 Jan 2023 21:50:00
Message: <web.63d880da9b90547b9b4924336e066e29@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:
>
> In case you want to try the quick test (no need for 'high-quality' settings
> here):
> -----------
> #declare BUMPS_F =
> function{pattern{bumps scale .2}}
>
> #declare GRANITE_F =
> function{pattern{granite scale 3}}
>
> #declare SIN_F = function(x){sin(7*pi*x)}
>
> isosurface{
>  function { sqrt(pow(x,2)+pow(y,2)+pow(z,2))-.7 // sphere
>
>           // switch these around...
>             + BUMPS_F(x,y,z)*.5
>
>             - GRANITE_F(x,y,z)*.5
>
>             - SIN_F(x)*.2
>
>   }
>
>  threshold 0
>  accuracy .01
>  max_gradient 8
>
> contained_by{box{-1.1,1.1}}
> pigment{ rgb 1}
> }

Just to be complete:
Here is an instance where the order of functions does matter, *when* using
additional parentheses. This is to be expected of course. As Alain pointed out
earlier (paraphrasing),
                 +(A - B) is different from -(B + A)

+ (BUMPS_F(x,y,z)*.5
- GRANITE_F(x,y,z)*.5)

- SIN_F(x)*.2

vs.

- (GRANITE_F(x,y,z)*.5)
+ (BUMPS_F(x,y,z)*.5)

- SIN_F(x)*.2


Post a reply to this message

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