![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
clipka <ano### [at] anonymous org> wrote:
> Am 21.03.2013 03:32, schrieb Cousin Ricky:
>
> > POV-Ray veterans and C programmers will spot my error immediately.
>
> Will they?
I guess I shouldn't be so hard on myself, then.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Le 25/03/2013 18:47, Cousin Ricky nous fit lire :
> Christian Froeschlin <chr### [at] chrfr de> 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.
That would be a kind of paradox (paradox of the Court): if a newbie can
explain why, (s)he is no more a newbie. (and to spoil the fix, it's
related to the usage of parentheses).
http://en.wikipedia.org/wiki/Paradox_of_the_Court
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
BTW I never really thought much about this but I think I exclusively
use macros to return complete entities (union, texture, function,...).
In this case it would be something like (untested online code snippet)
#macro Basic_shape (Rpipe, Rsaddle)
function
{
1 - sqrt(...)
}
#end
#declare f_basic_shape = Basic_shape(0.4,0.4)
isosurface
{
function { max (f_basic_shape(x,y,z), -f_basic_shape(x,y,z) ) }
...
}
Probably avoids a whole lot of trouble ;)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Cousin Ricky" <rickysttATyahooDOTcom> wrote:
> Christian Froeschlin <chr### [at] chrfr de> 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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Le 01/04/2013 21:14, Sohcahtoa nous fit lire :
> "Cousin Ricky" <rickysttATyahooDOTcom> wrote:
>> Christian Froeschlin <chr### [at] chrfr de> 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
>
>
>
>
IMHO, You would qualify as newbie, no cigar. What about the definition
of RE_fn_Blob2 ? no parentheses either ?
would you have the discount ? that's an open question.
And no offence ever intended. keep smiling.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Sohcahtoa" <kil### [at] yahoo com> wrote:
> 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
Good programming practice suggests the latter. The caller shouldn't have to
babysit the macro. See also:
http://www.povray.org/documentation/view/3.6.1/243/#s02_02_02_08_04
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Le_Forgeron <jgr### [at] free fr> wrote:
> What about the definition
> of RE_fn_Blob2 ? no parentheses either ?
RE_fn_Blob2() is a function, not a macro, so it doesn't need to be defined or
called with parentheses.
FYI, it is defined as:
_________________________________________________________
#declare RE_fn_Blob2 = function (RE_P0_Value, RE_P1_Blob)
{ select
( RE_P1_Blob - RE_P0_Value, 0,
pow ((RE_P1_Blob - RE_P0_Value) / RE_P1_Blob, 2)
)
}
_________________________________________________________
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |