POV-Ray : Newsgroups : povray.general : Still making newbie mistakes : Re: Still making newbie mistakes Server Time
29 Jul 2024 10:18:13 EDT (-0400)
  Re: Still making newbie mistakes  
From: Sohcahtoa
Date: 1 Apr 2013 15:15:01
Message: <web.5159dc9dc4a906bbc9c203510@news.povray.org>
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> Christian Froeschlin <chr### [at] chrfrde> wrote:
> > Cousin Ricky wrote:
> >
> >  > -Basic_shape (0.4, 0.4)
> >
> > I suspect this was intended to be the negative value
> > of Basic_shape(0.4,0.4), while it may turn out to only
> > change 1-sqrt to -1-sqrt.
>
> Bingo.  But you're not a newbie, so the discount goes to the first newbie who
> explains why this happens and how to fix it.

Macros are expanded inline.  That is to say, the body of the macro is
substituted for the macro call.

You could fix it by either putting a call to the macro in parentheses, or
putting parentheses around the math in the macro definition, like this:

#macro Basic_shape (Rpipe, Rsaddle)
  (1 - sqrt
  ( RE_fn_Blob2 (f_sphere (0, y, z, Rpipe), Rsaddle)
  + RE_fn_Blob2 (f_sphere (x, 0, z, Rpipe), Rsaddle)
  - RE_fn_Blob2 (f_sphere (x, y, z, Rpipe), Rsaddle)
  ))
#end


Post a reply to this message

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