POV-Ray : Newsgroups : povray.unofficial.patches : Step function : Re: Step function Server Time
28 Apr 2024 22:09:54 EDT (-0400)
  Re: Step function  
From: Alberto
Date: 22 Aug 2000 00:01:04
Message: <39A1FABF.3E55ED39@usb.ve>
Libellule wrote:
> 
> I was wondering if it was possible to add a Heaviside step function for
> use in isosurfaces:
> 

You can do it with the gradient pattern used as a pigment. In the
following example, the Heaviside function domain is restricted to the x
interval (-1, 1)

#version unofficial MegaPov 0.5;
#default{pigment{rgb 1}}

camera{location <3, 5, -5>  look_at 0 angle 60}
light_source{<2,5,-5>  rgb 1}

#macro Heaviside(jump)
  #local lx = (jump + 1)/2;
  #declare myheavi =
    function{
      pigment{gradient x translate -x/2 scale 2
      color_map{[lx rgb 0][lx rgb 1]}
    }
  }
#end

Heaviside(.5)

isosurface{function{y - myheavi(x, y, z)/10}
  contained_by{box -<1, 1, 1> <1, 1, 1>}
  accuracy .01
  max_gradient 21
}

Hope this will help you.

Regards,       Alberto


Post a reply to this message

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