POV-Ray : Newsgroups : povray.bugreports : isosurface & function val() Server Time
25 Nov 2024 06:13:11 EST (-0500)
  isosurface & function val() (Message 1 to 9 of 9)  
From: deep125
Subject: isosurface & function val()
Date: 6 Jul 2014 10:30:01
Message: <web.53b95baca974db1027687edf0@news.povray.org>
ver 3.7


code:

isosurface {
      function{
        val("1.5")
       // 5

      }
    contained_by { box { -2, 2 } }
  }


error:
line 3: Parse Error: Expected 'operand', string literal found instead
Way?


Post a reply to this message

From: clipka
Subject: Re: isosurface & function val()
Date: 6 Jul 2014 15:24:08
Message: <53b9a258@news.povray.org>
Am 06.07.2014 16:25, schrieb deep125:
>
> isosurface {
>        function{
>          val("1.5")
>         // 5
>
>        }
>      contained_by { box { -2, 2 } }
>    }
>
>
> error:
> line 3: Parse Error: Expected 'operand', string literal found instead
> Way?

Some statements are not available inside user-defined functions, because 
they typically don't make much sense there, or would have been 
unnecessarily difficult to implement; after all, these functions must be 
"compiled" into a bytecode and then executed by some virtual machine at 
run-time. A virtual machine which had to be specifically implemented for 
this task, as there was no such thing as LLVM back in those dark ages. 
(I wouldn't be too surprised if it even predates the Java VM.)

In your case, you can easily work around this limitation by using:

isosurface {
     #declare V = val("1.5");
     function { V }
     ...
}


Post a reply to this message

From: deep125
Subject: Re: isosurface & function val()
Date: 7 Jul 2014 01:25:01
Message: <web.53ba2e621c10e50297188cea0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
>>...
> Some statements are not available inside user-defined functions,
>>...

Thanks!

Where can I see list available statements?


I'm interested in use splines!


Post a reply to this message

From: clipka
Subject: Re: isosurface & function val()
Date: 7 Jul 2014 10:19:39
Message: <53baac7b$1@news.povray.org>
Am 07.07.2014 07:21, schrieb deep125:
> clipka <ano### [at] anonymousorg> wrote:
>>> ...
>> Some statements are not available inside user-defined functions,
>>> ...
>
> Thanks!
>
> Where can I see list available statements?
>
>
> I'm interested in use splines!

Splines have a function-like interface, so IIRC they are fully supported 
in functions.


Post a reply to this message

From: deep125
Subject: Re: isosurface & function val()
Date: 8 Jul 2014 10:55:00
Message: <web.53bc052a1c10e50227687edf0@news.povray.org>
> Splines have a function-like interface, so IIRC they are fully supported
> in functions.

Code:
----------

#declare MySpline=spline
{
    linear_spline
    1 , <0,0,0>
    2 , <2,2,2>

}

isosurface {
      function{
        MySpline(1).x
      }
    contained_by { box { -2, 2 } }
  }
-------------------

Error

Parse Error: Expected 'operand', spline identifier found instead

How to attach a spline?


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: isosurface & function val()
Date: 8 Jul 2014 11:05:01
Message: <web.53bc077d1c10e5022b7136990@news.povray.org>
"deep125" <dee### [at] yandexru> wrote:
> > Splines have a function-like interface, so IIRC they are fully supported
> > in functions.
>
> Code:
> ----------
>
> #declare MySpline=spline
> {
>     linear_spline
>     1 , <0,0,0>
>     2 , <2,2,2>
>
> }
>
> isosurface {
>       function{
>         MySpline(1).x
>       }
>     contained_by { box { -2, 2 } }
>   }
> -------------------
>
> Error
>
> Parse Error: Expected 'operand', spline identifier found instead
>
> How to attach a spline?

How about reading the documentation?

http://www.povray.org/documentation/view/3.6.1/231/


Post a reply to this message

From: James Holsenback
Subject: Re: isosurface & function val()
Date: 8 Jul 2014 11:07:48
Message: <53bc0944@news.povray.org>
On 07/08/2014 10:50 AM, deep125 wrote:
>> Splines have a function-like interface, so IIRC they are fully supported
>> in functions.
>
> Code:
> ----------
>
> #declare MySpline=spline
> {
>      linear_spline
>      1 , <0,0,0>
>      2 , <2,2,2>
>
> }
>
> isosurface {
>        function{
>          MySpline(1).x
>        }
>      contained_by { box { -2, 2 } }
>    }
> -------------------
>
> Error
>
> Parse Error: Expected 'operand', spline identifier found instead
>
> How to attach a spline?
>
>

you have not properly defined MySpline as a function ....

http://wiki.povray.org/content/Reference:Function#Functions_and_Macros


Post a reply to this message

From: James Holsenback
Subject: Re: isosurface & function val()
Date: 8 Jul 2014 11:09:08
Message: <53bc0994$1@news.povray.org>
On 07/08/2014 11:00 AM, Thorsten Froehlich wrote:
> "deep125" <dee### [at] yandexru> wrote:
>>> Splines have a function-like interface, so IIRC they are fully supported
>>> in functions.
>>
>> Code:
>> ----------
>>
>> #declare MySpline=spline
>> {
>>      linear_spline
>>      1 , <0,0,0>
>>      2 , <2,2,2>
>>
>> }
>>
>> isosurface {
>>        function{
>>          MySpline(1).x
>>        }
>>      contained_by { box { -2, 2 } }
>>    }
>> -------------------
>>
>> Error
>>
>> Parse Error: Expected 'operand', spline identifier found instead
>>
>> How to attach a spline?
>
> How about reading the documentation?
>
> http://www.povray.org/documentation/view/3.6.1/231/
>
>
>
>
how about pointing user at proper version ...


Post a reply to this message

From: William F Pokorny
Subject: Re: isosurface & function val()
Date: 8 Jul 2014 16:07:34
Message: <53bc4f86$1@news.povray.org>
On 07/08/2014 10:50 AM, deep125 wrote:
>
> How to attach a spline?
>
In this very povray.bugreports newsgroup look for the subject "Probable 
thread safety issue in functions using splines. 3.7.0.RC7", from about a 
year back, for a complete example using a spline in an isosurface.

In your isosurface definition it also looks as if you plan to pass a 
fixed value to your spline function which would cause it to return a 
fixed value to the isosurface. This will leave you with no shape at all 
or a shape defined by the container shape depending upon the returned 
value and the threshold used in your isosurface. In other words, it is 
probably not what you want.

In addition to the built in documentation, I've found Mike William's 
tutorial at : http://www.econym.demon.co.uk/isotut/index.htm helpful.

Bill P.


Post a reply to this message

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