POV-Ray : Newsgroups : povray.pov4.discussion.general : Parse Strings : Re: Parse Strings Server Time
9 May 2024 11:59:21 EDT (-0400)
  Re: Parse Strings  
From: Nicolas Alvarez
Date: 25 Oct 2007 14:53:46
Message: <4720e63a@news.povray.org>

> Nicolas Alvarez wrote:
>>
>> Name some. Maybe we don't need an eval()-like function, what we need 
>> is other features so that we never ever need to use eval.
> 
> In my case I was using POV-Ray as a graphing calculator and wanted the 
> resultant image to show both the text and graphic form of the function. 
>   I wanted to only have to enter a function in SDL once, so I used a 
> string, and figured out the include-file-method as a workaround to 
> convert that string to something plot-able.  I asked on the newsgroups 
> if there was a better way... wishing.
> Charles


#declare F = function { x*2 };
#declare Ftext = f.toString(); // <-- that's probably the feature you need

Or a way to convert a string to a function; note that's still not an 
eval(), as it would be limited to only mathematical expressions.


Post a reply to this message

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