POV-Ray : Newsgroups : povray.unofficial.patches : Step function : Re: Step function Server Time
29 Apr 2024 03:13:10 EDT (-0400)
  Re: Step function  
From: Alberto
Date: 22 Aug 2000 13:34:23
Message: <39A2B900.9BC7401A@usb.ve>
Chris Huff wrote:

> ... 
> You don't need a macro for this, a plain old function will do fine.
> 
> #declare Heaviside = function {if(x - y, 1, 0)}
> // x=the value, y=the jump threshold, z=nothing
> ...

Agreed. But I think the best solution to Libellule problem should be
something like

#macro Heaviside(jump)
  if(x - jump, 1, 0)
#end

isosurface{function{y - Heaviside(actual_jump)}
  contained_by{box -<1, 1, 1> <1, 1, 1>}
  accuracy .01
  max_gradient 21
}

where actual_jump is a constant float.

In this way, if you need more than one step function with jumps at
distinct places in the same isosurface, this would be the optimal
implementation. I tried this code but got an error message

error: float factor expected but macro identifier found instead.

So macro substitution doesn't work inside function{...}. I thought that
at parse time, this macro substitution would take effect.

Is that a MegaPov misbehavior or is this intended for some reason?

Regards, Alberto.


Post a reply to this message

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