Descriptions and Examples for the POV-Ray Raytracer by Friedrich A. Lohmüller
    About Variables in POV-Ray
Deutsch Deutsch

Home
- POV-Ray Tutorial

  - POV-Ray Details

  - About Variables
   > Built-in Identifiers
      #declare, #local
      Expressions

  - A short
    Include File Tutorial

                                       

Built-in Identifiers

In the scenery description language (SDL) of POV-Ray some variables are built-in variables and therefore ready to use - but they cannot be re-declared by #declare or #local.

Built-in Identifier
with fixed values
Built-in Identifier
without fixed values
pi = 3.1415926535897932384626
e*...  = 1*10^... // 3.4e3 = 3400, 2e-4 =0.0002 ;
E*...  = 1*10^... // 3.4E5 = 340000, 2E-6 =0.000002 ;
true = 1
yes = 1
on = 1
false = 0
no = 0
off = 0
u = <1,0>
v = <0,1>
o = <0,0,0>
x = <1,0,0>
y = <0,1,0>
z = <0,0,1>
t = <0,0,0,1>
For use in animation:
clock           // current clock value in animations (0..1)
clock_delta     // clock step between frames
initial_clock   // start clock value (+KIn.n)
final_clock     // end clock value (+KFn.n)
initial_frame   // start frame number (+KFIn.n)
final_frame     // end frame number (+KFFn.n)
frame_number    // current frame number
clock_on        // 1(true) if animation
For use of controlling the aspect ration of the camera:
image_width     // width of current render
image_height    // height of current render
For compatibility of POV-Ray version:
version         // version (default value is 3.6, or 3.7
                // depending of the POV-Ray version you use.
                // Can be changed with #version)

To avoid any collision with built-in identifiers and reserved words in POV-Ray,
it's strongly recommanded to use only words beginning with capital letters
for all identifiers of variables declared by the user.

In future versions there meight be more small letters in the above list. For this reason and for clearness of the meanings in a scene file the above advise should be followed.

Examples:

bad / to avoid okay why
#declare x = 2.5;
#declare X = = 2.5;

Small 'x' is predeclared as <1,0,0> !
#declare v = <1.5,2,0>;
#declare V = <1.5,2,0>; 

Small 'v' is predeclared as <0,1> !
#local x = 0;     // start
#local End = 10;  // end
#while ( x < End )
 sphere{ <0,0,0>,0.5
         pigment{ rgb<1,0,0> }
         translate<x*1.5,0,0>
       }
 #local x = x + 1;  // next
 #end // ------ end of loop
#local I = 0;       // start
#local End_I = 10;  // end
#while ( I < End_I )
 sphere{ <0,0,0>,0.5
         pigment{ rgb<1,0,0> }
         translate< I*1.5,0,0>
       }
#local I = I + 1;  // next I
#end // ------ end of loop

Small 'x' is predeclared as <1,0,0> !
Use something like 'X, 'I', 'J', 'Ctr', 'Counter', ... !
#local i = 0;     // start
#local End = 10;  // end
#while (i < End )
 sphere{ <0,0,0>,0.5
         pigment{ rgb<1,0,0> }
         translate<i*1.5,0,0>
       }
 #local i = i + 1;  // next
 #end // ------ end of loop
#local I = 0;       // start
#local End_I = 10;  // end
#while ( I < End_I )
 sphere{ <0,0,0>,0.5
         pigment{ rgb<1,0,0> }
         translate< I*1.5,0,0>
       }
#local I = I + 1; // next I
#end // ------ end of loop
Small 'i' is no real 'Parse Error'!
It's just an inconsequent use of a small letter, that should be avoided, if we want to be on the save side. Because doing so, promotes the loosing of attention on how users variables should be declared.

top
© Friedrich A. Lohmüller, 2015
www.f-lohmueller.de
 
Visitors:
(since May-1999)
Thanks for your visit!