POV-Ray : Newsgroups : povray.binaries.images : improved exclusion test macro [30k] : Re: improved exclusion test macro [30k] Server Time
5 Nov 2024 18:28:26 EST (-0500)
  Re: improved exclusion test macro [30k]  
From: [GDS|Entropy]
Date: 15 Feb 2009 08:29:25
Message: <499818b5@news.povray.org>
Source in p.b.s-f


"[GDS|Entropy]" <gds### [at] hotmailcom> wrote in message 
news:4998188e@news.povray.org...
> Hello,
>
> I have improved my macro following suggestions given to me regarding the 
> previous version.
> Please find attached test images.
>
> Here is the "internal test" version:
>
> //      exclusionTest Macro by [GDS|Entropy] - Release - Internal Version
> #macro exclusionTest(ctr,vectorArray,testObject)
> #local vectorA = min_extent(testObject);
> #local vectorB = max_extent(testObject);
> #local i=0;
> #while (i<ctr)
>  #if (((vectorArray[i].x <= vectorB.x) & (vectorArray[i].x >= vectorA.x)) 
> &
>       ((vectorArray[i].y <= vectorB.y) & (vectorArray[i].y >= vectorA.y)) 
> &
>       ((vectorArray[i].z <= vectorB.z) & (vectorArray[i].z >= vectorA.z)))
>   #if (inside(testObject,vectorArray[i]))
>    callExternal(ctr,0,vectorArray[i])
>   #end
>  #end
> #set i=i+1;
> #end
> #end
> //------
>
> #macro callExternal(ctr,option,valueToPass)
> //     your macros here
> #end
>
> This seems to work with spheres, torii, cubes, quartic cyl, etc...
> I haven't tested it on more complicated objects.
>
> The source file has a few different versions of that macro, including a 
> "meta" version with more options and one with #debug text included for 
> ease of comprehension.
>
> ian
>
>


Post a reply to this message

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