POV-Ray : Newsgroups : povray.unofficial.patches : Idea for functions Server Time
10 Oct 2026 19:30:32 EDT (-0400)
  Idea for functions (Message 1 to 17 of 17)  
From: Warp
Subject: Idea for functions
Date: 5 May 2000 06:53:03
Message: <3912a80f@news.povray.org>
How about adding support for variables, conditionals (if) and loops (while)
to functions (used in isosurfaces, pigments...)?
  This would enhance a lot the possibilities of the functions. It would allow,
for example, making a Mandelbrot pattern function.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: Idea for functions
Date: 5 May 2000 08:26:49
Message: <chrishuff_99-4B3035.07300205052000@news.povray.org>
In article <3912a80f@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

> How about adding support for variables, conditionals (if) and loops 
> (while) to functions (used in isosurfaces, pigments...)?
> This would enhance a lot the possibilities of the functions. It would 
> allow, for example, making a Mandelbrot pattern function.

There is already an if() "statement", it is a function. As I remember, 
the syntax is like this: if(CONDITION, IF_VAL, ELSE_VAL)
Support for variables and other flow control would be very useful, but I 
suspect it would require rewriting a large portion of the function code. 
I don't understand much of it though, I could be wrong.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: pk
Subject: Re: Idea for functions
Date: 5 May 2000 16:48:43
Message: <391333B4.E567C11F@videotron.ca>
Chris Huff wrote:
> 
> In article <3912a80f@news.povray.org>, Warp <war### [at] tagpovrayorg>
> wrote:
> 
> > How about adding support for variables, conditionals (if) and loops
> > (while) to functions (used in isosurfaces, pigments...)?
> > This would enhance a lot the possibilities of the functions. It would
> > allow, for example, making a Mandelbrot pattern function.
> 
> There is already an if() "statement", it is a function. As I remember,
> the syntax is like this: if(CONDITION, IF_VAL, ELSE_VAL)
> Support for variables and other flow control would be very useful, but I
> suspect it would require rewriting a large portion of the function code.
> I don't understand much of it though, I could be wrong.
Oh, well... You could probably do a Basic interpreter(not gwbasic...
QBasic would be good...)... It's got fast results, is turing complete,
not hard to learn, and isn't too hard to interpret, if you drop all
unneeded functions...
Or, you could also allow system calls... (function(system("/[whatever]",
x))

Both would work, but a basic interpreter is completely portable...
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...


Post a reply to this message

From: Chris Huff
Subject: Re: Idea for functions
Date: 5 May 2000 17:03:37
Message: <chrishuff_99-1D34EA.16065105052000@news.povray.org>
In article <391333B4.E567C11F@videotron.ca>, pk <thi### [at] videotronca> 
wrote:

> Oh, well... You could probably do a Basic interpreter(not gwbasic...
> QBasic would be good...)... It's got fast results, is turing complete,
> not hard to learn, and isn't too hard to interpret, if you drop all
> unneeded functions...

I have never seen BASIC referred to as "fast" before...and I fail to see 
the point in supporting a language like BASIC when an extension of the 
existing syntax would be sufficient.


> Or, you could also allow system calls... (function(system("/[whatever]",
> x))

How would that be useful for this application? Or are you talking about 
something similar to the current "DLL" functions?

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: pk
Subject: Re: Idea for functions
Date: 5 May 2000 20:16:37
Message: <3913646F.CAC6BCA2@videotron.ca>
Chris Huff wrote:
> 
> In article <391333B4.E567C11F@videotron.ca>, pk <thi### [at] videotronca>
> wrote:
> 
> > Oh, well... You could probably do a Basic interpreter(not gwbasic...
> > QBasic would be good...)... It's got fast results, is turing complete,
> > not hard to learn, and isn't too hard to interpret, if you drop all
> > unneeded functions...
> 
> I have never seen BASIC referred to as "fast" before...and I fail to see
> the point in supporting a language like BASIC when an extension of the
> existing syntax would be sufficient.
Well, first basic isn't slower than anything else when it's not
compiled, i think... compiled, it can often be faster(see PowerBasic:
dos version comparable to C compilers, windows version usually faster
than MSVC(and BCPP, i think)) 
> > Or, you could also allow system calls... (function(system("/[whatever]",
> > x))
> 
> How would that be useful for this application? Or are you talking about
> something similar to the current "DLL" functions?
Nope, i'm talking about using external apps(.exe in wintel)... instead
of supporting a full blown language for function, just allow the user to
use the (compiled) language s/he wants to use to do the maths!
Instead of having to support everything you want POV's function language
to support, POV could just allow you to call an application, and take
the return value for result!!
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...


Post a reply to this message

From: Chris Huff
Subject: Re: Idea for functions
Date: 6 May 2000 12:08:09
Message: <chrishuff_99-BEA015.11112406052000@news.povray.org>
In article <3913646F.CAC6BCA2@videotron.ca>, pk <thi### [at] videotronca> 
wrote:

> Well, first basic isn't slower than anything else when it's not
> compiled, i think... compiled, it can often be faster(see PowerBasic:
> dos version comparable to C compilers, windows version usually faster
> than MSVC(and BCPP, i think)) 

Still, why support another language when extending the current one would 
work? Compiling it isn't feasible, a different compiler would have to be 
made for each platform, and someone would have to write the interpreter. 
And then people would have to learn another language to use it, instead 
of just learning the differences between it and normal POV syntax.
And BASIC just isn't the best kind of language for this sort of 
thing...I personally would choose a highly simplified C- or Java-like 
syntax.


> Nope, i'm talking about using external apps(.exe in wintel)... instead
> of supporting a full blown language for function, just allow the user to
> use the (compiled) language s/he wants to use to do the maths!
> Instead of having to support everything you want POV's function language
> to support, POV could just allow you to call an application, and take
> the return value for result!!

Well, I don't think there is cross-platform way of doing this. And the 
lack of control over what the external program could do could cause 
problems. And how useful would it really be? I can't think of any cases 
where it would really help...
Also, this sounds a lot like the #system patch...which won't be included 
in the official version or MegaPOV for these reasons.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: pk
Subject: Re: Idea for functions
Date: 6 May 2000 16:35:24
Message: <3914821C.637D1F2E@videotron.ca>
Chris Huff wrote:
> 
> In article <3913646F.CAC6BCA2@videotron.ca>, pk <thi### [at] videotronca>
> wrote:
> > Nope, i'm talking about using external apps(.exe in wintel)... instead
> > of supporting a full blown language for function, just allow the user to
> > use the (compiled) language s/he wants to use to do the maths!
> > Instead of having to support everything you want POV's function language
> > to support, POV could just allow you to call an application, and take
> > the return value for result!!
> 
> Well, I don't think there is cross-platform way of doing this. And the
> lack of control over what the external program could do could cause
> problems. And how useful would it really be? I can't think of any cases
> where it would really help...
> Also, this sounds a lot like the #system patch...which won't be included
> in the official version or MegaPOV for these reasons.
Yup, that's exactly it...
Have i ever said that it would be cross-platform??
Heck, give the code if you want to, but maybe that you just want to do a
one-time time!
Well, it'd as useful as your idea of adding things to the language, one
time or another(we, humans, always want more ;-)
And, you don't have control to what moray plugins do, or over what
pov-ray patch do!
Has this ever stopped people using them?
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Idea for functions
Date: 6 May 2000 18:34:48
Message: <39149e08$1@news.povray.org>
In article <3912a80f@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>   How about adding support for variables, conditionals (if) and loops (while)
> to functions (used in isosurfaces, pigments...)?
>   This would enhance a lot the possibilities of the functions. It would allow,
> for example, making a Mandelbrot pattern function.

This is will surely come in the future, maybe with POV-Ray 4.0 or so.


      Thorsten


Post a reply to this message

From: TonyB
Subject: Re: Idea for functions
Date: 6 May 2000 21:07:05
Message: <3914c1b9@news.povray.org>
<information tidbit absorbed>    :)


Post a reply to this message

From: Warp
Subject: Re: Idea for functions
Date: 8 May 2000 06:47:10
Message: <39169b2e@news.povray.org>
pk <thi### [at] videotronca> wrote:
: Oh, well... You could probably do a Basic interpreter

  Just to add support for loops and variables? I don't think it's necessary,
nor worth the efforts.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Idea for functions
Date: 8 May 2000 09:51:27
Message: <slrn8hdifc.9pe.ron.parker@linux.parkerr.fwi.com>
On Sat, 06 May 2000 11:11:24 -0500, Chris Huff wrote:
>> Nope, i'm talking about using external apps(.exe in wintel)... instead
>> of supporting a full blown language for function, just allow the user to
>> use the (compiled) language s/he wants to use to do the maths!
>> Instead of having to support everything you want POV's function language
>> to support, POV could just allow you to call an application, and take
>> the return value for result!!
>
>Well, I don't think there is cross-platform way of doing this.

IMHO, cross-platform is the least of your worries if you do this.  It'd be
horribly slow to spawn a new process for each evaluation of the function,
and those functions get evaluated many, many, many times for each ray that
hits the object.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
These are my opinions.  I do NOT speak for the POV-Team.


Post a reply to this message

From: pk
Subject: Re: Idea for functions
Date: 9 May 2000 18:59:39
Message: <39189867.694EAC7F@videotron.ca>
Well...
there's at least one working free soft basic interpreter(gwbasic,
though); it's called bywater basic, and it's in C...
SO, you don't need to write one
Warp wrote:
> 
> pk <thi### [at] videotronca> wrote:
> : Oh, well... You could probably do a Basic interpreter
> 
>   Just to add support for loops and variables? I don't think it's necessary,
> nor worth the efforts.
> 
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...


Post a reply to this message

From: Chris Huff
Subject: Re: Idea for functions
Date: 9 May 2000 22:55:19
Message: <chrishuff_99-A80DCC.21583909052000@news.povray.org>
In article <39189867.694EAC7F@videotron.ca>, pk <thi### [at] videotronca> 
wrote:

> Well...
> there's at least one working free soft basic interpreter(gwbasic,
> though); it's called bywater basic, and it's in C...
> SO, you don't need to write one

Actually, it would have to be rewritten. You can't just take code from 
something else and slap it into POV-Ray, even if the code is free, you 
have to make sure it is compatible with the POV license. And even if the 
code was given to the POV-Team, it would still have to be adapted to 
work within POV and a syntax developed for it.
And BASIC isn't the best design choice in my opinion...why add another 
completely different language into the POV syntax? It would mostly 
accomplish adding program bloat, slow the execution of those functions, 
and make it harder to learn. And you couldn't base any of it on current 
work, so it would be harder to write the actual code for it.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: pk
Subject: Re: Idea for functions
Date: 10 May 2000 19:54:10
Message: <3919F6B0.CDCCAAE3@videotron.ca>
Yes, probably...
Chris Huff wrote:
> 
> In article <39189867.694EAC7F@videotron.ca>, pk <thi### [at] videotronca>
> wrote:
> 
> > Well...
> > there's at least one working free soft basic interpreter(gwbasic,
> > though); it's called bywater basic, and it's in C...
> > SO, you don't need to write one
> 
> Actually, it would have to be rewritten. You can't just take code from
> something else and slap it into POV-Ray, even if the code is free, you
> have to make sure it is compatible with the POV license. And even if the
> code was given to the POV-Team, it would still have to be adapted to
> work within POV and a syntax developed for it.
> And BASIC isn't the best design choice in my opinion...why add another
> completely different language into the POV syntax? It would mostly
> accomplish adding program bloat, slow the execution of those functions,
> and make it harder to learn. And you couldn't base any of it on current
> work, so it would be harder to write the actual code for it.
Yeah, i suppose so... but,the function language could become a complete
mess with time, as people add more and more functions to it, if you're
not careful :^)
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...


Post a reply to this message

From: pk
Subject: Re: Idea for functions
Date: 10 May 2000 19:55:53
Message: <3919F717.59DB2A0E@videotron.ca>
Yes, probably...
Chris Huff wrote:
> 
> In article <39189867.694EAC7F@videotron.ca>, pk <thi### [at] videotronca>
> wrote:
> 
> > Well...
> > there's at least one working free soft basic interpreter(gwbasic,
> > though); it's called bywater basic, and it's in C...
> > SO, you don't need to write one
> 
> Actually, it would have to be rewritten. You can't just take code from
> something else and slap it into POV-Ray, even if the code is free, you
> have to make sure it is compatible with the POV license. And even if the
> code was given to the POV-Team, it would still have to be adapted to
> work within POV and a syntax developed for it.
> And BASIC isn't the best design choice in my opinion...why add another
> completely different language into the POV syntax? It would mostly
> accomplish adding program bloat, slow the execution of those functions,
> and make it harder to learn. And you couldn't base any of it on current
> work, so it would be harder to write the actual code for it.
Yeah, i suppose so... but,the function language could become a complete
mess with time, as people add more and more functions to it, if you're
not careful :^)
--
AKA paul_virak_khuong at yahoo.com, pkhuong at deja.com, pkhuong at
crosswinds.net and pkhuong at technologist.com(list not complete)...


Post a reply to this message

From: Warp
Subject: Re: Idea for functions
Date: 11 May 2000 04:35:46
Message: <391a70e2@news.povray.org>
pk <thi### [at] videotronca> wrote:
: Yeah, i suppose so... but,the function language could become a complete
: mess with time, as people add more and more functions to it, if you're
: not careful :^)

  Variable definitions, conditionals and loops should be enough.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: Idea for functions
Date: 11 May 2000 16:21:00
Message: <chrishuff_99-F21C2C.15242211052000@news.povray.org>
In article <3919F6B0.CDCCAAE3@videotron.ca>, pk <thi### [at] videotronca> 
wrote:

> Yeah, i suppose so... but,the function language could become a complete
> mess with time, as people add more and more functions to it, if you're
> not careful :^)

Adding functions won't make it a mess, they would all use the same 
syntax. And for the other "programming" features, only variables, 
if-else, and while are really necessary, although for, do-while, and 
switch-case would be useful. Embedding BASIC into the POV language would 
be much more of a mess, especially if other data types(vector, color) 
are supported and if variables declared outside the function are to be 
used.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

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