POV-Ray : Newsgroups : povray.bugreports : unexpected evaluation of #if(...)? : Re: unexpected evaluation of #if(...)? Server Time
14 Mar 2025 08:04:01 EDT (-0400)
  Re: unexpected evaluation of #if(...)?  
From: kurtz le pirate
Date: 8 Mar 2025 11:47:04
Message: <67cc7488@news.povray.org>
On 08/03/2025 12:34, ingo wrote:
> kurtz le pirate <kur### [at] freefr> wrote:
> 
>> So, splitting conditions seems to be the only solution with POV.
> 
> But not always straight forward,
> 
> #if (Z > 0 & VoxelGrid[X][Y][Z-1] > 0)
>    .....
> #else
>    .....
> #end
> 
> after splitting #else may not be reached, where it is in the original (VoxelGrid
> = 0).
> 
> #if (Z > 0)
>    #if (VoxelGrid[X][Y][Z-1] > 0)
>      ....
>    #end
> #else
>    ....
> #end
> 
> it needs some thought and the code is way more complex than this. (#switch #case
> can be an alternative after turning the conditions into "states")

Of corse.


It also depends on what you want to do in the "else" case.
You can also do something like this :

   #if ( VoxelGrid[X][Y][(Z>0?Z-1:OTHER)] > 0 )

More tricky



-- 
kurtz le pirate
compagnie de la banquise


Post a reply to this message

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