POV-Ray : Newsgroups : povray.binaries.images : pfeh : Re: pfeh Server Time
7 Nov 2024 15:35:54 EST (-0500)
  Re: pfeh  
From: Samuel Benge
Date: 15 Jul 2004 12:58:00
Message: <40F6B731.4020004@hotmail.com>
Timothy Cook wrote:
<snip>

> So how DO I turn a sphere into a cube with an isosurface?
> I was playing with the spherical heightfield idea, and
> decided to start with a cube.  Simple enough, no?  No!  T_T
<clip>


Here's the way I do it:

#declare sphere_radius = 1;
#declare sphere_influence = .5;
#declare box_size = 1;
#declare box_influence = .5;

function{
  (
   sqrt(x*x+y*y+z*z)-sphere_radius
  )*sphere_influence
  +(
   max(
    abs(x)
    ,abs(y)
    ,abs(z)
   )-box_size
  )*box_influence
}

-Sam


Post a reply to this message

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