POV-Ray : Newsgroups : povray.binaries.images : rendering height fields with overhangs : Re: rendering height fields with overhangs Server Time
4 Nov 2024 17:30:54 EST (-0500)
  Re: rendering height fields with overhangs  
From: stbenge
Date: 17 Dec 2009 16:15:42
Message: <4b2a9f7e$1@news.povray.org>
Oops, there was some vestigial code in that last macro. Here's a better 
version:

#macro hf_slicer(hfs, hfs_control_pigment, hfs_n_slices)
  #local hfs_incre=1/hfs_n_slices;
  #local hfs_function=function{pigment{hfs_control_pigment}}
  #local hfs_p1=0;
  #local hfs_V=0;
  union{
   #while(hfs_V<=1)
    #local hfs_pv=hfs_function(0,hfs_V,0).x;
    #local hfs_p2=hfs_p1;
    #local hfs_p1=hfs_pv;
    object{hfs
     #if(hfs_p1>hfs_p2)
      clipped_by{plane{y,hfs_p1}} clipped_by{plane{y,hfs_p2 inverse}}
     #else
      clipped_by{plane{y,hfs_p1 inverse}} clipped_by{plane{y,hfs_p2}}
     #end
     translate -y*hfs_p2
     scale<1,hfs_incre/(hfs_p1-hfs_p2),1>
     translate y*hfs_V
    }
    #local hfs_V=hfs_V+hfs_incre;
   #end
   translate -y*hfs_incre
  }
#end


Post a reply to this message

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