POV-Ray : Newsgroups : povray.unofficial.patches : ISO question, returning y val : Re: ISO question, returning y val Server Time
2 Sep 2024 00:15:49 EDT (-0400)
  Re: ISO question, returning y val  
From: Greg M  Johnson
Date: 31 Jul 2000 10:17:34
Message: <39858943.B02BF0E2@my-dejanews.com>
Tom Melly wrote:

> Is there anyway, when using iso-surfaces, of returning the max and min
> values of the surface for y?

In case you weren't able to decipher their answers, they mean the following.
(I have working code for this at home, this is from memory):

Assume your box is bounded by        _/- x_extent, and  _/- z_extent

#delcare ymin=1000000000;
#declare ymax=-1000000000;
#declare ysum=0;
#declare count=0;

#declare dx=0;
#declare dz=0;
#while(dx<100)  // or any other big number
    #while (dz<100)  // or any other big number
        #declare Norm=<0,0,0>;

        #declare tracey=trace(Your_Iso_Object,  < (dx-50)/50*x_extent,
10000000,  (dx-50)/50*x_extent>, -y, Norm);

        #if (Norm.x = 0 & Norm.y=0 & Norm.z = 0)
            #debug "You tried to sample a point that is beyond the extent of
the surface, I'm quittin' >:-P"
            #declare asdf=1/0;
        #else
            #if (tracey.y>ymax)
                 #declare ymax=tracey;
            #end
            #if (tracey.y<ymin)
                 #declare ymin=tracey.y;
           #end
            #declare ysum=ysum+tracey.y;
            #declare count=count+1;
         #end
#declare dz=dz+1;
#end
#declare dz=0;
#declare dx=dz+1;
#end
#declare yavg=ysum/count;


Post a reply to this message

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