POV-Ray : Newsgroups : povray.programming : Persistent Variables : Re: Persistent Variables Server Time
28 Jul 2024 18:20:29 EDT (-0400)
  Re: Persistent Variables  
From: Chris Huff
Date: 23 Nov 1999 07:39:52
Message: <231119990742578054%chrishuff_99@yahoo.com>
In article <383A2DCD.648D3DD9@wantree.com.au>, mnewton
<mne### [at] wantreecomau> wrote:

I think maybe a better solution would be to make variables have more
distinct types, like vector, float, etc. You could then add persistant,
constant, etc.
#declare varA = persistant const vector < 0, 1, 3>;

#redefine varA = vector varA;

#declare varB = varA.x;

Maybe the type modifiers should be enclosed in [],(), or something to
separate them from the rest of the declaration, but I don't think that
would be necessary. The parser would attempt to automatically determine
the types, but they should be used for clarity.
This has the advantage that it uses fewer keywords, and makes it
clearer what the code does.


Another possible syntax, which fits in with object {}, texture {}, etc.
being their own type:
#declare varA = vector {< 0, 1, 3> persistant on const on};

#redeclare varA = vector {varA persistant off const off};

#declare varB = float {varA.x};
The persistant and const flags would default to off, and just the
keywords would turn them on.

Also, I think all variable declarations should end in a semicolon, this
makes things like layered texture declarations more obvious and is more
consistant. Also, you could have something like:
#declare MySpheres =
sphere {blahblah}
sphere {blahblah}
sphere {blahblah};

be interpreted as:
#declare MySpheres =
union {
    sphere {blahblah}
    sphere {blahblah}
    sphere {blahblah};
};


Also, I think the #local keyword is explained a bit ambiguously, is a
local variable local to the #keyword...#end block containing it, or
only to the containing file or #macro? The latter should be the case,
because this wouldn't work otherwise:
#local k=0;
#while(k<10)
    #local k=k+1;//if this is local to the loop, it won't affect the
counter.
#end

> PS Love that isosurface. Can it be over a larger area rather than unit cube?

The isosurface can be bounded by whatever shape you want, although I
have never tried an infinite object like a plane. Those may not work
correctly, I don't know.

-- 
Chris Huff
e-mail: chr### [at] yahoocom
Web page: http://chrishuff.dhs.org/


Post a reply to this message

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