POV-Ray : Newsgroups : povray.binaries.images : Problem: Finding the elevation range of an isosurface relief : Re: Problem: Finding the elevation range of an isosurface relief Server Time
2 Aug 2024 10:22:52 EDT (-0400)
  Re: Problem: Finding the elevation range of an isosurface relief  
From: Tim Attwood
Date: 8 Aug 2007 03:11:14
Message: <46b96c92$1@news.povray.org>
You could give it a b/w gradient pigment (ambient 1)
with a scale range that is sure to fit, then render an
overhead view without lights, load the image in an
editor and check what the brightest pixel is, and
then use that and the range to figure the ballpark
height.

Or you could use this collision macro with a
box overhead and lower it until the box hits.

// check if object A collides with object B
// Example: #local isHit = collision(A, B, 1000);
#macro collision(A B rez)
   #local result = false;
   #if (((min_extent(A).x > max_extent(B).x ) |
         (min_extent(B).x > max_extent(A).x ) |
         (min_extent(A).y > max_extent(B).y ) |
         (min_extent(B).y > max_extent(A).y ) |
         (min_extent(A).z > max_extent(B).z ) |
         (min_extent(B).z > max_extent(A).z ))=false)
      #local AB = intersection{object{A} object{B}};
      #local Mn = min_extent(AB);
      #local Mx = max_extent(AB);
      #local S1 = seed(1);
      #local Pt = VRand_In_Box(Mn, Mx, S1);
      #local cnt = 0;
      #while ((result = false) & (cnt < rez))
         #local Pt = VRand_In_Box(Mn, Mx, S1);
         #if (inside(AB, Pt))
            #local result = true;
         #end
         #local cnt = cnt + 1;
      #end
   #end
   result
#end


Post a reply to this message

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