POV-Ray : Newsgroups : povray.unofficial.patches : Isosurface & float functions Server Time
2 Sep 2024 18:18:11 EDT (-0400)
  Isosurface & float functions (Message 1 to 6 of 6)  
From: Gilles Tran
Subject: Isosurface & float functions
Date: 15 Jul 1999 12:38:13
Message: <378E0F19.C4643CA3@inapg.inra.fr>
This is something I've noticed a while ago but didn't care about until
recently : some math functions are not recognized in the isosurface
function declaration : pow, log, atan2, int, ceil, floor.
function  y + sqrt(x) works
but
function  y + pow(x,0.5) returns an error ("float factor expected but
pow found instead")

Any clue about this behavior ? Or am I missing something obvious ? It
looks like the part of the patch that parses the function declaration
doesn't know about these particular float functions.

Many thanks

Gilles


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Isosurface & float functions
Date: 15 Jul 1999 13:18:09
Message: <378e17d1@news.povray.org>
In article <378E0F19.C4643CA3@inapg.inra.fr> , Gilles Tran 
<tra### [at] inapginrafr>  wrote:

> This is something I've noticed a while ago but didn't care about until
> recently : some math functions are not recognized in the isosurface
> function declaration : pow, log, atan2, int, ceil, floor.
> function  y + sqrt(x) works
> but
> function  y + pow(x,0.5) returns an error ("float factor expected but
> pow found instead")
>
> Any clue about this behavior ? Or am I missing something obvious ? It
> looks like the part of the patch that parses the function declaration
> doesn't know about these particular float functions.

The functions in the patch do _not_ match the POV-Ray functions, they are a
separate implementation and certain functions simply do not exist.


     Thorsten


Post a reply to this message

From: TonyB
Subject: Re: Isosurface & float functions
Date: 16 Jul 1999 07:42:28
Message: <378F0C7B.7813D5B7@panama.phoenix.net>
Ever hear of x^0.5?

Gilles Tran wrote:

> This is something I've noticed a while ago but didn't care about until
> recently : some math functions are not recognized in the isosurface
> function declaration : pow, log, atan2, int, ceil, floor.
> function  y + sqrt(x) works
> but
> function  y + pow(x,0.5) returns an error ("float factor expected but
> pow found instead")
>
> Any clue about this behavior ? Or am I missing something obvious ? It
> looks like the part of the patch that parses the function declaration
> doesn't know about these particular float functions.
>
> Many thanks
>
> Gilles

--
Anthony L. Bennett
http://welcome.to/TonyB

Graphics rendered
by the Dreamachine.


Post a reply to this message

From: Gilles Tran
Subject: Re: Isosurface & float functions
Date: 16 Jul 1999 08:38:28
Message: <378F286D.5E2F189D@inapg.inra.fr>
How's that for a discovery :
"^" is an invalid operator in straight povray ("object or directive not
found but ^ found instead)
but... it works in the function{} feature of the Superpatch !!!

So it solves the problem for pow (and also the riddle of why a common
function like this was not implemented ; I suspect that R. Suzuki actually
implemented ^ support before the official povray had the pow function).

Many thanks TonyB, you saved the day (mine at least)
Gilles

TonyB wrote:

> Ever hear of x^0.5?
>
> Gilles Tran wrote:
>
> > This is something I've noticed a while ago but didn't care about until
> > recently : some math functions are not recognized in the isosurface
> > function declaration : pow, log, atan2, int, ceil, floor.
> > function  y + sqrt(x) works
> > but
> > function  y + pow(x,0.5) returns an error ("float factor expected but
> > pow found instead")
> >
> > Any clue about this behavior ? Or am I missing something obvious ? It
> > looks like the part of the patch that parses the function declaration
> > doesn't know about these particular float functions.
> >
> > Many thanks
> >
> > Gilles
>
> --
> Anthony L. Bennett
> http://welcome.to/TonyB
>
> Graphics rendered
> by the Dreamachine.


Post a reply to this message

From: TonyB
Subject: Re: Isosurface & float functions
Date: 16 Jul 1999 22:24:30
Message: <378FDB32.27BCBBFF@panama.phoenix.net>
Sure, no problem. Glad I could be of service. =)

--
Anthony L. Bennett
http://welcome.to/TonyB


Post a reply to this message

From: Lummox JR
Subject: Re: Isosurface & float functions
Date: 22 Jul 1999 14:53:34
Message: <379768E3.4CB2@aol.com>
Gilles Tran wrote:
> 
> This is something I've noticed a while ago but didn't care about until
> recently : some math functions are not recognized in the isosurface
> function declaration : pow, log, atan2, int, ceil, floor.
> function  y + sqrt(x) works
> but
> function  y + pow(x,0.5) returns an error ("float factor expected but
> pow found instead")
> 
> Any clue about this behavior ? Or am I missing something obvious ? It
> looks like the part of the patch that parses the function declaration
> doesn't know about these particular float functions.

pow() is supported by the ^ operator, as TonyB pointed out, so y+x^0.5
will work for you, but sqrt() is still the better way to go for its
simplicity. The function is cleaner and faster. log() doesn't work but
ln() does, so if you want a base-10 log you can always use ln(x)/ln(10).
As for atan2(), floor(), and ceil(), I added them myself, a few weeks
ago. I also added pi and clock, so you can use them directly, without
having to #declare a variable to sub in for them first. And, I added
radians() and degrees(), and if()--which is a binary function that works
like this:

if(condition,expr1,expr2)

If condition>0, return expr1
Else return expr2

I've found if() is handy for a means of bounding density functions, as I
originally intended ceil() and floor() to be.
It's actually not hard to add functions to the isosurface
implementation, so I did so. A little before you wrote this post, I
actually added function-normal calculation so that isoblobs would work
correctly (though I might find a way to go back to the old system
anyway, if I can do so easily). atan2() isn't calculating its normal
correctly, so that I may have to fudge it, but other than that the
function-normal parts can be made to work on isosurfaces as well. I
think this might in some cases be slower than the old normal-finding
method--and in some cases a lot slower--so it might be necessary to
include some sort of flag in the isoblob, as well as in the isosurface
and parametric surface (when I get around to that one) that allows it to
specify the means by which normals are calculated.

Lummox JR


Post a reply to this message

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