POV-Ray : Newsgroups : povray.advanced-users : Question! : Re: Question! Server Time
30 Jul 2024 10:15:25 EDT (-0400)
  Re: Question!  
From: Chris Huff
Date: 25 Mar 2000 08:35:46
Message: <chrishuff_99-0050B3.08375625032000@news.povray.org>
In article <XabaOGJ2TFw0Mrf=rUXtavRUQB6F@4ax.com>, Peter Popov 
<pet### [at] usanet> wrote:

...
> It *might* just work a prima vista but I doubt it as I typed it
> directly in the newsreader ;) Anyway, you get the idea.

This version seems to work fine, although I haven't heavily tested it 
yet. It returns the lowest point instead of positioning the object on a 
surface at y=0.

#macro FindLowestPoint(Object, Steps)
    #local MinExt = min_extent(Object);
    #local MaxExt = max_extent(Object);
    #local Size = MaxExt-MinExt;
    #local LowestPt = MaxExt;
    
    #local Z=0;
    #while(Z<Steps)
        #local X=0;
        #while(X<Steps)
            #local TempPt = trace(Object, 
                MinExt+(<X,0,Z>*Size/(Steps-1))-y, y);
            
#if((TempPt.y<LowestPt.y)&((TempPt.x!=0)|(TempPt.y!=0)|(TempPt.z!=0)))
                #local LowestPt = TempPt;
            #end
            #local X=X+1;
        #end
        #local Z=Z+1;
    #end
    (LowestPt)
#end

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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