Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 538736dd48b90317ef5f42ffe7f54572 > files > 509

povray-3.7.0.8-3.mga7.armv7hl.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--  This file copyright Persistence of Vision Raytracer Pty. Ltd. 2009-2011  -->

<html lang="en">
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<title>Reference Section 3</title>
<link rel="StyleSheet" href="povray37.css" type="text/css">
<link rel="shortcut icon" href="favicon.ico">

<!--  NOTE: In order to help users find information about POV-Ray using web      -->
<!--  search engines, we ask that you *not* let them index documentation         -->
<!--  mirrors because effectively, when searching, users will get hundreds of    -->
<!--  results containing the same information! For this reason, these meta tags  -->
<!--  below disable archiving of this page by search engines.                    -->

<meta name="robots" content="noarchive">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="0">
</head>
<body>

<div class="Page">

<!-- NavPanel Begin -->
<div class="NavPanel">
<table class="NavTable">
<tr>
  <td class="FixedPanelHeading"><a title="3.3" href="#r3_3">Scene Description Language</a></td>
</tr>
<tr>
  <td><div class="divh2"><strong><a title="3.3.1" href="#r3_3_1">Language Basics</a></strong></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.1" href="#r3_3_1_1">Notation and Basic Assumptions</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.2" href="#r3_3_1_2">Keywords</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.3" href="#r3_3_1_3">Identifiers</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.4" href="#r3_3_1_4">Comments</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.5" href="#r3_3_1_5">Numeric Expressions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.5.1" href="#r3_3_1_5_1">Literals</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.5.2" href="#r3_3_1_5_2">Identifiers</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.5.3" href="#r3_3_1_5_3">Operators</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.5.4" href="#r3_3_1_5_4">Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.5.5" href="#r3_3_1_5_5">Built-in Constants</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.5.6" href="#r3_3_1_5_6">Built-in Variables</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.6" href="#r3_3_1_6">Vector Expressions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.6.1" href="#r3_3_1_6_1">Literals</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.6.2" href="#r3_3_1_6_2">Identifiers</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.6.3" href="#r3_3_1_6_3">Operators</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.6.4" href="#r3_3_1_6_4">Operator Promotion</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.6.5" href="#r3_3_1_6_5">Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.6.6" href="#r3_3_1_6_6">Built-in Constants</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.7" href="#r3_3_1_7">Color Expressions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.7.1" href="#r3_3_1_7_1">Color Vectors</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.7.2" href="#r3_3_1_7_2">sRGB Colors</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.7.3" href="#r3_3_1_7_3">Color Keywords</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.7.4" href="#r3_3_1_7_4">Color Identifiers</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.7.5" href="#r3_3_1_7_5">Color Operators</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.7.6" href="#r3_3_1_7_6">Common Color Pitfalls</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.8" href="#r3_3_1_8">Function</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.8.1" href="#r3_3_1_8_1">Sum and Product functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.8.2" href="#r3_3_1_8_2">Functions and Macros</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.8.3" href="#r3_3_1_8_3">Declaring User-Defined Float Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.8.4" href="#r3_3_1_8_4">Declaring User-Defined Vector Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.8.5" href="#r3_3_1_8_5">Declaring User-Defined Color Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.8.6" href="#r3_3_1_8_6">Internal Pre-Defined Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.9" href="#r3_3_1_9">Strings</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.9.1" href="#r3_3_1_9_1">String Literals</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.9.2" href="#r3_3_1_9_2">String Identifiers</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.9.3" href="#r3_3_1_9_3">String Relational Operators</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.9.4" href="#r3_3_1_9_4">String Functions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.9.5" href="#r3_3_1_9_5">Built-in Variables</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.10" href="#r3_3_1_10">Array</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.10.1" href="#r3_3_1_10_1">Declaring Arrays</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.10.2" href="#r3_3_1_10_2">Array Initializers</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.11" href="#r3_3_1_11">Spline</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.11.1" href="#r3_3_1_11_1">Splines and Macros</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.1.12" href="#r3_3_1_12">Transformations</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.12.1" href="#r3_3_1_12_1">Translate</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.12.2" href="#r3_3_1_12_2">Scale</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.12.3" href="#r3_3_1_12_3">Rotate</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.1.12.4" href="#r3_3_1_12_4">Matrix</a></div></td>
</tr>
<tr>
  <td><div class="divh2"><strong><a title="3.3.2" href="#r3_3_2">Language Directives</a></strong></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.1" href="#r3_3_2_1">Include Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.2" href="#r3_3_2_2">Declare and Local Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.2.1" href="#r3_3_2_2_1">Declaring identifiers</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.2.2" href="#r3_3_2_2_2">declare vs. local</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.2.3" href="#r3_3_2_2_3">Identifier Name Collisions</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.2.4" href="#r3_3_2_2_4">Destroying Identifiers with undef</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.2.5" href="#r3_3_2_2_5">Deprecation Support</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.3" href="#r3_3_2_3">File I/O Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.3.1" href="#r3_3_2_3_1">The fopen Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.3.2" href="#r3_3_2_3_2">The fclose Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.3.3" href="#r3_3_2_3_3">The read Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.3.4" href="#r3_3_2_3_4">The write Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.4" href="#r3_3_2_4">Default Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.5" href="#r3_3_2_5">Version Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.6" href="#r3_3_2_6">Conditional Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.6.1" href="#r3_3_2_6_1">The if...else...end Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.6.2" href="#r3_3_2_6_2">The ifdef and ifndef Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.6.3" href="#r3_3_2_6_3">The for Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.6.4" href="#r3_3_2_6_4">The switch, case, range and break Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.6.5" href="#r3_3_2_6_5">The while...end Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.7" href="#r3_3_2_7">User Message Directives</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.7.1" href="#r3_3_2_7_1">Text Message Streams</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.7.2" href="#r3_3_2_7_2">Text Formatting</a></div></td>
</tr>
<tr>
  <td><div class="divh3"><a title="3.3.2.8" href="#r3_3_2_8">User Defined Macros</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.8.1" href="#r3_3_2_8_1">The macro Directive</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.8.2" href="#r3_3_2_8_2">Invoking Macros</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.8.3" href="#r3_3_2_8_3">Are POV-Ray Macros a Function or a Macro?</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.8.4" href="#r3_3_2_8_4">Returning a Value Like a Function</a></div></td>
</tr>
<tr>
  <td><div class="divh4"><a title="3.3.2.8.5" href="#r3_3_2_8_5">Returning Values Via Parameters</a></div></td>
</tr>
<tr>
  <td><div class="divh1">&nbsp;</div></td>
</tr>
<tr>
  <td><div class="divh1">&nbsp;</div></td>
</tr>
</table>
</div>
<!-- NavPanel End -->

<div class="Content">
<table class="HeaderFooter" width="100%">
<tr>
  <td colspan=5 align="left" class="HeaderFooter">
    POV-Ray for Unix <strong class="HeaderFooter">version 3.7</strong>
  </td>
</tr>
<tr >
  <td colspan=5>
    <hr align="right" width="70%">
  </td>
</tr>
<tr>
  <td width="30%"></td>
  <td class="NavBar"><a href="index.html" title="The Front Door">Home</a></td>
  <td class="NavBar"><a href="u1_0.html" title="Unix Table of Contents">POV-Ray for Unix</a></td>
  <td class="NavBar"><a href="t2_0.html" title="Tutorial Table of Contents">POV-Ray Tutorial</a></td>
  <td class="NavBar"><a href="r3_0.html" title="Reference Table of Contents">POV-Ray Reference</a></td>
</tr>
</table>

<a name="r3_3"></a>
<div class="content-level-h2" contains="Scene Description Language" id="r3_3">
<h2>3.3 Scene Description Language</h2>
<p>This section describes the POV-Ray <em>scene description
language</em>. It is supposed to be used as a reference for looking up
things. It does not contain detailed explanations on how scenes are written
or how POV-Ray is used. It just explains all features, their syntax,
applications, limits, drawbacks, etc.</p>
<p>
The scene description language allows you to describe the world in a
readable and convenient way. Files are created in plain ASCII text using an
editor of your choice. The input file name is specified using the <code>
Input_File_Name</code>=<em>file</em> option or <code>+I</code><em>file</em>
switch. By default the files have the extension <code>.pov</code>. POV-Ray
reads the file, processes it by creating an internal model of the scene and
then renders the scene.</p>
<p>
The overall syntax of a scene is shown below. See <a href="r3_3.html#r3_3_1_1">Notation and Basic Assumptions</a>
for more information on syntax notation.</p>
<pre>
SCENE:
  SCENE_ITEM...
SCENE_ITEM:
  LANGUAGE_DIRECTIVE |
  CAMERA             |
  LIGHT              |
  OBJECT             |
  ATMOSPHERIC_EFFECT |
  GLOBAL_SETTINGS
</pre>

<p>In plain English, this means that a scene contains one or more scene items
and that a scene item may be any of the five items listed below it. The items
may appear in any order. None is a required item. In addition to the syntax
depicted above, a <em>LANGUAGE_DIRECTIVE</em> may also appear anywhere
embedded in other statements between any two tokens. There are some
restrictions on nesting directives also.</p>
<p>
For details on those five items see section <a href="r3_3.html#r3_3_2">Language Directives</a>, section <a href="r3_4.html#r3_4_5">Objects</a>, section <a href="r3_4.html#r3_4_2">Camera</a>, section <a href="r3_4.html#r3_4_3">Atomospheric Effects</a> and section <a href="r3_4.html#r3_4_1">Global Settings</a> for details.</p></div>

<a name="r3_3_1"></a>
<div class="content-level-h3" contains="Language Basics" id="r3_3_1">
<h3>3.3.1 Language Basics</h3>
<p>The POV-Ray language consists of identifiers, reserved keywords, floating point expressions, strings, special symbols and comments. The text of a POV-Ray scene file is free format. You may put statements on separate lines or on the same line as you desire. You may add blank lines, spaces or indentations as long as you do not split any keywords or identifiers.</p>
<p>See the following for more details:</p>

<ol>
  <li><a href="r3_3.html#r3_3_1_2">Keywords</a></li>
  <li><a href="r3_3.html#r3_3_1_3">Identifiers</a></li>
  <li><a href="r3_3.html#r3_3_1_4">Comments</a></li>
  <li><a href="r3_3.html#r3_3_1_5">Numeric Expressions</a></li>
  <li><a href="r3_3.html#r3_3_1_6">Vector Expressions</a></li>
  <li><a href="r3_3.html#r3_3_1_7">Color Expressions</a></li>
  <li><a href="r3_3.html#r3_3_1_8">User-Defined Functions</a></li>
  <li><a href="r3_3.html#r3_3_1_9">Strings</a></li>
  <li><a href="r3_3.html#r3_3_1_10">Arrays</a></li>
  <li><a href="r3_3.html#r3_3_1_11">Splines</a></li>
</ol></div>

<a name="r3_3_1_1"></a>
<div class="content-level-h4" contains="Notation and Basic Assumptions" id="r3_3_1_1">
<h4>3.3.1.1 Notation and Basic Assumptions</h4>
<p>Throughout the tutorial and reference books, a consistent notation is used to mark keywords of the scene description language, command line switches, INI file keywords and file names.</p>
<p><strong>For example:</strong></p>
<p>Scene description language keywords and command-line switches:</p>
<ul class="index">
  <li><code>sphere</code>, <code>4.0 * sin(45.0)</code></li>
  <li><code>+W640 +H480</code></li>
</ul>

<p>Syntax, optional syntax, multiple syntax, and zero or more syntax items allowed respectively:</p>
<ul class="index">
  <li><code>SYNTAX_ITEM</code></li>
  <li><code>[SYNTAX_ITEM]</code></li>
  <li><code>SYNTAX_ITEM...</code></li>
  <li><code>[SYNTAX_ITEM...]</code></li>
</ul>

<p>A float value or expression, and a vector value or expression:</p>
<ul class="index">
  <li><code>Value_1</code></li>
  <li><code>&lt;Value_1&gt;</code></li>
</ul>

<p>Alternatives are represented by a vertical bar between syntax items; exactly one of the listed items must be present:</p>
<ul class="index">
  <li><code>ITEM1 | ITEM2 | ITEM3</code></li>
</ul>

<p>Arbitrary order is represented by an ampersand between syntax items:</p>
<ul class="index">
  <li><code>ITEM1 & ITEM2 & ITEM3</code></li>
</ul>

<p>Fixed order is represented by simple juxtaposition of syntax items:</p>
<ul class="index">
  <li><code>ITEM1 ITEM2 ITEM3</code></li>
</ul>

<p>The above notations can also appear in various combinations; parentheses are used to resolve ambiguities. For instance, the following notation would indicate that the optional items ITEM1 and ITEM2, as well as either ITEM3A or ITEM3B, may appear in any order:</p>
<ul class="index">
  <li><code>[ITEM1] & [ITEM2] & (ITEM3A | ITEM3B)</code></li>
</ul>

<p class="Note"><strong>Note:</strong> The ampersand notation to denote arbitrary order is just being phased in; some syntax descriptions may still use juxtaposition, regardless of whether the order of items is irrelevant or not; please be aware that those are (or at least should be) exceptions.</p>

<p>Certain lists and arrays also require square braces as part of the language rather than the language description:</p>
<ul class="index">
  <li><code>[ ITEM ]</code></li>
</ul>

<p class="Note"><strong>Note:</strong> POV-Ray is a command-line program on Unix and other text-based operating systems and is menu-driven on Windows and Macintosh platforms. Some of these operating systems use folders to store files while others use directories. Some separate the folders and sub-folders with a slash character (<code>/</code>), back-slash character (<code>\</code>), or others. </p>
<p>We have tried to make this documentation as generic as possible but sometimes we have to refer to folders, files, options etc. and there is noway to escape it. Here are some assumptions we make...</p><ol><li> You installed POV-Ray in the <code>C:\POVRAY36</code> directory. For MS-Dos this is probably true but for Unix it might be <code>/usr/povray3</code>, or for Windows it might be<code> C:\Program Files\POV-Ray for Windows v3.6</code>, for Mac it might be <code>MyHD:Apps:POV-Ray 36:</code>, or you may have used some other drive or directory. So if we tell you that Include files are stored in the <code>\povray36\include</code> directory, we assume you can translate that to something like<code>::POVRAY36:INCLUDE</code> or <code>C:\Program Files\POV-Ray for Windows v3.6\include</code> or whatever is appropriate for your platform, operating system and installation.<li> POV-Ray uses INI files and/or command-line switches (if available) to choose options in all versions, but Windows and Mac also use dialog boxes or menu choices to set options. We will describe options assuming you are using switches or INI files when describing what the options do. We have taken care to use the same terminology in designing menus and dialogs as we use in describing switches or INI keywords. See your version-specific documentation on menu and dialogs.<li> Some of you are reading this using a help-reader, built-in help,web-browser, formatted printout, or plain text file. We assume you know how to get around in which ever medium you are using. We will say See the chapter on <a href="t2_2.html#t2_2_8">Setting POV-Ray Options</a> we assume you can click, scroll, browse, flip pages or whatever to get there.</ol></div>

<a name="r3_3_1_2"></a>
<div class="content-level-h4" contains="Keywords" id="r3_3_1_2">
<h4>3.3.1.2 Keywords</h4>
<p>POV-Ray has a number of reserved keywords which are listed below.</p>
<table class="tablelist">
<tr>
<th colspan="3" align="left">a</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_8_3">aa_level</a></code><br>
<code><a href="r3_4.html#r3_4_8_3">aa_threshold</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">abs</a></code><br>
<code><a href="r3_4.html#r3_4_8_2_1">absorption</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">accuracy</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">acos</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">acosh</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_5">adaptive</a></code><br>
<code><a href="r3_4.html#r3_4_1_1">adc_bailout</a></code> <em>global setting</em><br>
<code><a href="r3_4.html#r3_4_4_3_3_1">adc_bailout</a></code> <em>radiosity</em><br>
<code><a href="r3_4.html#r3_4_7_1_1">agate</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_1">agate_turb</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_3_1">albedo</a></code> <em>diffuse</em><br>
<code><a href="r3_4.html#r3_4_6_3_4_1">albedo</a></code> <em>phong</em><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_6_3_4_2">albedo</a></code> <em>specular</em><br>
<code><a href="r3_4.html#r3_4_7_6_3">all</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">all_intersections</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_3">alpha</a></code><br>
<code><a href="r3_4.html#r3_4_7_3_2">altitude</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_2">always_sample</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_1">ambient</a></code><br>
<code><a href="r3_4.html#r3_4_1_2">ambient_light</a></code><br>
<code><a href="r3_4.html#r3_4_2_1">angle</a></code><br>
<code><a href="r3_4.html#r3_4_7_3_1">aoi</a></code><br>
<code><a href="r3_4.html#r3_4_2_3">aperture</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_1">append</a></code><br>
<code><a href="r3_4.html#r3_4_3_5">arc_angle</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_5">area_illumination</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_4_1_5">area_light</a></code><br>
<code><a href="r3_3.html#r3_3_1_10">array</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">asc</a></code><br>
<code><a href="r3_4.html#r3_4_1_6">ascii</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">asin</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">asinh</a></code><br>
<code><a href="r3_4.html#r3_4_1_3">assumed_gamma</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">atan</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">atan2</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">atand</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">atanh</a></code><br>
<code><a href="r3_4.html#r3_4_4_4_9_1">autostop</a></code><br>
<code><a href="r3_4.html#r3_4_7_4_1">average</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">b</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_13">b_spline</a></code><br>
<code><a href="r3_4.html#r3_4_3_2">background</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_8">bezier_spline</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_1">bicubic_patch</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">bitwise_and</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">bitwise_or</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">bitwise_xor</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_1">black_hole</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_1">blob</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_3">blue</a></code><br>
<code><a href="r3_4.html#r3_4_2_3">blur_samples</a></code><br>
<code><a href="r3_4.html#r3_4_2_3">bokeh</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_2">bounded_by</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_2">box</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_2">boxed</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_3">bozo</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_2_6_4">break</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_4">brick</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_4">brick_size</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_3">brightness</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_3_2">brilliance</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_3">bump_map</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_3_2">bump_size</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_5">bumps</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">c</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_2">camera</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_4">case</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_7">caustics</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">ceil</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_1">cells</a></code><br>
<code><a href="r3_4.html#r3_4_1_6">charset</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_2">checker</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">chr</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_5">circular</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_1">clipped_by</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">clock</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">clock_delta</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">clock_on</a></code><br>
<code><a href="r3_4.html#r3_4_4_4_4">collect</a></code><br>
<code><a href="r3_3.html#r3_3_1_7">color</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_6_1_2">color_map</a></code><br>
<code><a href="r3_3.html#r3_3_1_7">colour</a></code><br>
<code><a href="r3_4.html#r3_4_6_1_2">colour_map</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_1">component</a></code><br>
<code><a href="r3_4.html#r3_4_5_4_2">composite</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">concat</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_3">cone</a></code><br>
<code><a href="r3_4.html#r3_4_2_3">confidence</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_11">conic_sweep</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_6">conserve_energy</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">contained_by</a></code><br>
<code><a href="r3_4.html#r3_4_7_5">control0</a></code><br>
<code><a href="r3_4.html#r3_4_7_5">control1</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_10">coords</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">cos</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_5_4">cosh</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_4">count</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_3">crackle</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_3_3">crand</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">cube</a></code><br>
<code><a href="r3_4.html#r3_4_5_3_3">cubic</a></code> <em>object</em><br>
<code><a href="r3_4.html#r3_4_7_1_6">cubic</a></code> <em>pattern</em><br>
<code><a href="r3_4.html#r3_4_7_5_5_7">cubic</a></code> <em>warp</em><br>
<code><a href="r3_4.html#r3_4_5_1_8">cubic_spline</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_3">cubic_wave</a></code><br>
<code><a href="r3_4.html#r3_4_6_10">cutaway_textures</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_4">cylinder</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_7">cylindrical</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">d</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_9_4">datetime</a></code><br>
<code><a href="r3_3.html#r3_3_2_7">debug</a></code><br>
<code><a href="r3_3.html#r3_3_2_2_1">declare</a></code><br>
<code><a href="r3_3.html#r3_3_2_4">default</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">defined</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">degrees</a></code><br>
<code><a href="r3_4.html#r3_4_8_4">density</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_8">density_file</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_8_4_3">density_map</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_9">dents</a></code><br>
<code><a href="r3_3.html#r3_3_2_2_5">deprecated</a></code> <br>
<code><a href="r3_4.html#r3_4_7_1_8">df3</a></code><br>
<code><a href="r3_4.html#r3_4_5_4_4">difference</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_3">diffuse</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">dimension_size</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">dimensions</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_2_1_4">direction</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_2">disc</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_5">dispersion</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_5">dispersion_samples</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_7">dist_exp</a></code><br>
<code><a href="r3_4.html#r3_4_3_3">distance</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">div</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_9">double_illuminate</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">e</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_8_2_3">eccentricity</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_1">else</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_1">elseif</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_2">emission</a></code> <em>finish</em><br>
<code><a href="r3_4.html#r3_4_8_2_2">emission</a></code> <em>media</em><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_2_6_1">end</a></code><br>
<code><a href="r3_3.html#r3_3_2_7">error</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_5">error_bound</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">evaluate</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">exp</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_4_4_9_2">expand_thresholds</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_5">exponent</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_11">exterior</a></code><br>
<code><a href="r3_4.html#r3_4_8_2_3">extinction</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">f</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_5_2_4">face_indices</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_10">facets</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_6">fade_color</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_6">fade_colour</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_9">fade_distance</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_9">fade_power</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_2">falloff</a></code><br>
<code><a href="r3_4.html#r3_4_3_5">falloff_angle</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_5">false</a></code><br>
<code><a href="r3_3.html#r3_3_2_3">fclose</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">file_exists</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_7_3">filter</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">final_clock</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">final_frame</a></code><br>
<code><a href="r3_4.html#r3_4_6_3">finish</a></code><br>
<code><a href="r3_4.html#r3_4_2_2_4">fisheye</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_1">flatness</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_2">flip</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">floor</a></code><br>
<code><a href="r3_4.html#r3_4_2_3">focal_point</a></code><br>
<code><a href="r3_4.html#r3_4_3_3">fog</a></code><br>
<code><a href="r3_4.html#r3_4_3_3">fog_alt</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_3_3">fog_offset</a></code><br>
<code><a href="r3_4.html#r3_4_3_3">fog_type</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_1">fopen</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_3">for</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_3">form</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">frame_number</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_2">frequency</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_5">fresnel</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">function</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">g</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_6_2_3">gamma</a></code>  <em>bump maps</em><br>
<code><a href="r3_4.html#r3_4_5_1_5">gamma</a></code>  <em>heightfield</em><br>
<code><a href="r3_4.html#r3_4_7_6_2">gamma</a></code>  <em>image map</em><br>
<code><a href="r3_4.html#r3_4_7_4_2">gamma</a></code>  <em>image pattern</em><br>
<code><a href="r3_4.html#r3_4_4_4_3">gather</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_6_1">gif</a></code><br>
<code><a href="r3_4.html#r3_4_4_2">global_lights</a></code><br>
<code><a href="r3_4.html#r3_4_1">global_settings</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_13">gradient</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_14">granite</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_7_5">gray</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_6">gray_threshold</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_3">green</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">h</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_5">height_field</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_4">hexagon</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_1_4">hf_gray_16</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_1">hierarchy</a></code><br>

</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_7">hypercomplex</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_4">hollow</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">i</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_2_6_1">if</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_2">ifdef</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">iff</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_2">ifndef</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">image_height</a></code><br>
<code><a href="r3_4.html#r3_4_7_6">image_map</a></code><br>
<code><a href="r3_4.html#r3_4_7_4_2">image_pattern</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">image_width</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_4_1">importance</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_2_1">include</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">initial_clock</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">initial_frame</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">input_file_name</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">inside</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_3_1">inside_vector</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">int</a></code><br>
<code><a href="r3_4.html#r3_4_8_1">interior</a></code><br>
<code><a href="r3_4.html#r3_4_6_9">interior_texture</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_9_1_7_9">internal</a></code><br>
<code><a href="r3_4.html#r3_4_7_7_3">interpolate</a></code><br>
<code><a href="r3_4.html#r3_4_5_4_3">intersection</a></code><br>
<code><a href="r3_4.html#r3_4_8_3">intervals</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_5">inverse</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_4">ior</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_7">irid</a></code><br>
<code><a href="r3_4.html#r3_4_1_5">irid_wavelength</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">isosurface</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">j</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_4_1_5">jitter</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">jpeg</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_1_11">julia</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">julia_fractal</a></code><br>
</td>
<td width="33%">
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">l</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_7_5_5_5">lambda</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_8">lathe</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_15">leopard</a></code><br>
<code><a href="r3_4.html#r3_4_4_2">light_group</a></code><br>
<code><a href="r3_4.html#r3_4_4_1">light_source</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_8">linear_spline</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_11">linear_sweep</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">ln</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_4_5">load_file</a></code><br>
<code><a href="r3_3.html#r3_3_2_2">local</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_2_1_1">location</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">log</a></code><br>
<code><a href="r3_4.html#r3_4_2_1_1">look_at</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_7">looks_like</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_7">low_error_factor</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">m</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_2_8_1">macro</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_11">magnet</a></code><br>
<code><a href="r3_4.html#r3_4_7_5">major_radius</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_11">mandel</a></code><br>
<code><a href="r3_4.html#r3_4_7_7_2">map_type</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_16">marble</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_3">material</a></code><br>
<code><a href="r3_4.html#r3_4_6_5_3">material_map</a></code><br>
<code><a href="r3_3.html#r3_3_1_12_4">matrix</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">max</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_9">maximum_reuse</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_5">max_extent</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">max_gradient</a></code><br>
<code><a href="r3_4.html#r3_4_1_8">max_intersections</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">max_iteration</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_8">max_sample</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_6">max_trace</a></code><br>
<code><a href="r3_4.html#r3_4_1_7">max_trace_level</a></code><br>
<code><a href="r3_4.html#r3_4_8">media</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_11">media_attenuation</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_10">media_interaction</a></code><br>
<code><a href="r3_4.html#r3_4_5_4_5">merge</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_2_3">mesh</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_4">mesh2</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_4_3">metallic</a></code><br>
<code><a href="r3_4.html#r3_4_8_3">method</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_3">metric</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">min</a></code><br>
<code><a href="r3_3.html#r3_3_1_6_5">min_extent</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_10">minimum_reuse</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_3_4">mm_per_unit</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">mod</a></code><br>
<code><a href="r3_4.html#r3_4_7_5">mortar</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">n</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_11">natural_spline</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_11">nearest_count</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_5">no</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_4">no_bump_scale</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_7">no_image</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_5_10">no_radiosity</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_8">no_reflection</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_6">no_shadow</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_4">noise_generator</a></code><br>
<code><a href="r3_4.html#r3_4_6_2">normal</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_2_4">normal_indices</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_1">normal_map</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_4">normal_vectors</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">now</a></code><br>
<code><a href="r3_4.html#r3_4_1_10">number_of_waves</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">o</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_5">object</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_4">octaves</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_5">off</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_2">offset</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_6">omega</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_2_2_6">omnimax</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_5">on</a></code><br>
<code><a href="r3_4.html#r3_4_7_7_1">once</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_17">onion</a></code><br>
<code><a href="r3_4.html#r3_4_8_1">open</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_4_1_5">orient</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_7">orientation</a></code><br>
<code><a href="r3_4.html#r3_4_2_2_2">orthographic</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_9">ovus</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">p</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_2_2_7">panoramic</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_4">parallel</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_10">parametric</a></code><br>
<code><a href="r3_4.html#r3_4_4_4_4">pass_through</a></code><br>
<code><a href="r3_4.html#r3_4_7">pattern</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_18">pavement</a></code><br>
<code><a href="r3_4.html#r3_4_2_2_1">perspective</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">pgm</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_2">phase</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_4_1">phong</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_4_1">phong_size</a></code><br>
<code><a href="r3_4.html#r3_4_4_4">photons</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_5_5">pi</a></code><br>
<code><a href="r3_4.html#r3_4_6_1">pigment</a></code><br>
<code><a href="r3_4.html#r3_4_6_1_3">pigment_map</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_19">pigment_pattern</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_20">planar</a></code><br>
<code><a href="r3_4.html#r3_4_5_3_1">plane</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">png</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_2">point_at</a></code><br>
<code><a href="r3_4.html#r3_4_5_3_2">poly</a></code><br>
<code><a href="r3_4.html#r3_4_5_3_5">polynomial</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_3">poly_wave</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_5">polygon</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_5">pot</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">pow</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">ppm</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">precision</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_10">precompute</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_4">premultiplied</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_12">pretrace_end</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_12">pretrace_start</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_11">prism</a></code><br>
<code><a href="r3_3.html#r3_3_1_8_1">prod</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_8">projected_through</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">pwr</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">q</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_8">quadratic_spline</a></code><br>
<code><a href="r3_4.html#r3_4_5_3_6">quadric</a></code><br>
<code><a href="r3_4.html#r3_4_5_3_4">quartic</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_7">quaternion</a></code><br>
<code><a href="r3_4.html#r3_4_6_1_5">quick_color</a></code><br>
<code><a href="r3_4.html#r3_4_6_1_5">quick_colour</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_1_21">quilted</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">r</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_7_1_22">radial</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">radians</a></code><br>
<code><a href="r3_4.html#r3_4_4_3">radiosity</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_2">radius</a></code><br>
<code><a href="r3_4.html#r3_4_3_5">rainbow</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_3">ramp_wave</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">rand</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_4">range</a></code><br>
<code><a href="r3_4.html#r3_4_8_3">ratio</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_2_3">read</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">reciprocal</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_3_13">recursion_limit</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_3">red</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_5">reflection</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_5">reflection_exponent</a></code><br>
<code><a href="r3_4.html#r3_4_8_1_4">refraction</a></code><br>
<code><a href="r3_3.html#r3_3_2_7_1">render</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_2">repeat</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_7_1">rgb</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_1">rgbf</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_1">rgbft</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_1">rgbt</a></code><br>
<code><a href="r3_4.html#r3_4_2_1_5">right</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_23">ripples</a></code><br>
<code><a href="r3_3.html#r3_3_1_12_3">rotate</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_4_2">roughness</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">s</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_4.html#r3_4_8_3">samples</a></code><br>
<code><a href="r3_4.html#r3_4_4_3_4_5">save_file</a></code><br>
<code><a href="r3_3.html#r3_3_1_12_2">scale</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_3">scallop_wave</a></code><br>
<code><a href="r3_4.html#r3_4_8_2_3">scattering</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">seed</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">select</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_6">shadowless</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">sin</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_3">sine_wave</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">sinh</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">sint8</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">sint16be</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">sint16le</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">sint32be</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">sint32le</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_10">size</a></code><br>
<code><a href="r3_4.html#r3_4_2_1_2">sky</a></code><br>
<code><a href="r3_4.html#r3_4_3_4">sky_sphere</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">slice</a></code><br>
<code><a href="r3_4.html#r3_4_7_3_2">slope</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_2">slope_map</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_5_1_5">smooth</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_7">smooth_triangle</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_3">solid</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_15">sor</a></code><br>
<code><a href="r3_4.html#r3_4_4_4_3">spacing</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_4_2">specular</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_12">sphere</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_13">sphere_sweep</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_24">spherical</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_25">spiral1</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_26">spiral2</a></code><br>
<code><a href="r3_3.html#r3_3_1_11">spline</a></code><br>
<code><a href="r3_4.html#r3_4_5_4_2_1">split_union</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_2">spotlight</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_27">spotted</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_7">sqr</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">sqrt</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_6">square</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_3">srgb</a></code> <em>bump maps</em><br>
<code><a href="r3_3.html#r3_3_1_7_2">srgb</a></code> <em>color literals</em><br>
<code><a href="r3_4.html#r3_4_5_1_5">srgb</a></code> <em>heightfield</em><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_6_2">srgb</a></code> <em>image maps</em><br>
<code><a href="r3_4.html#r3_4_7_4_2">srgb</a></code> <em>image pattern</em><br>
<code><a href="r3_3.html#r3_3_1_7_2">srgbf</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_2">srgbt</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_2">srgbft</a></code><br>
<code><a href="r3_3.html#r3_3_2_7_1">statistics</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">str</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">strcmp</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_1">strength</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">strlen</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">strlwr</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">strupr</a></code><br>
<code><a href="r3_4.html#r3_4_5_5_11">sturm</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">substr</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_3_4">subsurface</a></code><br>
<code><a href="r3_3.html#r3_3_1_8_1">sum</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_14">superellipsoid</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_4">switch</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">sys</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">t</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_6">t</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">tan</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">tanh</a></code><br>
<code><a href="r3_4.html#r3_4_4_4_4">target</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_16">text</a></code><br>
<code><a href="r3_4.html#r3_4_6">texture</a></code><br>
<code><a href="r3_4.html#r3_4_6_5">texture_list</a></code><br>
<code><a href="r3_4.html#r3_4_6_5_1">texture_map</a></code><br>
<code><a href="r3_4.html#r3_4_7_6_1">tga</a></code><br>
<code><a href="r3_4.html#r3_4_6_3_7">thickness</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_1">threshold</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_6_1">tiff</a></code><br>
<code><a href="r3_4.html#r3_4_4_1_2">tightness</a></code><br>
<code><a href="r3_4.html#r3_4_6_5_2">tile2</a></code><br>
<code><a href="r3_4.html#r3_4_6_5_2">tiles</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_28">tiling</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_13">tolerance</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_7">toroidal</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_17">torus</a></code><br>
<code><a href="r3_3.html#r3_3_1_6_5">trace</a></code><br>
<code><a href="r3_3.html#r3_3_1_12">transform</a></code><br>
<code><a href="r3_3.html#r3_3_1_12_1">translate</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_6_3_3_4">translucency</a></code><br>
<code><a href="r3_3.html#r3_3_1_7_3">transmit</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_6">triangle</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_3">triangle_wave</a></code><br>
<code><a href="r3_4.html#r3_4_7_2_7">triangular</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_5">true</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_16">ttf</a></code><br>
<code><a href="r3_4.html#r3_4_3_3">turb_depth</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5_9">turbulence</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_1">type</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">u</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_6">u</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">uint8</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">uint16be</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">uint16le</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_1">u_steps</a></code><br>
<code><a href="r3_4.html#r3_4_2_2_5">ultra_wide_angle</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_2_2_4">undef</a></code><br>
<code><a href="r3_4.html#r3_4_5_4_2">union</a></code><br>
<code><a href="r3_4.html#r3_4_2_1_5">up</a></code><br>
<code><a href="r3_4.html#r3_4_7_4_2">use_alpha</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_3_3">use_color</a></code><br>
<code><a href="r3_4.html#r3_4_6_2_3_3">use_colour</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_6_2_3_3">use_index</a></code><br>
<code><a href="r3_4.html#r3_4_1_6">utf8</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_4">uv_indices</a></code><br>
<code><a href="r3_4.html#r3_4_6_7">uv_mapping</a></code><br>
<code><a href="r3_4.html#r3_4_6_7_2">uv_vectors</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">v</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_6">v</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_1">v_steps</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">val</a></code><br>
<code><a href="r3_4.html#r3_4_2_3">variance</a></code><br>
<code><a href="r3_3.html#r3_3_1_6_5">vaxis_rotate</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_5">vcross</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">vdot</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_6">version</a></code><br>
<code><a href="r3_4.html#r3_4_5_2_4">vertex_vectors</a></code><br>
<code><a href="r3_3.html#r3_3_1_5_4">vlength</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_5">vnormalize</a></code><br>
<code><a href="r3_3.html#r3_3_1_6_5">vrotate</a></code><br>
<code><a href="r3_3.html#r3_3_1_9_4">vstr</a></code><br>
<code><a href="r3_3.html#r3_3_1_6_5">vturbulence</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">w</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_2_7_1">warning</a></code><br>
<code><a href="r3_4.html#r3_4_7_5_5">warp</a></code><br>
<code><a href="r3_4.html#r3_4_5_1_5">water_level</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_1_29">waves</a></code><br>
<code><a href="r3_3.html#r3_3_2_6_5">while</a></code><br>
<code><a href="r3_4.html#r3_4_3_5">width</a></code><br>
</td>
<td width="33%">
<code><a href="r3_4.html#r3_4_7_1_30">wood</a></code><br>
<code><a href="r3_4.html#r3_4_7_1_31">wrinkles</a></code><br>
<code><a href="r3_3.html#r3_3_2_3_4">write</a></code><br>
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">x</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_6">x</a></code><br>
</td>
<td width="33%">
</td>
<td width="33%">
</td>
</tr>
</table>
<table class="tablelist">
<tr valign="top">
<th colspan="3" align="left">y</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_6">y</a></code><br>
</td>
<td width="33%">
<code><a href="r3_3.html#r3_3_1_5_5">yes</a></code><br>
</td>
<td width="33%">
</td>
</tr>
</table>
<table class="tablelist" summary="All reserved keywords">
<tr valign="top">
<th colspan="3" align="left">z</th>
</tr>
<tr valign="top">
<td width="33%">
<code><a href="r3_3.html#r3_3_1_6_6">z</a></code><br>
</td>
<td width="33%">
</td>
<td width="33%">
</td>
</tr>
</table></div>

<a name="r3_3_1_3"></a>
<div class="content-level-h4" contains="Identifiers" id="r3_3_1_3">
<h4>3.3.1.3 Identifiers</h4>
<p>POV-Ray allows you to define identifiers for later use in the scene file.
An identifier may be 1 to 40 characters long. It may consist of upper and
lower case letters, the digits 0 through 9 or an underscore character
(&quot;_&quot;). The first character must be an alphabetic character. The
declaration of identifiers is covered later.</p>

<p>All <a href="r3_3.html#r3_3_1_2">keywords</a> (reserved words) are fully lower case. Therefore it is recommended that
your identifiers contain at least one upper case character so it is sure to
avoid conflict with reserved words.</p></div>

<a name="r3_3_1_4"></a>
<div class="content-level-h4" contains="Comments" id="r3_3_1_4">
<h4>3.3.1.4 Comments</h4>
<p>Comments are text in the scene file included to make the scene file easier
to read or understand. They are ignored by the ray-tracer and are there for
your information. There are two types of comments in POV-Ray.</p>
<p>
Two slashes are used for single line comments. Anything on a line after a
double slash (<code>//</code>) is ignored by the ray-tracer. For example:</p>
<pre>
// This line is ignored
</pre>

<p>You can have scene file information on the line in front of the comment as
in:</p>
<pre>
object { FooBar } // this is an object
</pre>

<p>The other type of comment is used for multiple lines. It starts with
&quot;<code>/*</code>&quot; and ends with &quot;<code>*/</code>&quot;.
Everything in-between is ignored. For example:</p>
<pre>
/* These lines
are ignored
by the
ray-tracer */
</pre>

<p>This can be useful if you want to temporarily remove elements from a scene
file. <code>/*</code> ... <code>*/</code> comments can <em>comment out</em>
lines containing other <code>//</code> comments and thus can be used to
temporarily or permanently comment out parts of a scene. <code> /*</code> ...
<code>*/</code> comments can be nested, the following is legal:</p>
<pre>
/* This is a comment
// This too
/* This also */
*/
</pre>

<p>Use comments liberally and generously. Well used, they really improve the
readability of scene files.</p></div>

<a name="r3_3_1_5"></a>
<div class="content-level-h4" contains="Numeric Expressions" id="r3_3_1_5">
<h4>3.3.1.5 Numeric Expressions</h4>
<p>Many parts of the POV-Ray language require you to specify one or more
floating point numbers. A floating point number is a number with a decimal
point. Floats may be specified using literals, identifiers or functions which
return float values. You may also create very complex float expressions from
combinations of any of these using various familiar operators.</p>
<p>
Where POV-Ray needs an integer value it allows you to specify a float value
and it truncates it to an integer. When POV-Ray needs a logical or boolean
value it interprets any non-zero float as true and zero as false. Because
float comparisons are subject to rounding errors POV-Ray accepts values
extremely close to zero as being false when doing boolean functions.
Typically values whose absolute values are less than a preset value <em>
epsilon</em> are considered false for logical expressions. The value of <em>
epsilon</em> is system dependent but is generally about 1.0e-10. Two floats
<em>a</em> and <em>b</em> are considered to be equal if <em>abs(a-b) &lt;
epsilon.</em></p>
<p>
The full syntax for float expressions is given below. Detailed explanations
are given in the following sub-sections.</p>
<pre>
FLOAT:
  NUMERIC_TERM [SIGN NUMERIC_TERM]...
SIGN:
  + | -
NUMERIC_TERM:
  NUMERIC_FACTOR [MULT NUMERIC_FACTOR]...
MULT:
  * | /
NUMERIC_FACTOR:
  FLOAT_LITERAL                 |
  FLOAT_IDENTIFIER              |
  SIGN NUMERIC_FACTOR           |
  FLOAT_FUNCTION                |
  FLOAT_BUILT_IN_IDENT          |
  ( FULL_EXPRESSION )           |
  ! NUMERIC_FACTOR              |
  VECTOR DECIMAL_POINT DOT_ITEM |
  FLOAT_FUNCTION_INVOCATION
FLOAT_LITERAL:
  MANTISSA [EXP [SIGN] DIGIT...]
MANTISSA:
  DIGIT... [DECIMAL_POINT [DIGIT...]] | 
  DECIMAL_POINT DIGIT...
DIGIT:
  0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
DECIMAL_POINT:
  .
EXP:
  e | E
DOT_ITEM:
  x | y | z | t | u | v | red | green | blue | filter |
  transmit | gray
FLOAT_FUNCTION:
  abs( FLOAT ) | acos( FLOAT ) | acosh( FLOAT ) | asc( STRING ) |
  asin( FLOAT ) | asinh( FLOAT ) | atan( FLOAT) | atanh( FLOAT) |
  atan2( FLOAT , FLOAT ) | bitwise_and( FLOAT, FLOAT, ...) |
  bitwise_or (FLOAT, FLOAT, ...) | bitwise_xor ( FLOAT, FLOAT, ...) |
  ceil( FLOAT ) | cos( FLOAT ) | cosh( FLOAT ) | defined(IDENTIFIER ) |
  degrees( FLOAT ) | dimensions( ARRAY_IDENTIFIER ) |
  dimension_size( ARRAY_IDENTIFIER , FLOAT ) | 
  div( FLOAT , FLOAT ) | exp( FLOAT ) | file_exists( STRING ) |
  floor( FLOAT ) | int( FLOAT ) | ln(Float | log( FLOAT ) |
  max( FLOAT , FLOAT, ... ) | min( FLOAT , FLOAT, ... ) |
  mod( FLOAT , FLOAT ) | pow( FLOAT , FLOAT ) |
  radians( FLOAT ) | rand( FLOAT ) | seed( FLOAT ) |
  select( FLOAT, FLOAT, FLOAT [,FLOAT]) | sin( FLOAT ) |
  sinh( FLOAT ) | sqrt( FLOAT ) | strcmp( STRING , STRING ) |
  strlen( STRING ) | tan( FLOAT ) | tanh( FLOAT ) |
  val( STRING ) | vdot( VECTOR , VECTOR ) | vlength( VECTOR ) | 
FLOAT_BUILT_IN_IDENT:
  clock | clock_delta | clock_on | false | final_clock |
  final_frame | frame_number | image_height | image_width |
  initial_clock | initial_frame | no | off | on | pi | true |
  version | yes
FULL_EXPRESSION:
  FLOAT |
  LOGICAL_EXPRESSION [? FULL_EXPRESSION : FULL_EXPRESSION]
LOGICAL_EXPRESSION:
  REL_TERM [LOGICAL_OPERATOR REL_TERM]...
LOGICAL_OPERATOR:
  &amp; | | (note: this means an ampersand or a 
         vertical bar is a logical operator) 
REL_TERM:
  FLOAT [REL_OPERATOR FLOAT]... |
  STRING REL_OPERATOR STRING
REL_OPERATOR:
  &lt; | &lt;= | = | &gt;= | &gt; | !=
INT:
  FLOAT (note: any syntax which requires a
         integer INT will accept a FLOAT
         and it will be truncated to an
         integer internally by POV-Ray).
</pre>

<p class="Note"><strong>Note:</strong> <em>FLOAT_IDENTIFIERS</em> are identifiers previously declared to
have float values. The <em>DOT_ITEM</em> syntax is actually a vector or color operator but it returns a float value. See <a href="r3_3.html#r3_3_1_6_3">Vector Operators</a> or <a href="r3_3.html#r3_3_1_7_5">Color Operators</a> for details. An <em> ARRAY_IDENTIFIER</em> is just the identifier name of a previously declared array, it does not include the <code>[]</code> braces nor the index. The syntax for <em>STRING</em> is in the section <a href="r3_3.html#r3_3_1_9">Strings</a>.</p>

</div>
<a name="r3_3_1_5_1"></a>
<div class="content-level-h5" contains="Literals" id="r3_3_1_5_1">
<h5>3.3.1.5.1 Literals</h5>
<p>Float literals are represented by an optional sign (&quot;+&quot; or
&quot;-&quot;) digits, an optional decimal point and more digits. If the
number is an integer you may omit the decimal point and trailing zero. If it
is all fractional you may omit the leading zero. POV-Ray supports scientific
notation for very large or very small numbers. The following are all valid
float literals:</p>
<p>
<code> -2.0 -4 34 3.4e6 2e-5 .3 0.6</code></p>

</div>
<a name="r3_3_1_5_2"></a>
<div class="content-level-h5" contains="Identifiers" id="r3_3_1_5_2">
<h5>3.3.1.5.2 Identifiers</h5>
<p>Float identifiers may be declared to make scene files more readable and to
parameterize scenes so that changing a single declaration changes many
values. An identifier is declared as follows.</p>
<pre>
FLOAT_DECLARATION:
  #declare IDENTIFIER = EXPRESSION;    |
  #local IDENTIFIER = EXPRESSION;
</pre>

<p>Where <em>IDENTIFIER</em> is the name of the identifier up to 40
characters long and <em>EXPRESSION</em> is any valid expression which
evaluates to a float value. </p>
<p class="Note"><strong>Note:</strong> There should be a semi-colon after the
expression in a float declaration. If omitted, it generates a warning
and some macros may not work properly. See <a href="r3_3.html#r3_3_2_2_2">#declare vs. #local</a> for information on identifier scope.</p>

<p>Here are some examples.</p>
<pre>
#declare Count = 0;
#declare Rows = 5.3;
#declare Cols = 6.15;
#declare Number = Rows*Cols;
#declare Count = Count+1;
</pre>

<p>As the last example shows, you can re-declare a float identifier and may
use previously declared values in that re-declaration. There are several
built-in identifiers which POV-Ray declares for you. See Float Expressions: <a href="r3_3.html#r3_3_1_5_6">Built-in Variables</a>
for details.</p>

</div>
<a name="r3_3_1_5_3"></a>
<div class="content-level-h5" contains="Operators" id="r3_3_1_5_3">
<h5>3.3.1.5.3 Operators</h5>
<p><strong>Arithmetic expressions:</strong> Basic math expressions can be
created from float literals, identifiers or functions using the following
operators in this order of precedence...</p>

<table SUMMARY="Arithmetic expressions" width="75%">
<tr>
<td width="30%"><code>( )</code></td>

<td width="70%">expressions in parentheses first</td>
</tr>

<tr>
<td><code>+A -A !A</code></td>

<td>unary minus, unary plus and logical <em>not</em></td>
</tr>

<tr>
<td><code>A*B A/B</code></td>

<td>multiplication and division</td>
</tr>

<tr>
<td><code>A+B A-B</code></td>

<td>addition and subtraction</td>
</tr>
</table>

<p>Relational, logical and conditional expressions may also be created.
However there is a restriction that these types of expressions must be
enclosed in parentheses first. This restriction, which is not imposed by most
computer languages, is necessary because POV-Ray allows mixing of float and
vector expressions. Without the parentheses there is an ambiguity problem.
Parentheses are not required for the unary logical not operator &quot;!&quot;
as shown above. The operators and their precedence are shown here.</p>

<p><strong> Relational expressions:</strong> The operands are arithmetic
expressions and the result is always boolean with 1 for true and 0 for false.
All relational operators have the same precedence.</p>

<table SUMMARY="Relational expressions" width="75%">
<tr>
<td width="30%"><code>(A &lt; B)</code></td>

<td width="70%">A is less than B</td>
</tr>

<tr>
<td><code>(A &lt;= B)</code></td>

<td>A is less than or equal to B</td>
</tr>

<tr>
<td><code>(A = B)</code></td>

<td>A is equal to B (actually abs(A-B)&lt;EPSILON)</td>
</tr>

<tr>
<td><code>(A != B)</code></td>

<td>A is not equal to B (actually abs(A-B)&gt;=EPSILON)</td>
</tr>

<tr>
<td><code>(A &gt;= B)</code></td>

<td>A is greater than or equal to B</td>
</tr>

<tr>
<td><code>(A &gt; B)</code></td>

<td>A is greater than B</td>
</tr>
</table>

<p><strong>Logical expressions:</strong> The operands are converted to
boolean values of 0 for false and 1 for true. The result is always boolean.
All logical operators have the same precedence. </p>
<p class="Note"><strong>Note:</strong> These are not
bit-wise operations, they are logical.</p>

<table SUMMARY="Logical expressions" width="75%">
<tr>
<td width="30%"><code>(A &amp; B)</code></td>

<td width="70%">true only if both A and B are true, false otherwise</td>
</tr>

<tr>
<td><code>(A | B)</code></td>

<td>true if either A or B or both are true</td>
</tr>
</table>

<p><strong>Conditional expressions:</strong> The operand C is boolean while
operands A and B are any expressions. The result is of the same type as A and
B.</p>

<table SUMMARY="Conditional expressions" width="75%">
<tr>
<td width="30%"><code>(C ? A : B)</code></td>

<td width="70%">if C then A else B</td>
</tr>
</table>

<p>Assuming the various identifiers have been declared, the following are
examples of valid expressions...</p>
<pre>
1+2+3    2*5     1/3     Row*3    Col*5
(Offset-5)/2      This/That+Other*Thing
((This&lt;That) &amp; (Other&gt;=Thing)?Foo:Bar)
</pre>

<p>Expressions are evaluated left to right with innermost parentheses
evaluated first, then unary +, - or !, then multiply or divide, then add or
subtract, then relational, then logical, then conditional.</p>

</div>
<a name="r3_3_1_5_4"></a>
<div class="content-level-h5" contains="Functions" id="r3_3_1_5_4">
<h5>3.3.1.5.4 Functions</h5>
<p>POV-Ray defines a variety of built-in functions for manipulating floats,
vectors and strings. Function calls consist of a keyword which specifies the
name of the function followed by a parameter list enclosed in parentheses.
Parameters are separated by commas. For example:</p>
<pre>
keyword(param1,param2)
</pre>

<p>The following are the functions which return float values. They take one
or more float, integer, vector, or string parameters. Assume that <code>
A</code> and <code>B</code> are any valid expression that evaluates to a
float; <code>I</code> is a float which is truncated to integer internally,
<code>S</code>, <code>S1</code>, <code>S2</code> etc. are strings, and <code>
V</code>, <code>V1</code>, <code>V2</code> etc. are any vector
expressions.<code>O</code> is an object identifier to a pre-declared object.</p>

<p><code>abs(A)</code><br>Absolute value of <code>A</code>. If <code>A</code> is negative, returns <code>-A</code> otherwise returns <code>A</code>.</p>

<p><code>acos(A)</code><br>Arc-cosine of <code>A</code>. Returns the angle, measured in radians, whose cosine is <code>A</code>.</p>

<p><code>acosh(A)</code><br>Inverse hyperbolic cosine of <code>A</code>.</p>

<p><code>asc(S)</code><br>Returns an integer value in the range 0 to 255 that is the ASCII value of the first character of the string <code>S</code>. For example <code>asc(&quot;ABC&quot;)</code> is 65 because that is the value of the character &quot;A&quot;.</p>

<p><code>asin(A)</code><br>Arc-sine of <code>A</code>. Returns the angle, measured in radians, whose sine is <code>A</code>.</p>

<p><code>asinh(A)</code><br>Inverse hyperbolic sine of <code>A</code></p>

<p><code>atan2(A,B)</code><br>Arc-tangent of <code>(A/B)</code>. Returns the angle, measured in radians, whose tangent is <code>(A/B)</code>. Returns appropriate value even if <code>B</code> is zero. Use <code>atan2(A,1)</code> to compute usual atan(A) function.</p>

<p><code>atanh(A)</code><br>Inverse hyperbolic tangent of <code>A</code></p>

<p><code>bitwise_and(A,B,...)</code><br>Bitwise <em>AND</em> of two or more float values considered as integers.</p>

<p><code>bitwise_or(A,B,...)</code><br>Bitwise <em>OR</em> of two or more float values considered as integers.</p>

<p><code>bitwise_xor(A,B,...)</code><br>Bitwise <em>XOR</em> of two or more float values considered as integers.</p>

<p class="Note"><strong>Note:</strong> For the three bit-wise functions, each parameter is first converted to integer (so fractional part is ignored), and the computation is performed on a classical int. Do not expect to much precision, as conversion from a double precision number (usually with 52 bits mantissa) to an integer and back to a double precision number is not the best way to keep track of every bit.</p>

<p><code>ceil(A)</code><br>Ceiling of <code>A</code>. Returns the smallest integer greater than <code>A</code>. Rounds up to the next higher integer.</p>

<p><code>cos(A)</code><br>Cosine of <code>A</code>. Returns the cosine of the angle <code>A</code>, where <code>A</code> is measured in radians.</p>

<p><code>cosh(A)</code><br>The hyperbolic cosine of <code>A</code>.</p>

<p><code>defined(</code><em>IDENTIFIER</em><code>)</code><br>Returns <code>true</code> if the identifier is currently defined, <code>false</code> otherwise. This is especially useful for detecting end-of-file after a <code>#read</code> directive because the file identifier is automatically undefined when end-of-file is reached. See <a href="r3_3.html#r3_3_2_3_3">The #read Directive</a> for details.</p>

<p><code>degrees(A)</code><br>Convert radians to degrees. Returns the angle measured in degrees whose value in radians is <code>A</code>. Formula is <em>degrees=A/pi*180.0</em>.</p>

<p><code>dimensions(</code> <em>ARRAY_IDENTIFIER</em> <code>)</code><br>Returns the number of dimensions of a previously declared array identifier. For example if you do <code>#declare MyArray=array[6][10]</code> then <code>dimensions(MyArray)</code> returns the value <code>2</code>.</p>

<p><code>dimension_size(</code> <em> ARRAY_IDENTIFIER, FLOAT</em> <code>)</code><br>Returns the size of a given dimension of a previously declared array identifier. Dimensions are numbered left-to-right starting with 1. For example if you do <code>#declare MyArray=array[6][10]</code> then <code>dimension_size(MyArray,2)</code> returns the value <code>10</code>.</p>

<p><code>div(A,B)</code><br>Integer division. The integer part of <code>(A/B)</code>.</p>

<p><code>exp(A)</code><br>Exponential of <code>A</code>. Returns the value of <em> e</em> raised to the power <code>A</code> where <em>e</em> is the base of the natural logarithm, i.e. the non-repeating value approximately equal to 2.71828182846.</p>

<p><code>file_exists(S)</code><br>Attempts to open the file specified by the string <code>S</code>. The current directory and all library directories specified by the <code>Library_Path</code> or <code>+L</code> options are also searched. See <a href="r3_2.html#r3_2_5_4">Library Paths</a> for details. Returns <code>1</code> if successful and <code>0</code> if unsuccessful.</p>

<p><code>floor(A)</code><br>Floor of <code>A</code>. Returns the largest integer less than <code>A</code>. Rounds down to the next lower integer.</p>

<p><code>inside(O,V)</code><br>It returns either 0.0, when the vector <code>V</code> is outside the object, specified by the object-identifier <code>O</code>, or 1.0 if it is inside.</p>

<p class="Note"><strong>Note:</strong> The <code>inside</code> keyword does not accept object-identifiers to non-solid objects.</p>

<p><code>int(A)</code><br>Integer part of <code>A</code>. Returns the truncated integer part of <code>A</code>. Rounds towards zero.</p>

<p><code>log(A)</code><br>Logarithm of <code>A</code>. Returns the logarithm base <em>10</em> of the value <code>A</code>.</p>

<p><code>ln(A)</code><br>Natural logarithm of <code>A</code>. Returns the natural logarithm base <em>e</em> of the value <code>A</code>.</p>

<p><code>max(A,B,...)</code><br>Maximum of two or more float values. Returns <code>A</code> if <code>A</code> larger than <code>B</code>. Otherwise returns <code>B</code>.</p>

<p><code>min(A,B,...)</code><br>Minimum of two or more float values. Returns <code>A</code> if <code>A</code> smaller than <code>B</code>. Otherwise returns <code>B</code>.</p>

<p><code>mod(A,B)</code><br>Value of <code>A</code> modulo <code>B</code>. Returns the remainder after the integer division of <code>A</code>/<code>B</code>. Formula is <em> mod=((A/B)-int(A/B))*B</em>.</p>

<p><code>pow(A,B)</code><br>Exponentiation. Returns the value of <code>A</code> raised to the power <code>B</code>.</p>

<p class="Note"><strong>Note:</strong> For a negative A and a non-integer B the function has no defined return value. The result then may depend on the platform POV-Ray is compiled on.</p>

<p><code>radians(A)</code><br>Convert degrees to radians. Returns the angle measured in radians whose value in degrees is <code>A</code>. Formula is <em>radians=A*pi/180.0</em>.</p>

<p><code>rand(I)</code><br>Returns the next pseudo-random number from the stream specified by the positive integer <code>I</code>. You must call <code>seed()</code> to initialize a random stream before calling <code>rand()</code>. The numbers are uniformly distributed, and have values between <code>0.0</code> and <code>1.0</code>, inclusively. The numbers generated by separate streams are independent random variables.</p>

<p><code>seed(I)</code><br>Initializes a new pseudo-random stream with the initial seed value <code>I</code>. The number corresponding to this random stream is returned. Any number of pseudo-random streams may be used as shown in the example below:</p>

<pre>
#declare R1 = seed(0);
#declare R2 = seed(12345);
sphere { &lt;rand(R1), rand(R1), rand(R1)&gt;, rand(R2) }
</pre>

<p>Multiple random generators are very useful in situations where you use <code>rand()</code> to place a group of objects, and then decide to use <code>rand()</code> in another location earlier in the file to set some colors or place another group of objects. Without separate <code>rand()</code> streams, all of your objects would move when you added more calls to <code>rand()</code>. This is very annoying.</p>

<p><code>select(A, B, C [,D])</code><br>It can be used with three or four parameters <code>Select</code> compares the first argument with zero, depending on the outcome it will return <code>B</code>, <code>C</code> or <code>D</code>. <code>A,B,C,D</code> can be floats or funtions.</p>

<p>When used with three parameters, if <code>A &lt; 0</code> it will return <code>B</code>, else <code>C</code> (<code>A &gt;= 0</code>).</p>

<p>When used with four parameters, if <code>A &lt; 0</code> it will return B. If <code>A = 0</code> it will return <code>C</code>. Else it will return <code>D</code> (<code>A &gt; 0</code>).</p>

<p>Example:</p>
<p>If <code>A</code> has the consecutive values -2, -1, 0, 1, and 2 :</p>
<pre>
                         //    A =  -2 -1 0 1 2
select (A, -1, 0, 1)     //returns  -1 -1 0 1 1 
select (A, -1, 1)        //returns  -1 -1 1 1 1 
</pre>

<p><code>sin(A)</code><br>Sine of <code>A</code>. Returns the sine of the angle <code>A</code>, where <code>A</code> is measured in radians.</p>

<p><code>sinh(A)</code><br>The hyperbolic sine of <code>A</code>.</p>

<p><code>strcmp(S1,S2)</code><br>Compare string <code>S1</code> to <code>S2</code>. Returns a float value zero if the strings are equal, a positive number if <code>S1</code> comes after <code>S2</code> in the ASCII collating sequence, else a negative number.</p>

<p><code>strlen(S)</code><br>Length of <code>S</code>. Returns an integer value that is the number of characters in the string <code>S</code>.</p>

<p><code>sqrt(A)</code><br>Square root of <code>A</code>. Returns the value whose square is <code>A</code>.</p>

<p><code>tan(A)</code><br>Tangent of <code>A</code>. Returns the tangent of the angle <code>A</code>, where <code>A</code> is measured in radians.</p>

<p><code>tanh(A)</code><br>The hyperbolic tangent of <code>A</code>.</p>

<p><code>val(S)</code><br>Convert string <code>S</code> to float. Returns a float value that is represented by the text in string <code>S</code>. For example <code>val(&quot;123.45&quot;)</code> is 123.45 as a float.</p>

<p><code>vdot(V1,V2)</code><br>Dot product of <code>V1</code> and <code>V2</code>. Returns a float value that is the dot product (sometimes called scalar product) of <code>V1</code> with <code>V2</code>. It is directly proportional to the length of the two vectors and the cosine of the angle between them. Formula is <em>vdot=V1.x*V2.x + V1.y*V2.y + V1.z*V2.z.</em> See the animated demo scene <code>VECT2.POV</code> for an illustration.</p>

<p><code>vlength(V)</code><br>Length of <code>V</code>. Returns a float value that is the length of vector <code>V</code>. Formula is <em>vlength=sqrt(vdot(A,A))</em>. Can be used to compute the distance between two points. <code>Dist=vlength(V2-V1)</code>.</p>

<p>See section <a href="r3_3.html#r3_3_1_8_4">Vector Functions</a> and section <a href="r3_3.html#r3_3_1_9_4">String Functions</a> for other functions which are somewhat float-related but which return vectors and strings. In addition to the above built-in functions, you may also define your own functions using the <code>function</code> keyword. See the section <a href="r3_3.html#r3_3_1_8_3">User-Defined Functions</a> for more details.</p>

</div>
<a name="r3_3_1_5_5"></a>
<div class="content-level-h5" contains="Built-in Constants" id="r3_3_1_5_5">
<h5>3.3.1.5.5 Built-in Constants</h5>
<p>Constants are:</p>
<pre>
FLOAT_BUILT_IN_IDENT:
  false | no | off | on | pi | true | yes
</pre>
<p>The built-in constants never change value. They are defined as though
the following lines were at the start of every scene.</p>
<pre>
#declare pi = 3.1415926535897932384626;
#declare true = 1;
#declare yes = 1;
#declare on = 1;
#declare false = 0;
#declare no = 0;
#declare off = 0;
</pre>

<p>The built-in float identifier <code>pi</code> is obviously useful in math
expressions involving circles. The built-in float identifiers <code>
on</code>, <code>off</code>, <code>yes</code>, <code>no</code>, <code>
true</code>, and <code>false</code> are designed for use as boolean
constants.</p>

<p>The built-in float constants <code>on</code>, <code>off</code>, <code>yes</code>, <code>no</code>, <code>true</code>, and <code>false</code> are most often used as boolean values with object modifiers or parameters such as <code><a href="r3_4.html#r3_4_5_5_11">sturm</a></code>, <code><a href="r3_4.html#r3_4_5_5_4">hollow</a></code>, <code><a href="r3_4.html#r3_4_5_1_1">hierarchy</a></code>, <code><a href="r3_4.html#r3_4_5_1_5">smooth</a></code>, <code><a href="r3_4.html#r3_4_4_1_11">media_attenuation</a></code>, and <code><a href="r3_4.html#r3_4_4_1_10">media_interaction</a></code>. Whenever you see syntax of the form <code>keyword</code> <em><code>[Bool]</code></em>, if you simply specify the keyword without the optional boolean then it assumes <code>keyword on</code>. You need not use the boolean but for readability it is a good idea. You must use one of the false booleans or an expression which evaluates to zero to turn it off.</p>
<p class="Note"><strong>Note:</strong> Some of these keywords are <code>on</code> by default, if no keyword is specified.</p>
<p>For example:</p>
<pre>
object { MyBlob }                // sturm defaults off, but
                                 // hierarchy defaults on
object { MyBlob sturm }          // turn sturm on
object { MyBlob sturm on }       // turn sturm on
object { MyBlob sturm off }      // turn sturm off
object { MyBlob hierarchy }      // does nothing, hierarchy was
                                 // already on
object { MyBlob hierarchy off }  // turn hierarchy off
</pre>

</div>
<a name="r3_3_1_5_6"></a>
<div class="content-level-h5" contains="Built-in Variables" id="r3_3_1_5_6">
<h5>3.3.1.5.6 Built-in Variables</h5>
<p>There are several built-in float variables. You can use them to specify
values or to create expressions but you cannot re-declare them to change
their values.</p>

<p>Clock-related are:</p>
<pre>
FLOAT_BUILT-IN_IDENT:
  clock | clock_delta | clock_on | final_clock | final_frame
  frame_number | initial_clock | initial_frame
</pre>

<p>These keywords allow to use the values of the clock which have been set in the
command line switch options (or INI-file). They represent float or integer values, read from the
animation options. You cannot re-declare these identifiers.</p>

<p><code>clock</code>
<br>The built-in float identifier <code>clock</code> is used to control
animations in POV-Ray. Unlike some animation packages, the action in POV-Ray
animated scenes does not depend upon the integer frame numbers. Rather you
should design your scenes based upon the float identifier <code>
clock</code>. For non-animated scenes its default value is 0 but you can set
it to any float value using the INI file option <code>Clock=</code><em>n.n</em>
or the command-line switch <code>+K</code><em>n.n</em> to pass a single float
value your scene file.</p>
<p>
Other INI options and switches may be used to animate scenes by automatically
looping through the rendering of frames using various values for <code>clock</code>.
By default, the clock value is 0 for the initial frame and 1 for the final frame. All other
frames are interpolated between these values.
<br>For example if your object is supposed to rotate one full turn over the course
of the animation you could specify <code>rotate 360*clock*y</code>. Then as
clock runs from 0 to 1, the object rotates about the y-axis from 0 to 360 degrees.</p>
<p>
Although the value of <code>clock</code> will change from frame-to-frame,
it will never change throughout the parsing of a scene.</p>

<p><code>clock_delta</code>
<br>The built-in float identifier <code>clock_delta</code> returns the amount
of time between clock values in animations in POV-Ray. While most animations
only need the clock value itself, some animation calculations are easier if
you know how long since the last frame. Caution must be used when designing
such scenes. If you render a scene with too few frames, the results may be
different than if you render with more frames in a given time period. On
non-animated scenes, <code>clock_delta</code> defaults to 0. See the section
<a href="r3_2.html#r3_2_1">Animation Options</a> for more details.</p>

<p><code>clock_on</code></p>
<p>With this identifier the status of the clock can be checked: 1 is on, 0 is off.</p>
<pre>
#if(clock_on=0)
  //stuff for still image
#else
  //some animation
#end
</pre>

<p><code>frame_number</code></p>
<p>If you rather want to define the action in POV-Ray animated scenes depending upon the integer frame numbers, this identifier can be used. It reads the number of the frame currently being rendered.</p>
<pre>
#if(frame_number=1)
  //stuff for first image or frame
#end
#if(frame_number=2)
  //stuff for second image or frame
#end
#if(frame_number=n)
  //stuff for n th image or frame
#end
</pre>

<p><code>initial_clock</code>
<br>This identifier reads the value set through the INI file option <code>Initial_Clock=</code><em>n.n</em>
or the command-line switch <code>+KI</code><em>n.n</em>.</p>

<p><code>final_clock</code>
<br>This identifier reads the value set through the INI file option <code>Final_Clock=</code><em>n.n</em>
or the command-line switch <code>+KF</code><em>n.n</em>.</p>

<p><code>initial_frame</code>
<br>This identifier reads the value set through the INI file option <code>Initial_Frame=</code><em>n</em>
or the command-line switch <code>+KFI</code><em>n</em>.</p>

<p><code>final_frame</code>
<br>This identifier reads the value set through the INI file option <code>Final_Frame=</code><em>n</em>
or the command-line switch <code>+KFF</code><em>n</em>.</p>

<p class="Note"><strong>Note:</strong> These values are the ones actually used. When the option 'cyclic animation' is set,
they could be different from the ones originally set in the options.</p>

<p>Image-size are:</p>
<pre>
FLOAT_BUILT-IN_IDENT:
  image_width | image_height
</pre>
<p><code>image_width</code>
<br>This identifier reads the value set through the INI file option <code>Width=</code><em>n</em>
or the command-line switch <code>+W</code><em>n</em>.</p>

<p><code>image_height</code>
<br>This identifier reads the value set through the INI file option <code>Height=</code><em>n</em>
or the command-line switch <code>+H</code><em>n</em>.</p>

<p>You could use these keywords to set the camera ratio (up and right vectors) correctly. The viewing
angle of the camera covers the full width of the rendered image. The camera ratio will always
follow the ratio of the image width to height, regardless of the set image size. Use it like this:</p>
<pre>
up y*image_height
right x*image_width
</pre>

<p>You could also make some items of the scene dependent on the image size:</p>
<pre>  
#if (image_width &lt; 300) crand 0.1 #else crand 0.5 #end

or:

image_map {
  pattern image_width, image_width {  //make pattern resolution
    gradient x                        //dependent of render width
    color_map { [ 0.0 ... ] [ 1.0 ... ] }
    }
  }
</pre>

<p><code>version</code></p>
<pre>
FLOAT_BUILT-IN_IDENT:
  version
</pre>

<p>The built-in float variable <code>version</code> contains the current
setting of the version compatibility option. Although this value defaults to
the current POV-Ray version number, the initial value of <code>
version</code> may be set by the INI file option <code>
Version=</code><em>n.n</em> or by the <code>+MV</code><em>n.n</em>
command-line switch. This tells POV-Ray to parse the scene file using syntax
from an earlier version of POV-Ray.</p>
<p>
The INI option or switch only affects the initial setting. Unlike other built-in identifiers, you may change the value of <code>version</code> throughout a scene file. You do not use <code>#declare</code> to change it though. The <code><a href="r3_3.html#r3_3_2_5">#version</a></code> language directive is used to change modes. Such changes may occur several times within scene files.</p>
<p>
Together with the built-in <code>version</code> identifier the <code>#version</code> directive allows you to save and restore the previous values of this compatibility setting. The new <code>#local</code> identifier option is especially useful here. For example suppose <code>mystuff.inc</code> is in <em>version 1</em> format. At the top of the file you could put:</p>
<pre>
#local Temp_Vers = version;  // Save previous value
#version 1.0;                // Change to 1.0 mode
...                          // Version 1.0 stuff goes here...
#version Temp_Vers;          // Restore previous version
</pre>

<p class="Note"><strong>Note:</strong> There should be a semi-colon after the
float expression in a <code>#version</code> directive. If omitted, it generates
a warning and some macros may not work properly.</p></div>

<a name="r3_3_1_6"></a>
<div class="content-level-h4" contains="Vector Expressions" id="r3_3_1_6">
<h4>3.3.1.6 Vector Expressions</h4>
<p>POV-Ray often requires you to specify a <em>vector</em>. A vector is a set
of related float values. Vectors may be specified using literals, identifiers
or functions which return vector values. You may also create very complex
vector expressions from combinations of any of these using various familiar
operators.</p>
<p>
POV-Ray vectors may have from two to five components but the vast majority
of vectors have three components. Unless specified otherwise, you should
assume that the word <em>vector</em> means a three component vector.
POV-Ray operates in a 3D x, y, z coordinate system and you will use three
component vectors to specify x, y and z values. In some places POV-Ray needs
only two coordinates. These are often specified by a 2D vector called an <em>
UV vector</em>. Fractal objects use 4D vectors. Color expressions use 5D
vectors but allow you to specify 3, 4 or 5 components and use default values
for the unspecified components. Unless otherwise noted, all 2, 4 or 5
component vectors work just like 3D vectors but they have a different number
of components.</p>
<p>
The syntax for combining vector literals into vector expressions is almost
identical to the rules for float expressions. In the syntax for vector
expressions below, some of the syntax items are defined in the section for
float expressions. See <a href="r3_3.html#r3_3_1_5">Float Expressions</a> for those definitions.
Detailed explanations of vector-specific issues are given in the following

sub-sections.</p>
<pre>
VECTOR:
    NUMERIC_TERM [SIGN NUMERIC_TERM]
NUMERIC_TERM:
    NUMERIC_FACTOR [MULT NUMERIC_FACTOR]
NUMERIC_FACTOR:
    VECTOR_LITERAL        | 
    VECTOR_IDENTIFIER     | 
    SIGN NUMERIC_FACTOR   | 
    VECTOR_FUNCTION       |
    VECTOR_BUILT-IN_IDENT | 
    ( FULL_EXPRESSION )   | 
    ! NUMERIC_FACTOR      | 
    FLOAT
VECTOR_LITERAL:
    &lt; FLOAT , FLOAT , FLOAT &gt;
VECTOR_FUNCTION:
    min_extent ( OBJECT_IDENTIFIER )         |
    max_extent ( OBJECT_IDENTIFIER )         |
    trace(OBJECT_IDENTIFIER, VECTOR, VECTOR, [VECTOR_IDENTIFIER] )|
    vaxis_rotate( VECTOR , VECTOR , FLOAT )  |
    vcross( VECTOR , VECTOR )                |
    vrotate( VECTOR , VECTOR )               | 
    vnormalize( VECTOR )                     |
    vturbulence(FLOAT, FLOAT, FLOAT, VECTOR)
VECTOR_BUILT-IN_IDENT:
     x | y | z | t | u | v
</pre>

<p class="Note"><strong>Note:</strong> <em>VECTOR_IDENTIFIERS</em> are identifiers previously
declared to have vector values.</p>

</div>
<a name="r3_3_1_6_1"></a>
<div class="content-level-h5" contains="Literals" id="r3_3_1_6_1">
<h5>3.3.1.6.1 Literals</h5>
<p>Vector literals consist of two to five float expressions that are
bracketed by angle brackets <code>&lt;</code> and <code>&gt;</code>. The
terms are separated by commas. For example here is a typical three component
vector:</p>
<pre>
&lt; 1.0, 3.2, -5.4578 &gt;
</pre>

<p>The commas between components are necessary to keep the program from
thinking that the 2nd term is the single float expression <code>
3.2-5.4578</code> and that there is no 3rd term. If you see an error message
such as &quot;Float expected but '&gt;' found instead&quot; then you
probably have missed a comma.</p>
<p>
Sometimes POV-Ray requires you to specify floats and vectors side-by-side.
The rules for vector expressions allow for mixing of vectors with vectors or
vectors with floats so commas are required separators whenever an ambiguity
might arise. For example <code>&lt;1,2,3&gt;-4</code> evaluates as a mixed
float and vector expression where 4 is subtracted from each component
resulting in <code>&lt;-3,-2,-1&gt;</code>. However the comma in <code>
&lt;1,2,3&gt;,-4</code> means this is a vector followed by a float.</p>
<p>
Each component may be a full float expression. For example</p>
<pre>
&lt;This+3,That/3,5*Other_Thing&gt;
</pre>
<p>is a valid vector.</p>

</div>
<a name="r3_3_1_6_2"></a>
<div class="content-level-h5" contains="Identifiers" id="r3_3_1_6_2">
<h5>3.3.1.6.2 Identifiers</h5>
<p>Vector identifiers may be declared to make scene files more readable and
to parameterize scenes so that changing a single declaration changes many
values. An identifier is declared as follows.</p>
<pre>
VECTOR_DECLARATION:
  #declare IDENTIFIER = EXPRESSION; |
  #local IDENTIFIER = EXPRESSION;
</pre>

<p>Where <em>IDENTIFIER</em> is the name of the identifier up to 40
characters long and <em>EXPRESSION</em> is any valid expression which
evaluates to a vector value.</p>
<p class="Note"><strong>Note:</strong> There should be a semi-colon after the
expression in a vector declaration. If omitted, it generates a warning and
some macros may not work properly. See 
<a href="r3_3.html#r3_3_2_2_2">#declare vs. #local</a> for
information on identifier scope.</p>

<p>Here are some examples....</p>
<pre>
#declare Here = &lt;1,2,3&gt;;
#declare There = &lt;3,4,5&gt;;
#declare Jump = &lt;Foo*2,Bar-1,Bob/3&gt;;
#declare Route = There-Here;
#declare Jump = Jump+&lt;1,2,3&gt;;
</pre>

<p class="Note"><strong>Note:</strong> You invoke a vector identifier by using its name without any
angle brackets. As the last example shows, you can re-declare a vector
identifier and may use previously declared values in that re-declaration.
There are several built-in identifiers which POV-Ray declares for you. See
section <a href="r3_3.html#r3_3_1_5_5">Built-in Vector Identifiers</a> for details.</p>

</div>
<a name="r3_3_1_6_3"></a>
<div class="content-level-h5" contains="Operators" id="r3_3_1_6_3">
<h5>3.3.1.6.3 Operators</h5>
<p>Vector literals, identifiers and functions may also be combined in
expressions the same as float values. Operations are performed on a
component-by-component basis. For example <code>&lt;1,2,3&gt; +
&lt;4,5,6&gt;</code> evaluates the same as <code>&lt;1+4,2+5,3+6&gt;</code>
or <code>&lt;5,7,9&gt;</code>. Other operations are done on a similar
component-by-component basis. For example <code>(&lt;1,2,3&gt; =
&lt;3,2,1&gt;)</code> evaluates to <code>&lt;0,1,0&gt;</code> because the
middle components are equal but the others are not. Admittedly this is not
very useful but it is consistent with other vector operations.</p>
<p>
Conditional expressions such as <code>(C ? A : B)</code> require that <code>
C</code> is a float expression but <code>A</code> and <code>B</code> may be
vector expressions. The result is that the entire conditional evaluates as a
valid vector. For example if <code>Foo</code> and <code>Bar</code> are
floats then <code>(Foo &lt; Bar ? &lt;1,2,3&gt; : &lt;5,6,7&gt;)</code>
evaluates as the vector <code>&lt;1,2,3&gt;</code> if <code>Foo</code> is
less than <code>Bar</code> and evaluates as <code>&lt;5,6,7&gt;</code>
otherwise.</p>
<p>
You may use the dot operator to extract a single float component from a vector. Suppose the identifier <code>Spot</code> was previously defined as a vector. Then <code>Spot.x</code> is a float value that is the first component of this x, y, z vector. Similarly <code>Spot.y</code> and <code>Spot.z</code> reference the 2nd and 3rd components. If <code>Spot</code> was a two component UV vector you could use <code>Spot.u</code> and <code>Spot.v</code> to extract the first and second component. For a 4D vector use <code>.x</code>, <code>.y</code>, <code>.z</code>, and <code>.t</code> to extract each float component. The dot operator is also used in color expressions which are covered later.</p>

</div>
<a name="r3_3_1_6_4"></a>
<div class="content-level-h5" contains="Operator Promotion" id="r3_3_1_6_4">
<h5>3.3.1.6.4 Operator Promotion</h5>
<p>You may use a lone float expression to define a vector whose components
are all the same. POV-Ray knows when it needs a vector of a particular type
and will promote a float into a vector if need be. For example the POV-Ray
<code>scale</code> statement requires a three component vector. If you
specify <code>scale 5</code> then POV-Ray interprets this as <code>scale
&lt;5,5,5&gt;</code> which means you want to scale by 5 in every
direction.</p>
<p>
Versions of POV-Ray prior to 3.0 only allowed such use of a float as a
vector in various limited places such as <code>scale</code> and <code>
turbulence</code>. However you may now use this trick anywhere. For
example...</p>
<pre>
box{0,1}     // Same as box{&lt;0,0,0&gt;,&lt;1,1,1&gt;}
sphere{0,1} // Same as sphere{&lt;0,0,0&gt;,1}
</pre>

<p>When promoting a float into a vector of 2, 3, 4 or 5 components, all
components are set to the float value, however when promoting a vector of a
lower number of components into a higher order vector, all remaining
components are set to zero. For example if POV-Ray expects a 4D vector and
you specify <code>9</code> the result is <code>&lt;9,9,9,9&gt;</code> but if
you specify <code>&lt;7,6&gt;</code> the result is <code>
&lt;7,6,0,0&gt;</code>.</p>

</div>
<a name="r3_3_1_6_5"></a>
<div class="content-level-h5" contains="Functions" id="r3_3_1_6_5">
<h5>3.3.1.6.5 Functions</h5>
<p>POV-Ray defines a variety of built-in functions for manipulating floats,
vectors and strings. Function calls consist of a keyword which specifies the
name of the function followed by a parameter list enclosed in parentheses.
Parameters are separated by commas. For example:</p>
<pre>
keyword(param1,param2)
</pre>

<p>The following are the functions which return vector values. They take one
or more float, integer, vector, or string parameters. Assume that <code>
A</code> and <code>B</code> are any valid expression that evaluates to a
vector; and <code>F</code> is any float expression.</p>

<p><code>min_extent(OBJECT_IDENTIFIER), max_extent(OBJECT_IDENTIFIER)</code>.
The <code>min_extent</code> and <code>max_extent</code> return the
minimum and maximum coordinates of a #declared object's bounding box (Corner1
and Corner2), in effect allowing you to find the dimensions and location of the object.</p>

<p class="Note"><strong>Note:</strong> This is not perfect, in some cases (such as CSG intersections and
differences or isosurfaces) the bounding box does not represent the actual dimensions
of the object.</p>
<p>Example:</p>
<pre>
#declare Sphere =
sphere {
  &lt;0,0,0&gt;, 1
  pigment { rgb &lt;1,0,0&gt; }
  }

#declare Min = min_extent ( Sphere );
#declare Max = max_extent ( Sphere );

object { Sphere }
box {
  Min, Max
  pigment { rgbf &lt;1,1,1,0.5&gt; }
  }
</pre>

<p>As of version 3.7 experimental support for reading the pixel resolution of an image map was added. This is done by giving an image map pigment identifier to <code>max_extent()</code>, which will then return the resolution of the image map as the x and y values of the returned vector.</p>
<p>One usage of this feature would be when using an image as a background matte.</p>
<p>Example:</p>
<pre>
#declare MatteImage =
pigment {
  image_map {
    jpeg "YourImage.jpg"
    once
    }
  };

#declare Resolution = max_extent ( MatteImage );

box { 0, Resolution
  pigment { MatteImage  }
  // avoid the scale by warning (z direction)
  #declare Resolution = Resolution + &lt;0, 0, 1&gt;;
  // some scale factor to fit your needs
  scale Resolution*ScaleFactor
  }
</pre> 
<p><code>trace(OBJECT_IDENTIFIER, A, B, [VECTOR_IDENTIFIER])</code>.
<code>trace</code> helps you finding the exact location of a ray intersecting
with an object's surface. It traces a ray beginning at the point <code>A</code>
in the direction specified by the vector <code>B</code>. If the ray
hits the specified object, this function returns the coordinate where the ray intersected
the object. If not, it returns <code>&lt;0,0,0&gt;</code>. If a fourth parameter in the
form of a vector identifier is provided, the normal of the object at the intersection
point (not including any normal perturbations due to textures) is stored into that vector.
If no intersection was found, the normal vector is reset to <code>&lt;0,0,0&gt;</code>.</p>

<p class="Note"><strong>Note:</strong> Checking the normal vector for
<code>&lt;0,0,0&gt;</code> is the only reliable way to determine whether an
intersection has actually occurred, intersections can and do occur anywhere,
including at <code>&lt;0,0,0&gt;</code>.</p>

<p>Example:</p>
<pre>
#declare MySphere = sphere { &lt;0, 0, 0&gt;, 1 } 
#declare Norm = &lt;0, 0, 0&gt;; 
#declare Start = &lt;1, 1, 1&gt;; 
#declare Inter= 
trace ( MySphere, Start, &lt;0, 0, 0&gt;-Start, Norm ); 

object { 
  MySphere 
  texture { 
    pigment { rgb 1} 
    } 
  } 

#if (vlength(Norm)!=0) 
cylinder { 
  Inter, Inter+Norm, .1 
  texture { 
    pigment {color red 1} 
    } 
  } 
#end
</pre>


<p><code>vaxis_rotate(A,B,F)</code> Rotate <code>A</code> about <code>
B</code> by <code>F</code>. Given the x,y,z coordinates of a point in space
designated by the vector <code>A</code>, rotate that point about an arbitrary
axis defined by the vector <code>B</code>. Rotate it through an angle
specified in degrees by the float value <code>F</code>. The result is a
vector containing the new x,y,z coordinates of the point.</p>

<p><code>vcross(A,B)</code> Cross product of <code>A</code> and <code>B</code>. 
Returns a vector that is the vector cross product of the two vectors. The 
resulting vector is perpendicular to the two original vectors and its length 
is equal to the area of the parallelogram defined by them. Or to put in an 
other way, the cross product can also be formulated as:<em><code>
AxB = |A| * |B| * sin(angle(A,B)) * perpendicular_unit_vector(A,B)
</code></em> So the length of the resulting vector is proportional to the sine of the
angle between <code>A</code> and <code>B</code>. See the animated demo 
scene <code>VECT2.POV</code> for an illustration.</p>

<p><code>vnormalize(A)</code> Normalize vector <code>A</code>. Returns a unit
length vector that is the same direction as <code>A</code>. Formula is <em>
vnormalize(A)=A/vlength(A)</em>.</p>
<p class="Warning"><strong>Warning:</strong> Using <code>vnormalize(&lt;0,0,0&gt;)</code>
will result in an error.</p>

<p><code>vrotate(A,B)</code> Rotate <code>A</code> about origin by <code>
B</code>. Given the x,y,z coordinates of a point in space designated by the
vector <code>A</code>, rotate that point about the origin by an amount
specified by the vector <code>B</code>. Rotate it about the x-axis by an
angle specified in degrees by the float value <code>B.x</code>. Similarly
<code>B.y</code> and <code>B.z</code> specify the amount to rotate in
degrees about the y-axis and z-axis. The result is a vector containing the
new x,y,z coordinates of the point.</p>

<p><code>vturbulence(Lambda, Omega, Octaves, A)</code> Turbulence vector at A. Given the
x,y,z coordinates of a point in space designated by the vector A, return the
turbulence vector for that point based on the numbers given for Lambda,
Omega and Octaves. For the meaning of the parameters, check out the Lambda,
Omega and Octaves sections.<br> 
The amount of turbulence can be controlled by
multiplying the turbulence vector by a multiple. The frequency at which the
turbulence vector changes can be controlled by multiplying A with a
multiple. The turbulence vector returned by the function can be added to the
original point A to obtain a turbulated version of the point A. Example :<br>
<code>#declare MyVector = MyVector + Amount * vturbulence(2, 0.5, 6, MyVector * Frequency);</code></p>

<p>See section <a href="r3_3.html#r3_3_1_5_4">Float Functions</a> for other functions which are somewhat vector-related but which return floats. In addition to the above built-in functions, you may also define your own functions using the <code>#macro</code> directive. See the section <a href="r3_3.html#r3_3_2_8">User Defined Macros</a> for more details.</p>

</div>
<a name="r3_3_1_6_6"></a>
<div class="content-level-h5" contains="Built-in Constants" id="r3_3_1_6_6">
<h5>3.3.1.6.6 Built-in Constants</h5>
<p>There are several built-in vector identifiers. You can use them to specify
values or to create expressions but you cannot re-declare them to change
their values. They are:</p>
<pre>
VECTOR_BUILT-IN_IDENT:
  x | y | z | t | u | v
</pre>

<p>All built-in vector identifiers never change value. They are defined as
though the following lines were at the start of every scene.</p>
<pre>
#declare x = &lt;1, 0, 0&gt;;
#declare y = &lt;0, 1, 0&gt;;
#declare z = &lt;0, 0, 1&gt;;
#declare t = &lt;0, 0, 0, 1&gt;;
#declare u = &lt;1, 0&gt;;
#declare v = &lt;0, 1&gt;;
</pre>

<p>The built-in vector identifiers <code>x</code>, <code>y</code>, and <code>
z</code> provide much greater readability for your scene files when used in
vector expressions. For example....</p>
<pre>
plane { y, 1}             // The normal vector is obviously &quot;y&quot;.
plane { &lt;0,1,0&gt;, 1} // This is harder to read.
translate 5*x             // Move 5 units in the &quot;x&quot; direction.
translate &lt;5,0,0&gt;   // This is less obvious.
</pre>

<p>An expression like <code>5*x</code> evaluates to <code>
5*&lt;1,0,0&gt;</code> or <code>&lt;5,0,0&gt;</code>.</p>
<p>
Similarly <code>u</code> and <code>v</code> may be used in 2D vectors. When
using 4D vectors you should use <code>x</code>, <code>y</code>, <code>
z</code>, and <code>t</code> and POV-Ray will promote <code>x</code>, <code>
y</code>, and <code>z</code> to 4D when used where 4D is required.</p></div>

<a name="r3_3_1_7"></a>
<div class="content-level-h4" contains="Color Expressions" id="r3_3_1_7">
<h4>3.3.1.7 Color Expressions</h4>
<pre>
COLOR:
    COLOR_BODY             |
    color COLOR_BODY       | (this means the keyword color or
    colour COLOR_BODY        colour may optionally precede any color specification)
COLOR_BODY:
    COLOR_VECTOR           |
    COLOR_KEYWORD_GROUP    |
    COLOR_IDENTIFIER
COLOR_VECTOR:
    rgb &lt;3_Term_Vector&gt;    |
    rgbf &lt;4_Term_Vector&gt;   |
    rgbt &lt;4_Term_Vector&gt;   |
    [ rgbft ] &lt;5_Term_Vector&gt; |
    srgb &lt;3_Term_Vector&gt;   |
    srgbf &lt;4_Term_Vector&gt;  |
    srgbt &lt;4_Term_Vector&gt;  |
    srgbft &lt;5_Term_Vector&gt;
COLOR_KEYWORD_GROUP:
    [ COLOR_KEYWORD_ITEM ]...
COLOR_KEYWORD_ITEM:
    COLOR_IDENTIFIER       |
    red Red_Amount         |
    blue Blue_Amount       |
    green Green_Amount     |
    filter Filter_Amount   |
    transmit Transmit_Amount
</pre>

<p class="Note"><strong>Note:</strong> <em>COLOR_IDENTIFIERS</em> are identifiers previously declared to
have color values. The 3, 4, and 5 term vectors are usually vector literals
but may be vector expressions or floats promoted to vectors. See
<a href="r3_3.html#r3_3_1_6_4">Operator Promotion</a> and the sections below.</p>

<p>POV-Ray often requires you to specify a color. Colors consist of five
values or color components. The first three are called <code>red</code>,
<code>green</code>, and <code>blue</code>. They specify the intensity of the
primary colors red, green and blue using an additive color system like the
one used by the red, green and blue color phosphors on a color monitor.</p>
<p>
The 4th component, called <code>filter</code>, specifies the amount of
filtered transparency of a substance. Some real-world examples of filtered
transparency are stained glass windows or tinted cellophane. The light
passing through such objects is tinted by the appropriate color as the
material selectively absorbs some frequencies of light while allowing others
to pass through. The color of the object is subtracted from the light passing
through so this is called subtractive transparency.</p>

<p>The 5th component, called <code>transmit</code>, specifies the amount of
non-filtered light that is transmitted through a surface. Some real-world
examples of non-filtered transparency are thin see-through cloth, fine mesh
netting and dust on a surface. In these examples, all frequencies of light
are allowed to pass through tiny holes in the surface. Although the amount of
light passing through is diminished, the color of the light passing through
is unchanged. </p>

<p>The color of the object and the color transmitted through the object
together contribute 100% of the final color. So if <code>transmit</code> is set to 0.9,
the transmitted color contributes 90% and the color of the object
contributes only 10%. This is also true outside of the 0-1 range, so for
example if <code>transmit</code> is set to 1.7, the transmitted color contributes with
170% and the color of the object contributes with minus 70%. Using <code>transmit</code>
values outside of the 0-1 range can be used to create interesting special
effects, but does not correspond to any phenomena seen in the real world.
An example:</p>

<pre>
camera {location -2.5*z look_at 0 orthographic}

box {
  0,1
  texture {
    pigment {
    gradient y
      colour_map {
        [0, red 1]
        [1, blue 1]
        }
      }
    finish{ambient 1}
    }
  texture {
    pigment {
    gradient x
      colour_map {
        [0, rgb 0.5 transmit -3]
        [1, rgb 0.5 transmit  3]
        }
      }
    finish{ambient 1}
    }
  translate &lt;-0.5,-0.5,0&gt;
  scale &lt;3,2,1&gt;
  }
</pre>

<p>When using the <code>transmit</code> value for special effects, you can visualize it this way:
The <code>transmit</code> value means <em>contrast</em>. 1.0 is no change in contrast, 0.5 is
half contrast, 2.0 is double contrast and so on. You could say that
<code>transmit</code> <em>scales</em> the colors. The color of the object is the <em>center value</em>.
All colors will get closer to the center value if <code>transmit</code> is between 0
and 1, and all colors will spread away from the center value if <code>transmit</code>
is greater than 1. If <code>transmit</code> is negative the colors will be inverted
around the center value. Rgb 0.5 is common to use as center value, but
other values can be used for other effects. The center value really is a
color, and non-gray colors can be used for interesting effects. The red,
green and blue components are handled separately.</p>

<p class="Note"><strong>Note:</strong> Earlier versions of POV-Ray used the
keyword <code>alpha</code> to
specify filtered transparency. However that word is often used to describe
non-filtered transparency. For this reason <code>alpha</code> is no longer
used.</p>
<p>
Each of the five components of a color are float values which are normally
in the range between 0.0 and 1.0. However any values, even negatives may be
used.</p>
<p>
Under most circumstances the keyword <code>color</code> is optional and may
be omitted. We also support the British or Canadian spelling <code>
colour</code>. Colors may be specified using vectors, keywords with floats or
identifiers. You may also create very complex color expressions from
combinations of any of these using various familiar operators. The syntax for
specifying a color has evolved since POV-Ray was first released. We have
maintained the original keyword-based syntax and added a short-cut vector
notation. Either the old or new syntax is acceptable however the vector
syntax is easier to use when creating color expressions.</p>
<p>
The syntax for combining color literals into color expressions is almost
identical to the rules for vector and float expressions. In the syntax for
vector expressions, some of the syntax items are defined in the section
for float expressions. See <a href="r3_3.html#r3_3_1_5">Float Expressions</a> for those
definitions. Detailed explanations of color-specific issues are given in the
following sub-sections.</p>

</div>
<a name="r3_3_1_7_1"></a>
<div class="content-level-h5" contains="Color Vectors" id="r3_3_1_7_1">
<h5>3.3.1.7.1 Color Vectors</h5>
<p>The syntax for a color vector is...</p>
<pre>
COLOR_VECTOR:
  rgb &lt;3_Term_Vector&gt;   |
  rgbf &lt;4_Term_Vector&gt;  |
  rgbt &lt;4_Term_Vector&gt;  |
  [ rgbft ] &lt;5_Term_Vector&gt;
</pre>

<p>...where the vectors are any valid vector expressions of 3, 4 or 5
components. For example</p>
<pre>
color rgb &lt;1.0, 0.5, 0.2&gt;
</pre>

<p>This specifies a color whose red component is 1.0 or 100% of full
intensity. The green component is 0.5 or 50% of full intensity and the blue
component is 0.2 or 20% of full intensity. Although the filter and transmit
components are not explicitly specified, they exist and are set to their
default values of 0 or no transparency.</p>
<p>

The <code>rgbf</code> keyword requires a four component vector. The 4th
component is the filter component and the transmit component defaults to
zero. Similarly the <code>rgbt</code> keyword requires four components where
the 4th value is moved to the 5th component which is transmit and then the
filter component is set to zero.</p>
<p>
The <code>rgbft</code> keyword allows you to specify all five components.
Internally in expressions all five are always used.</p>
<p>
Under some circumstances, if the vector expression is a 5 component
expression or there is a color identifier in the expression then the <code>
rgbft</code> keyword is optional.</p>

</div>
<a name="r3_3_1_7_2"></a>
<div class="content-level-h5" contains="sRGB Colors" id="r3_3_1_7_2">
<h5>3.3.1.7.2 sRGB Colors</h5>
<p>
While POV-Ray will normally expect colors to be expressed in whatever <em><a href="t2_3.html#t2_3_4_5">working gamma space</a></em> you have set via <code>assumed_gamma</code>, as of version 3.7 the <code>srgb</code>,  <code>srgbf</code>, <code>srgbt</code> and <code>srgbft</code> keywords have been added to specify colors encoded according to the sRGB standard (roughly corresponding to a display gamma pre-correction of 2.2). Using these keywords instead of <code>rgb</code>, <code>rgbf</code>, <code>rgbt</code> or <code>rgbft</code>, respectively, instructs POV-Ray to automatically convert the color components to the working gamma space, being approximately equivalent to:</p>
<pre>
Effective_Red_Amount      = pow ( Red_Amount,   2.2/AssumedGamma )
Effective_Green_Amount    = pow ( Green_Amount, 2.2/AssumedGamma )
Effective_Blue_Amount     = pow ( Blue_Amount,  2.2/AssumedGamma )
Effective_Filter_Amount   = Filter_Amount
Effective_Transmit_Amount = Transmit_Amount
</pre>
<p class="Note"><strong>Note:</strong> Defining sRGB colors <em>before</em> <code>assumed_gamma</code> has been set will halt parsing and issue a warning.</p> 
<p>The syntax is primarily intended for convenience when working with a physically accurate <code>assumed_gamma</code> of 1.0, as many people find this way of specifying colors more intuitive (for instance a value of about <code>srgb 0.5</code> is commonly perceived as a medium grey, despite having an actual brightness of no more than 21.4%), and most image processing software and tools also use gamma pre-corrected colours in their user interface; while those may use slightly different color spaces, sRGB is a good approximation, and also has the advantage of being the official recommendation for the World Wide Web.</p>
<p class="Note"><strong>Note:</strong> Colors specified this way are not a different flavor of colors, but are rather converted <em>on the fly</em> to linear color values. When interpreting such values as a vector or accessing individual components, you will get the linear values rather than the pre-corrected values you originally specified.</p>
<p>
For instance, the following color statements are all fully equivalent (except for rounding errors):</p>
<pre>
#declare Foo = color srgbt &lt;51,76,102,127&gt;/255;
#debug concat("&lt;",vstr(5,Foo,",",0,3),"&gt;\n")
#declare Foo = color srgbt &lt;0.2, 0.3, 0.4, 0.5&gt;;
#debug concat("&lt;",vstr(5,Foo,",",0,3),"&gt;\n")
#declare Foo = color srgb &lt;0.2, 0.3, 0.4&gt; transmit 0.5;
#debug concat("&lt;",vstr(5,Foo,",",0,3),"&gt;\n")
#declare Foo = color rgbt &lt;0.033,0.073,0.133,0.5&gt;;
#debug concat("&lt;",vstr(5,Foo,",",0,3),"&gt;\n")
</pre>
<p class="Note"><strong>Note:</strong> The <code>srgb</code>,  <code>srgbf</code>, <code>srgbt</code> and <code>srgbft</code> keywords do not affect the way filter or transmit components are interpreted; these are always expected to be linear.</p>

</div>
<a name="r3_3_1_7_3"></a>
<div class="content-level-h5" contains="Color Keywords" id="r3_3_1_7_3">
<h5>3.3.1.7.3 Color Keywords</h5>
<p>The older keyword method of specifying a color is still useful and many
users prefer it.</p>
<pre>
COLOR_KEYWORD_GROUP:
  [ COLOR_KEYWORD_ITEM ]...
  COLOR_KEYWORD_ITEM:
  COLOR_IDENTIFIER |
  red Red_Amount | blue Blue_Amount | green Green_Amount | 
  filter Filter_Amount | transmit Transmit_Amount
</pre>

<p>Although the <code>color</code> keyword at the beginning is optional, it
is more common to see it in this usage. This is followed by any of five
additional keywords <code>red</code>, <code>green</code>, <code>blue</code>,
<code>filter</code>, or <code>transmit</code>. Each of these component
keywords is followed by a float expression. For example</p>
<pre>
color red 1.0 green 0.5
</pre>

<p>This specifies a color whose red component is 1.0 or 100% of full
intensity and the green component is 0.5 or 50% of full intensity. Although
the blue, filter and transmit components are not explicitly specified, they
exist and are set to their default values of 0. The component keywords may be
given in any order and if any component is unspecified its value defaults to
zero. A <em>COLOR_IDENTIFIER</em> can also be specified but it should always
be first in the group. See <a href="r3_3.html#r3_3_1_7_6">Common Color Pitfalls</a> for details.</p>

</div>
<a name="r3_3_1_7_4"></a>
<div class="content-level-h5" contains="Color Identifiers" id="r3_3_1_7_4">
<h5>3.3.1.7.4 Color Identifiers</h5>
<p>Color identifiers may be declared to make scene files more readable and to
parameterize scenes so that changing a single declaration changes many
values. An identifier is declared as follows.</p>
<pre>
COLOR_DECLARATION:
  #declare IDENTIFIER = COLOR; |
  #local IDENTIFIER = COLOR;
</pre>

<p>Where <em>IDENTIFIER</em> is the name of the identifier up to 40
characters long and <em>COLOR</em> is any valid specification.</p>
<p class="Note"><strong>Note:</strong> There should be a semi-colon at the
end of the declaration. If omitted, it generates a warning and some
macros may not work properly. See <a href="r3_3.html#r3_3_2_2_2">#declare vs. #local</a> for
information on identifier scope.</p>
<p>Here are some examples....</p>
<pre>
#declare White = rgb &lt;1,1,1&gt;;
#declare Cyan = color blue 1.0 green 1.0;
#declare Weird = rgb &lt;Foo*2,Bar-1,Bob/3&gt;;
#declare LightGray = White*0.8;
#declare LightCyan = Cyan red 0.6;
</pre>

<p>As the <code>LightGray</code> example shows you do not need any color
keywords when creating color expressions based on previously declared colors.
The last example shows you may use a color identifier with the keyword style
syntax. Make sure that the identifier comes first before any other component
keywords.</p>
<p>
Like floats and vectors, you may re-define colors throughout a scene but the
need to do so is rare.</p>

</div>
<a name="r3_3_1_7_5"></a>
<div class="content-level-h5" contains="Color Operators" id="r3_3_1_7_5">
<h5>3.3.1.7.5 Color Operators</h5>
<p>Color vectors may be combined in expressions the same as float or vector
values. Operations are performed on a component by component basis. For
example <code>rgb &lt;1.0,0.5,0.2&gt;*0.9</code> evaluates the same as <code>
rgb&lt;1.0,0.5,0.2&gt;*&lt;0.9,0.9,0.9&gt;</code> or <code>
rgb&lt;0.9,0.45,0.18&gt;</code>. Other operations are done on a similar
component by component basis.</p>
<p>
You may use the dot operator to extract a single component from a color.
Suppose the identifier <code>Shade</code> was previously defined as a color.
Then <code>Shade.red</code> is the float value of the red component of <code>
Shade</code>. Similarly <code>Shade.green</code>, <code>Shade.blue</code>,
<code>Shade.filter</code> and <code>Shade.transmit</code> extract the float
value of the other color components. <code>shade.gray</code> returns the gray value of the
color vector.</p>

</div>
<a name="r3_3_1_7_6"></a>
<div class="content-level-h5" contains="Common Color Pitfalls" id="r3_3_1_7_6">
<h5>3.3.1.7.6 Common Color Pitfalls</h5>
<p>The variety and complexity of color specification methods can lead to some
common mistakes. Here are some things to consider when specifying a
color.</p>
<p>
When using filter transparency, the colors which come through are multiplied
by the primary color components. For example if gray light such as <code>
rgb&lt;0.9,0.9,0.9&gt;</code> passes through a filter such as <code>
rgbf&lt;1.0,0.5,0.0,1.0&gt;</code> the result is <code>
rgb&lt;0.9,0.45,0.0&gt;</code> with the red let through 100%, the green cut
in half from 0.9 to 0.45 and the blue totally blocked. Often users mistakenly
specify a clear object by</p>
<pre>
color filter 1.0
</pre>

<p>but this has implied red, green and blue values of zero. You have just
specified a totally black filter so no light passes through. The correct way
is either</p>
<pre>
color red 1.0  green 1.0  blue 1.0  filter 1.0
</pre>

<p>or</p>
<pre>
color transmit 1.0
</pre>

<p>In the 2nd example it does not matter what the rgb values are. All of
the light passes through untouched. Another pitfall is the use of color
identifiers and expressions with color keywords. For example...</p>
<pre>
color My_Color red 0.5
</pre>

<p>this substitutes whatever was the red component of <code>My_Color</code>
with a red component of 0.5 however...</p>
<pre>
color My_Color + red 0.5
</pre>

<p>adds 0.5 to the red component of <code>My_Color</code> and even less
obvious...</p>
<pre>
color My_Color * red 0.5
</pre>

<p>that cuts the red component in half as you would expect but it also
multiplies the green, blue, filter and transmit components by zero! The part
of the expression after the multiply operator evaluates to <code>
rgbft&lt;0.5,0,0,0,0&gt;</code> as a full 5 component color.</p>
<p>
The following example results in no change to <code>My_Color</code>.</p>
<pre>
color red 0.5 My_Color
</pre>

<p>This is because the identifier fully overwrites the previous value. When
using identifiers with color keywords, the identifier should be first.
Another issue to consider: some POV-Ray syntax allows full color
specifications but only uses the rgb part. In these cases it is legal to use
a float where a color is needed. For example:</p>
<pre>
finish { ambient 1 }
</pre>

<p>The <a href="r3_4.html#r3_4_6_3_1">ambient</a> keyword expects a color so the value <code>1</code> is
promoted to <code>&lt;1,1,1,1,1&gt;</code> which is no problem. However</p>
<pre>
pigment { color 0.4 }
</pre>

<p>is legal but it may or may not be what you intended. The <code>0.4</code>
is promoted to <code>&lt;0.4,0.4,0.4,0.4,0.4&gt;</code> with the filter and
transmit set to 0.4 as well. It is more likely you wanted...</p>
<pre>
pigment { color rgb 0.4 }
</pre>

<p>in which case a 3 component vector is expected. Therefore the <code>
0.4</code> is promoted to <code>&lt;0.4,0.4,0.4,0.0,0.0&gt;</code> with
default zero for filter and transmit. Finally there is another problem which
arises when using color dot operators in <code>#declare</code> or <code>#local</code> directives. Consider the directive:</p>
<pre>
#declare MyColor = rgb &lt;0.75, 0.5, 0.75&gt;;
#declare RedAmt = MyColor.red;
</pre>

<p>Now <code>RedAmt</code> should be a float but unfortunately it is a color.
POV-Ray looks at the first keyword after the equals to try to guess what type
of identifier you want. It sees the color identifier <code>MyColor</code>
and assumes you want to declare a color. It then computes the float value as
0.75 then promotes that into <code>
rgbft&lt;0.75,0.75,0.75,0.75,0.75&gt;</code>. It would take a major rewrite
to fix this problem so we are just warning you about it. Any of the
following work-arounds will work properly.</p>
<pre>
#declare RedAmt = 0.0+MyColor.red;
#declare RedAmt = 1.0*MyColor.red;
#declare RedAmt = (MyColor.red);
</pre></div>

<a name="r3_3_1_8"></a>
<div class="content-level-h4" contains="Function" id="r3_3_1_8">
<h4>3.3.1.8 Function</h4>
<p>Some objects allow you to specify functions that will be evaluated while rendering to determine the surface of these objects. In this respect functions are quite different to <a href="r3_3.html#r3_3_2_8">macros</a>, which are evaluated at parse time but do not otherwise affect rendering. Additionally you may call these functions anywhere a Float Function is allowed, even during parsing. The syntax is identical to Float Expressions, however, only float functions that apply to float values may be used. Excluded are for example <code><a href="r3_3.html#r3_3_1_5_4">strlen</a></code> or <code><a href="r3_3.html#r3_3_1_5_4">vlength</a></code>. You find a full list of supported float functions in the syntax definition below.</p>
<pre>
FLOAT:
  LOGIC_AND [OR LOGIC_AND]
OR:
  |
LOGIC_AND:
  REL_TERM [AND REL_TERM]
AND:
  &amp;REL_TERM:
  TERM [REL_OPERATOR TERM]
REL_OPERATOR:
  &lt; | &lt;= | &gt;= | &gt; | = | !=
TERM:
  FACTOR [SIGN FACTOR]
SIGN:
  + | -
FACTOR:
  MOD_EXPRESSION [MULT MOD_EXPRESSION]
MULT:
  * | /
  EXPRESSION:
  FLOAT_LITERAL         |
  FLOAT_IDENTIFIER      |
  FLOAT_FUNCTION        |
  FLOAT_BUILT-IN_IDENT  |
  FUNCTION_IDENTIFIER   |
  ( FLOAT )             |
  IDENTIFIER            |
  SIGN EXPRESSION
  FLOAT_FUNCTION:
  abs( FLOAT ) | acos( FLOAT ) | acosh( FLOAT ) | asin( FLOAT ) |
  asinh( FLOAT ) | atan( FLOAT) | atanh( FLOAT) |
  atan2( FLOAT , FLOAT ) | ceil( FLOAT ) | cos( FLOAT ) |
  cosh( FLOAT ) | degrees( FLOAT ) | exp( FLOAT ) |
  floor( FLOAT ) | int( FLOAT ) | ln (Float) | log( FLOAT ) |
  max( FLOAT , FLOAT, ... ) | min( FLOAT , FLOAT, ... ) |
  mod( FLOAT , FLOAT ) | pow( FLOAT , FLOAT ) |
  radians( FLOAT ) | sin( FLOAT ) | sinh( FLOAT ) |
  sqrt( FLOAT ) | tan( FLOAT ) | tanh( FLOAT ) |
  select( FLOAT , FLOAT , FLOAT [, FLOAT] )
FUNCTION_IDENTIFIER:
  #local FUNCTION_IDENTIFIER = function { FLOAT }               |
  #declare FUNCTION_IDENTIFIER = function { FLOAT }             |
  #local FUNCTION_IDENTIFIER = function(IDENT_LIST) { FLOAT }   |
  #declare FUNCTION_IDENTIFIER = function(IDENT_LIST) { FLOAT } |
  #local FUNCTION_IDENTIFIER = function{SPECIAL_FLOAT_FUNCTION} |
  #local VECTOR_IDENTIFIER = function{SPECIAL_VECTOR_FUNCTION}  |
  #local COLOR_IDENTIFIER = function { SPECIAL_COLOR_FUNCTION } |
IDENT_LIST:
  IDENT_ITEM [, IDENT_LIST]
IDENT_ITEM:
  x | y | z | u | v | IDENTIFIER
  (Note: x = u and y = v)
SPECIAL_FLOAT_FUNCTION:
  pattern { PATTERN_BLOCK }
SPECIAL_VECTOR_FUNCTION:
  TRANSFORMATION_BLOCK | SPLINE
SPECIAL_COLOR_FUNCTION:
  PIGMENT
PATTERN_BLOCK:
  PATTERN
</pre>

<p class="Note"><strong>Note:</strong> Only the above mentioned items can be used in user-defined functions.
For example the rand() function is not available.</p>

<p>All of the above mentioned float functions are described in the section
<a href="r3_3.html#r3_3_1_5_4">Float Functions</a>.</p>

</div>
<a name="r3_3_1_8_1"></a>
<div class="content-level-h5" contains="Sum and Product functions" id="r3_3_1_8_1">
<h5>3.3.1.8.1 Sum and Product functions</h5>
<table class="matte" width="390px" cellpadding="0" cellspacing="10">
<tr>
  <td width="240px">
    <!---<img src="ref_tex/sum.tex" alt="sum function">---><img class="left" width="45px" src="images/8/8e/RefImgSum.png">
  </td>
  <td>
    <code>sum(i, b, n, a)</code>
  </td>
</tr>
<tr>
  <td>
    <p class="caption">The sum function.</p>
  </td>
  <td></td>
</tr>
</table>
<p></p>
<table class="matte" width="390px" cellpadding="0" cellspacing="10">
<tr>
  <td>
    <code>prod(i, b, n, a)</code>
  </td>
  <td width="240px">
    <!---<img src="ref_tex/prod.tex" alt="product function">---><img class="left" width="45px" src="images/1/12/RefImgProd.png">
  </td>
</tr>
<tr>
  <td></td>
  <td>
    <p class="caption">The product function.</p>
  </td>
</tr>
</table>

<p>For both <code>prod</code> and <code>sum</code>: <code>i</code> is any variable name and <code>a</code> is any expression, usually depending on <code>i</code>. <code>b</code> and <code>n</code> are also any expression.</p>
<p class="Note"><strong>Note:</strong> Even though the following example demonstrates just one usage, <em>both</em> the <code>prod</code> and <code>sum</code> functions <em>require</em> a wrapper before use.</p>
<pre>
#declare factorial = function(C) { prod(i, 1, C, i) }
#declare A = factorial(5);
</pre>

<p>The first parameter is the name of the iteration variable. The second is the initial value expression and the third is the final value expression. Those may not depend on the iteration variable but the iteration variable may still be used inside those two expressions (because it happens to already have been defined) but its value is undefined. The last expression is the actual expression which will be iterated through. It may use any variable in scope.</p>

<p>The scope of an iteration variable is the sequence operation function. That is, a iteration variable is only defined when used inside the <code>sum/prod</code> function.  Of course <code>sum/prod</code> functions may be nested. However, there is one limit of a maximum of 56 local variable defined simultaneously, which essentially means that in any combination <code>sum/prod</code> functions cannot be nested deeper than 56 levels.</p>

<p>The iteration variable is incremented by one for each step, but its initial and final value may be any value. The iteration will be continued as long as the iteration value is less or equal to the final value.</p>

<p class="Note"><strong>Note:</strong> Because the iteration value is a floating-point variable, adding one will add a certain bias in a long iterations and thus the floating-point precision will be an issue in such a case and needs to be considered by allowing a reasonable error for the final value!</p>

<p>If the expression to be added has a negative sign it will of course in effect be substracted.  Thus changing the sign will allow to generate negative values in the sum function.  Equally multiplying by <code>1/expression</code> effectively creates a division when used in the prod function.</p>

<p>Obviously to work in the first place the initial value of the result is the neutral element of the operation.  That is, a sum calculation starts with <code>0</code> and a product calculation starts with <code>1</code> just like it is assumed in the sum and product functions in 'regular' math.</p>

<p>It should be noted that mathematically either sum or product are redundant because:</p>
<pre>
log10(prod(i, b, n, a)) = sum(i, b, n, log10(a))
</pre>
<p>
which implies a sum can be represented as a product and vice versa, observing
the usual mathematical constraints of logarithms, of course.  However, as
logarithms and their inverse (powers) are slow to compute both are provided...</p>

</div>
<a name="r3_3_1_8_2"></a>
<div class="content-level-h5" contains="Functions and Macros" id="r3_3_1_8_2">
<h5>3.3.1.8.2 Functions and Macros</h5>
<p>You can use macros in functions, but the macros will be called only once
when the function is defined, not every time the function is called. You
cannot pass function variables to the macros.</p>

<p>You can pass functions to macros, how to do this is best explained by an example:</p>
<pre>
#macro Foo( Bar, X )
#declare Y = Bar(X);
#declare Z = Bar(Y);
#end

#declare FUNC=function(n){n+2}

Foo(FUNC, 1)

#debug str(Y,5,5)
#debug &quot;n&quot;
#debug str(Z,5,5)
#debug &quot;n&quot;
</pre>

</div>
<a name="r3_3_1_8_3"></a>
<div class="content-level-h5" contains="Declaring User-Defined Float Functions" id="r3_3_1_8_3">
<h5>3.3.1.8.3 Declaring User-Defined Float Functions</h5>
<p>You declare a user defined function using the <code>#declare</code> or
<code>#local</code> directives.  By default a function takes three parameters
and you do not have to explicitly specify the parameter names. The default three
parameters are <code>x</code>, <code>y</code> and <code>z</code>. For
example:</p>

<pre>
#declare foo = function { x + y * z }
</pre>

<p>If you need fewer or more parameters you have to explicitly specify the
parameter list. </p>
<p class="Note"><strong>Note:</strong> The <code>x</code> and <code>u</code> as
well as <code>y</code> and <code>v</code> keywords are equivalent so you may not specify
both parameter names. You may not specify two or more parameters with the same
name either. Doing so may result in a parse error or undefined function results.
</p>
<p>The following are valid functions with parameters:</p>

<pre>
#declare foo2 = function(x, y, z) { x + y * z }
#declare foo3 = function(k1, k2, z, y) { x + y * z + k1 * y + k2 }
#declare foo4 = function(h) { h * h + h }
#declare foo4 = function(u, v) { x + y * v } //=u + v*v
#declare foo4 = function(x, v, z) { u + y * v + z } //=x + v*v + z
</pre>

<p><strong>Limits:</strong></p>
<ul>
<li>The minimum number of parameters per function is 1.</li>
<li>The maximum number of allowed parameters per function is 56.</li>
<li>The maximum number of <code>function</code> blocks per scene is 1048575.</li>
<li>The maximum number of operators per function is about 200000. Individual
limits will be different depending on the types of operators used
in the function.</li>
<li>The maximum depth for nesting functions is 1024.</li>
<li>The maximum number of constants in all functions 1048575.</li>
</ul>
<p class="Note"><strong>Note:</strong> Redeclaring functions, directly, is not allowed. The way to do
this is to <code>undef</code> it first.</p>

<p>There is one special float function type. You may declare a
<code>pattern</code> function.</p>
<p class="Note"><strong>Note:</strong> The syntax is identical to that of
patterns, however, you may not specify colors. Its result is always a float and
not a color vector, as returned by a function containing a pigment.</p>

<pre>
#declare foo = function {
  pattern {
    checker
    }
  }
</pre>

<p class="Note"><strong>Note:</strong> The number of parameters of special
function types is determined automatically, so you do not need to specify
parameter names.</p>

</div>
<a name="r3_3_1_8_4"></a>
<div class="content-level-h5" contains="Declaring User-Defined Vector Functions" id="r3_3_1_8_4">
<h5>3.3.1.8.4 Declaring User-Defined Vector Functions</h5>
<p>Right now you may only declare vector functions using one of the special
function types. Supported types are <code>transform</code> and
<code>spline</code> functions. For example:</p>

<pre>
#declare foo = function {
  transform {
    rotate &lt;90, 0, 0&gt;
    scale 4
    }
  }

#declare myvector = foo(4, 3, 7);

#declare foo2 = function {
  spline {
    linear_spline
    0.0, &lt;0,0,0&gt;
    0.5, &lt;1,0,0&gt;
    1.0, &lt;0,0,0&gt;
    }
  }

#declare myvector2 = foo2(0.7);
</pre>
<p>Function splines take the vector size into account. That is, a function
containing a spline with five components will also return a five component
vector (aka a color), a function containing a spline with two components will
only return a two component vector and so on.</p> 

<p class="Note"><strong>Note:</strong> The number of parameters of special
function types is determined automatically, so you do not need to specify
parameter names.</p>

</div>
<a name="r3_3_1_8_5"></a>
<div class="content-level-h5" contains="Declaring User-Defined Color Functions" id="r3_3_1_8_5">
<h5>3.3.1.8.5 Declaring User-Defined Color Functions</h5>
<p>Right now you may only declare color functions using one of the special
function types. The only supported type is the <code>pigment</code> function.
You may use every valid <code>pigment</code>. This is a very simple example:</p>

<pre>
#declare foo = function {
  pigment {
    color red 1
    }
  }

#declare Vec = foo(1,2,3)
</pre>

<p> An example using a pattern:</p>
<pre>
#declare foo = function {
  pigment {
    crackle
    color_map {
      [0.3, color Red]
      [1.0, color Blue]
      }
    }
  }

#declare Val = foo(2,3,4).gray
</pre>

<p class="Note"><strong>Note:</strong> The number of parameters of special function types is determined
automatically, so you do not need to specify parameter names.</p>
</div>
<a name="r3_3_1_8_6"></a>
<div class="content-level-h5" contains="Internal Pre-Defined Functions" id="r3_3_1_8_6">
<h5>3.3.1.8.6 Internal Pre-Defined Functions</h5>
<p>Several functions are pre-defined. These internal functions can be accessed through
the <code>functions.inc</code>, so it should be included in your scene. The number of required parameters and what they control are also given in the include
file. See the <a href="r3_4.html#r3_4_9_1_7">functions.inc</a> chapter in the Standard Include File section gives more information.</p></div>

<a name="r3_3_1_9"></a>
<div class="content-level-h4" contains="Strings" id="r3_3_1_9">
<h4>3.3.1.9 Strings</h4>
<p>The POV-Ray language requires you to specify a string of characters to be
used as a file name, text for messages or text for a text object. Strings may
be specified using literals, identifiers or functions which return string
values. See <a href="r3_3.html#r3_3_1_9_4">String Functions</a>
for details on string functions. Although you cannot build string expressions
from symbolic operators such as are used with floats, vectors or colors, you
may perform various string operations using string functions. Some applications
of strings in POV-Ray allow for non-printing formatting characters such as
newline or form-feed.</p>
<pre>
STRING:
  STRING_FUNCTION   |
  STRING_IDENTIFIER |
  STRING_LITERAL STRING_LITERAL:
  &quot;up to 256 ASCII characters&quot;
STRING_REL_TERM:
  STRING_LITERAL [STRING_REL_OPERATOR STRING_LITERAL]...
  STRING_REL_OPERATOR:
  &lt; | &lt;= | = | &gt;= | &gt; | !=
STRING_FUNCTION:
  str( FLOAT , INT , INT ) |
  concat( STRING , STRING , [STRING ,...]) | chr( INT ) |
  substr( STRING , INT , INT ) | strupr( STRING ) | 
  strlwr( STRING ) | vstr( INT, VECTOR, STRING, INT, INT )
</pre>

</div>
<a name="r3_3_1_9_1"></a>
<div class="content-level-h5" contains="String Literals" id="r3_3_1_9_1">
<h5>3.3.1.9.1 String Literals</h5>
<p>String literals begin with a double quote mark '&quot;' which is followed by up to 256 characters and are terminated by another double quote mark. You can change the character set of strings using the <code>global_settings</code> <code><a href="r3_4.html#r3_4_1_6">charset</a></code> option. The following are all valid string literals:</p>

<p>&quot;Here&quot; &quot;There&quot; &quot;myfile.gif&quot; &quot;textures.inc&quot;</p>

<p class="Note"><strong>Note:</strong> If you need to specify a quote mark in
a string literal you must precede it with a backslash.</p>
<p>Example</p>

<pre> &quot;Joe said \&quot;Hello\&quot; as he walked in.&quot;</pre>

<p>is converted to</p>

<pre> Joe said &quot;Hello&quot; as he walked in.</pre>

<p>If you need to specify a backslash, you will have to specify two. For example:</p>

<pre> &quot;This is a backslash \\ and this is two \\\\&quot;</pre>

<p>Is converted to:</p>

<pre>This is a backslash \ and this is two \\</pre>

<p>Windows users need to be especially wary about this as the backslash is also the
windows path separator. For example, the following code does not produce the intended
result:</p>

<pre>
#declare DisplayFont = &quot;c:\windows\fonts\lucon.ttf&quot;
  text { ttf DisplayFont &quot;Hello&quot;, 2,0 translate y*1.50 }
</pre>

<p>New users might expect this to create a text object using the font
<em>c:\windows\fonts\lucon.ttf</em>. Instead, it will give an error message saying
that it cannot find the font file <em>c:windowsontslucon.ttf</em>.</p>

<p>The correct form of the above code is as follows:</p>

<pre>
#declare DisplayFont = &quot;c:\\windows\\fonts\\lucon.ttf&quot;
  text { ttf DisplayFont &quot;Hello&quot;, 2,0 translate y*1.50 }
</pre>

<p>The escaping of backslashes occurs in all POV-Ray string literals. There are also
other formatting codes such as <code>\n</code> for new line.
See <a href="r3_3.html#r3_3_2_7_2">Text Formatting</a> for details.</p>

</div>
<a name="r3_3_1_9_2"></a>
<div class="content-level-h5" contains="String Identifiers" id="r3_3_1_9_2">
<h5>3.3.1.9.2 String Identifiers</h5>
<p>String identifiers may be declared to make scene files more readable and
to parameterize scenes so that changing a single declaration changes many
values. An identifier is declared as follows.</p>
<pre>
STRING_DECLARATION:
  #declare IDENTIFIER = STRING |
  #local IDENTIFIER = STRING
</pre>

<p>Where <em>IDENTIFIER</em> is the name of the identifier up to 40
characters long and <em>STRING</em> is any valid string specification.</p>
<p class="Note"><strong>Note:</strong> Unlike floats, vectors, or colors,
there need not be a semi-colon at the end of the declaration. 
See <a href="r3_3.html#r3_3_2_2_2">#declare vs. #local</a> 
for information on identifier scope.</p>
<p>Here are some examples...</p>
<pre>
#declare Font_Name = &quot;ariel.ttf&quot;
#declare Inc_File = &quot;myfile.inc&quot;
#declare Name = &quot;John&quot;
#declare Name = concat(Name,&quot; Doe&quot;)
</pre>

<p>As the last example shows, you can re-declare a string identifier and may
use previously declared values in that re-declaration.</p>

</div>
<a name="r3_3_1_9_3"></a>
<div class="content-level-h5" contains="String Relational Operators" id="r3_3_1_9_3">
<h5>3.3.1.9.3 String Relational Operators</h5>
<p>POV-Ray supports the following string relational operators: <code><strong>&lt;</strong> <strong>&lt;=</strong> <strong>=</strong> <strong>&gt;=</strong> <strong>&gt;</strong> <strong>!=</strong></code> and are subject to standard ASCII collating sequence rules.</p>
<p class="Note"><strong>Note:</strong> These relational operators are nothing more than a <em>shortcut</em> as they are an equivalent to calling the <code><a href="r3_3.html#r3_3_1_5_4">strcmp()</a></code> function.</p>
<p>For example:</p>
<pre>
#if (string1 = string2)
  #declare Color = pigment {rgb &lt;0, 1, 0&gt;};
#else
  #declare Color = pigment {rgb &lt;1, 0, 0&gt;};
#end
</pre>
<p>Is the same as:</p>
<pre>
#if (strcmp(string1, string2) = 0)
  #declare Color = pigment {rgb &lt;0, 1, 0&gt;};
#else
  #declare Color = pigment {rgb &lt;1, 0, 0&gt;};
#end
</pre>
<p>This simple example shows just one usage:</p>
<pre>
// perspective (default) camera
camera {
  location  &lt;0.0, 2.0, -5.0&gt;
  look_at   &lt;0.0, 0.0, 0.0&gt;
  right     x*image_width/image_height
}

// create a regular point light source
light_source {
  0*x                  // light's position (translated below)
  color rgb &lt;1,1,1&gt;    // light's color
  translate &lt;0, 20, -20&gt;
}

background {rgb 1}

#declare TestCase = "ABC";

#if (TestCase &lt; "ABD")
  #declare Color = pigment {rgb &lt;0, 1, 0&gt;};
#else
  #declare Color = pigment {rgb &lt;1, 0, 0&gt;};
#end

sphere {0,1 pigment {Color}}
</pre>

</div>
<a name="r3_3_1_9_4"></a>
<div class="content-level-h5" contains="String Functions" id="r3_3_1_9_4">
<h5>3.3.1.9.4 String Functions</h5>
<p>POV-Ray defines a variety of built-in functions for manipulating floats,
vectors and strings. Function calls consist of a keyword which specifies the
name of the function followed by a parameter list enclosed in parentheses.
Parameters are separated by commas. For example:</p>

<pre>
keyword(param1,param2)
</pre>

<p>The following are the functions which return string values. They take one
or more float, integer, vector, or string parameters. Assume that <code>
A</code> is any valid expression that evaluates to a float; <code>B</code>,
<code>L</code>, and <code>P</code> are floats which are truncated to integers
internally, <code>S</code>, <code>S1</code>, <code>S2</code> etc are
strings.</p>

<p> <code>chr(B)</code> Character whose character value is 
<code>B</code>. Returns a single character string. The character value of the
character is specified by an integer <code>B</code> which must be in the 
range 0 to 65535 if you specified <code>charset utf8</code> in the 
<code>global_settings</code> and 0 to 127 if you specified <code>charset 
ascii</code>. Refer to your platform specific documentation if you specified 
<code>charset sys</code>. For example <code>chr(70)</code> is the string 
&quot;F&quot;. When rendering text objects you should be aware that the 
characters rendered are dependent on the (TTF) font being used.</p>

<p><code>concat(S1,S2,...)</code> concatenates strings <code>S1</code> and
<code>S2</code>. Returns a string that is the concatenation of all parameter
strings. Must have at least 2 parameters but may have more. For example:</p>

<pre>
concat(&quot;Value is &quot;, str(A,3,1), &quot; inches&quot;)
</pre>

<p>If the float value <code>A</code> was <code>12.34321</code> the result is
&quot;<code>Value is 12.3 inches</code>&quot;, which is a string.</p>

<p><code>datetime()</code> Can be used to return the date and time. It's syntax is:</p>

<pre>
datetime(FLOAT [,STRING])
</pre>

<p>when FLOAT uses the keyword <code>now</code> it will return a string which evaluates to the time elapsed since 2000-01-01, 00:00:00 GMT in days, with a precision of seconds or better. For example:</p>

<pre>
datetime(now)
</pre>

<p>The optional STRING parameter should conform to the same formatting as that of the <em>strftime()</em> C function.</p>
<p>The default for the STRING parameter format is <code>%Y-%m-%d %H:%M:%SZ</code></p>

<p><code>str(A,L,P)</code> Convert float A to a formatted string. Returns a
formatted string representation of float value <code>A</code>. The integer
parameter <code>L</code> specifies the minimum length of the string and the
type of left padding used if the string's representation is shorter than
the minimum. If <code>L</code> is positive then the padding is with blanks.
If <code>L</code> is negative then the padding is with zeros. The overall
minimum length of the formatted string is <em>abs(L)</em>. If the string
needs to be longer, it will be made as long as necessary to represent the
value.</p>
<p>
The integer parameter <code>P</code> specifies the number of digits after
the decimal point. If <code>P</code> is negative then a compiler-specific
default precision is use. Here are some examples:</p>

<pre>
str(123.456, 0, 3) &quot;123.456&quot;
str(123.456, 4, 3) &quot;123.456&quot;
str(123.456, 9, 3) &quot;  123.456&quot;
str(123.456,-9, 3) &quot;00123.456&quot;

str(123.456, 0, 2) &quot;123.46&quot;
str(123.456, 0, 0) &quot;123&quot;
str(123.456, 5, 0) &quot;  123&quot;
str(123.000, 7, 2) &quot; 123.00&quot;

str(123.456, 0,-1) &quot;123.456000&quot; (platform specific)
</pre>

<p><code>strlwr(S)</code> Lower case of <code>S</code>. Returns a new string
in which all upper case letters in the string S1 are converted to lower case.
The original string is not affected. For example <code>strlwr(&quot;Hello
There!&quot;)</code> results in &quot;hello there!&quot;.</p>
<p>

<code>substr(S,P,L)</code> Sub-string from <code>S</code>. Returns a string
that is a subset of the characters in parameter <code>S</code> starting at
the position specified by the integer value <code>P</code> for a length
specified by the integer value <code>L</code>. For example <code>
substr(&quot;ABCDEFGHI&quot;,4,2)</code> evaluates to the string
&quot;DE&quot;. If <em>P+L-1&gt;strlen(S)</em> an error occurs.</p>
<p>

<code>strupr(S)</code> Upper case of <code>S</code>. Returns a new string
in which all lower case letters in the string <code>S</code> are converted to
upper case. The original string is not affected. For example <code>
strupr(&quot;Hello There!&quot;)</code> results in &quot;HELLO
THERE!&quot;.</p>

<p><code>vstr(N,A,S,L,P)</code> Convert vector A to a formatted string. Returns a
formatted string representation of vector <code>A</code> where the elements of 
the vector are separated by the string parameter <code>S</code>. The integer 
parameter <code>N</code> specifies the amount of dimensions in vector <code>A</code>. 
<code>N</code> is autoclipped to the range of 2 to 5, without warning. Specifying a 
vector <code>A</code> with more dimensions than given by <code>N</code> will result 
in an error.</p>
<p>The integer parameter <code>L</code> specifies the minimum length of the string and the
type of left padding used if the string's representation is shorter than
the minimum. The integer parameter <code>P</code> specifies the number of digits after
the decimal point. If <code>P</code> is negative then a compiler-specific
default precision is use. The function of <code>L</code> and <code>P</code> is the 
same as in <code>str</code>. Here are some examples:</p>

<pre>
vstr(2, &lt;1,2&gt;, &quot;, &quot;, 0,1)         &quot;1.0, 2.0&quot;
vstr(5, &lt;1,2,3,4,5&gt;, &quot;, &quot;, 0,1)   &quot;1.0, 2.0, 3.0, 4.0, 5.0&quot;
vstr(1, 1, &quot;, &quot;, 0,1)             &quot;1.0, 1.0&quot;
vstr(2, 1, &quot;, &quot;, 0,1)             &quot;1.0, 1.0&quot;
vstr(5, 1, &quot;, &quot;, 0,1)             &quot;1.0, 1.0, 1.0, 1.0, 1.0&quot;
vstr(7, 1, &quot;, &quot;, 0,1)             &quot;1.0, 1.0, 1.0, 1.0, 1.0&quot;
vstr(3, &lt;1,2&gt;, &quot;, &quot;, 0,1)         &quot;1.0, 2.0, 0.0&quot;
vstr(5, &lt;1,2,3&gt;, &quot;, &quot;, 0,1)       &quot;1.0, 2.0, 3.0, 0.0, 0.0&quot;
vstr(3, &lt;1,2,3,4&gt;, &quot;, &quot;, 0,1)     error
</pre>

<p> See section <a href="r3_3.html#r3_3_1_5_4">Float Functions</a> for other functions which are
somewhat string-related but which return floats. In addition to the above
built-in functions, you may also define your own functions using the
<code><a href="r3_3.html#r3_3_2_8_1">#macro</a></code> directive. See the section
<a href="r3_3.html#r3_3_2_8">User Defined Macros</a> for more details.</p>

</div>
<a name="r3_3_1_9_5"></a>
<div class="content-level-h5" contains="Built-in Variables" id="r3_3_1_9_5">
<h5>3.3.1.9.5 Built-in Variables</h5>
<p>At the moment there is only one built-in string variable. You can use it to specify values or to create expressions but you cannot re-declare it to change it's value.</p>

<p>File-related are:</p>
<pre>
STRING_BUILT-IN_IDENT:
  input_file_name
</pre>

<p><code>input_file_name</code><br>The name of the scene input file.</p></div>

<a name="r3_3_1_10"></a>
<div class="content-level-h4" contains="Array" id="r3_3_1_10">
<h4>3.3.1.10 Array</h4>
<p>You may declare arrays of identifiers of up to five dimensions. Any
item that can be declared as an identifier can be declared in an array.</p>

</div>
<a name="r3_3_1_10_1"></a>
<div class="content-level-h5" contains="Declaring Arrays" id="r3_3_1_10_1">
<h5>3.3.1.10.1 Declaring Arrays</h5>
<p>The syntax for declaring an array is as follows:</p>
<pre>
ARRAY_DECLARATION:
  #declare IDENTIFIER = array[ INT ][[ INT ]]..[ARRAY_INITIALIZER] |
  #local IDENTIFIER = array[ INT ][[ INT ]]..[ARRAY_INITIALIZER]
ARRAY_INITIALIZER:
  {ARRAY_ITEM, [ARRAY_ITEM, ]... }
ARRAY_ITEM:
  RVALUE | ARRAY_INITIALIZER
</pre>

<p>Where IDENTIFIER is the name of the identifier up to 40 characters long
and INT is a valid float expression which is internally truncated to an
integer which specifies the size of the array. The optional <em>
ARRAY_INITIALIZER</em> is discussed in the next section <a href="r3_3.html#r3_3_1_10_2">Array Initializers</a>.
Here is an example of a one-dimensional, uninitialized array.</p>
<pre>
#declare MyArray = array[10]
</pre>

<p>This declares an uninitialized array of ten elements. The elements are
referenced as <code>MyArray[0]</code> through <code>MyArray[9]</code>. As
yet, the type of the elements are undetermined. Once you have initialized any
element of the array, all other elements can only be defined as that type. An
attempt to reference an uninitialized element results in an error. For
example:</p>
<pre>
#declare MyArray = array[10]
#declare MyArray[5] = pigment{White}     //all other elements must 
                                         //be pigments too.
#declare MyArray[2] = normal{bumps 0.2}  //generates an error
#declare Thing = MyArray[4]              //error: uninitialized array element
</pre>

<p>Multi-dimensional arrays up to five dimensions may be declared. For
example:</p>
<pre>
#declare MyGrid = array[4][5]
</pre>

<p>declares a 20 element array of 4 rows and 5 columns. Elements are
referenced from <code>MyGrid[0][0]</code> to <code>MyGrid[3][4]</code>.
Although it is permissible to reference an entire array as a whole, you may
not reference just one dimension of a multi-dimensional array. For
example:</p>
<pre>
#declare MyArray = array[10]
#declare MyGrid = array[4][5]
#declare YourArray = MyArray  //this is ok
#declare YourGrid = MyGrid    //so is this
#declare OneRow  = MyGrid[2]  //this is illegal
</pre>
<p>The <code><a href="r3_3.html#r3_3_2_6_2">#ifdef</a></code> and <code><a href="r3_3.html#r3_3_2_6_2">#ifndef</a></code> directives can be used to check whether a specific element of an array has been declared. For methods to determine the size of an array look in the float section for <code><a href="r3_3.html#r3_3_1_5_4">dimensions</a></code> and
<code><a href="r3_3.html#r3_3_1_5_4">dimension_size</a></code>.</p>

<p>Large uninitialized arrays do not take much memory. Internally they are
arrays of pointers so they probably use just 4 bytes per element. Once
initialized with values, they consume memory depending on what you put in
them.</p>
<p>
The rules for local vs. global arrays are the same as any other identifier.</p>
<p class="Note"><strong>Note:</strong> This applies to the entire array. You cannot mix local and global
elements in the same array. See <a href="r3_3.html#r3_3_2_2_2">#declare vs. #local</a> for
information on identifier scope.</p>
<p>Any legitimate use of the <code>#declare</code> directive can also be put into an array. In other words, you can also create multidimensional arrays by making an array of arrays.</p>

</div>
<a name="r3_3_1_10_2"></a>
<div class="content-level-h5" contains="Array Initializers" id="r3_3_1_10_2">
<h5>3.3.1.10.2 Array Initializers</h5>
<p>Because it is cumbersome to individually initialize the elements of an
array, you may initialize it as it is created using array initializer syntax.
For example:</p>
<pre>
#include &quot;colors.inc&quot;
#declare FlagColors = array[3] {Red,White,Blue}
</pre>

<p>Multi-dimensional arrays may also be initialized this way. For
example:</p>
<pre>
#declare Digits =
array[4][10] {
  {7,6,7,0,2,1,6,5,5,0},
  {1,2,3,4,5,6,7,8,9,0},
  {0,9,8,7,6,5,4,3,2,1},
  {1,1,2,2,3,3,4,4,5,5}
  }
</pre>

<p>The commas are required between elements and between dimensions as shown
in the example.</p></div>

<a name="r3_3_1_11"></a>
<div class="content-level-h4" contains="Spline" id="r3_3_1_11">
<h4>3.3.1.11 Spline</h4>
<p>Splines give you a way to define 'pathways' through your scenes. You specify a
series of points, and POV-Ray interpolates to make a curve connecting them. Every
point along the spline has a numerical value. A good example of a spline is the path
of a moving object: the spline itself would be the path traced out by the object and
the 'parameter' would be time; as time changes the object's position moves along the
spline. Therefore, given a time reference you could use this spline to find the position of the
object. In fact, splines are very well suited to animation.</p>

<p>The syntax is:</p>
<pre>
SPLINE_DECLARATION:
  #declare IDENTIFIER =
    spline {
      [SPLINE_IDENTIFIER] |
      [SPLINE_TYPE] |
      [Val_1, &lt;Point_1&gt;[,]
      Val_2, &lt;Point_2&gt;[,]
      ...
      Val_n, &lt;Point_n&gt;]
      }

SPLINE_TYPE:
  linear_spline | quadratic_spline | cubic_spline | natural_spline

SPLINE_USAGE:
  MySpline(Val) | MySpline(Val, SPLINE_TYPE)
</pre>

<p>The first item gives the type of interpolation. In a <code>linear_spline</code>, straight lines connect each point. In a <code>quadratic_spline</code>, a smooth curve defined by a second-order polynomial connects each point, whereas with <code>cubic_spline</code> and <code>natural_spline</code>, a smooth curve defined by a third-order polynomial connects each point. The default is <code>linear_spline</code>.</p>
<p>Following this are a number of float values each followed by a position vector, all
separated by commas. <code>Val_1</code>, <code>Val_2</code>, etc, are the value
of the spline parameter at each specific point. The points need not be in order of their
parameter values.  If two points have the same parameter value, the second point will replace the first.
Beyond the range of the lowest and highest parameter values, the
spline position is fixed at the endpoints.</p>

<p class="Note"><strong>Note:</strong> Because of the way cubic splines 
are defined, the first and last points are tangents rather than points on
the spline, <code>cubic_spline</code> interpolation is only valid between the second and
next-to-last points.  For all other spline types, interpolation is valid from
the first point to the last point. For t-values outside the valid range,
POV-Ray returns the value of the nearest valid point.</p>

<p>To use a spline, you place the spline identifier followed by the parameter (in
parentheses) wherever you would normally put a vector, similar to a macro.  Splines behave mostly
like three-dimensional vectors.</p>
<p>Here is an example:</p>
<pre>
camera { location &lt;0,2,-2&gt; look_at 0 }
light_source { &lt;-5,30,-10&gt; 1 }

#declare MySpline =
spline {
  cubic_spline
    -.25, &lt;0,0,-1&gt;
    0.00, &lt;1,0,0&gt;
    0.25, &lt;0,0,1&gt;
    0.50, &lt;-1,0,0&gt;
    0.75, &lt;0,0,-1&gt;
    1.00, &lt;1,0,0&gt;
    1.25, &lt;0,0,1&gt;
    }

#declare ctr = 0;
#while (ctr &lt; 1)
  sphere {
    MySpline(ctr),.25
    pigment { rgb &lt;1-ctr,ctr,0&gt; }
    }
  #declare ctr = ctr + 0.01;
#end
</pre>

<p>
You can also have POV-Ray evaluate a spline as if it were a different type
of spline by specifying the type of spline after the value to interpolate at,
for example:</p>
<pre>
sphere{ &lt;2,0,2&gt;, .25 pigment{rgb MySpline(clock, linear_spline)}}
</pre>
<p>
Splines are 'intelligent' when it comes to returning vectors.
The vector with the most components in the spline determines the
size of the returned vector.  This allows vectors from two to five components
to be returned by splines.
</p>
<p>
Also, function splines take the vector size into account.  That is, a function
containing a spline with five components will also return a five component
vector (aka a color), a function containing a spline with two components will
only return a two component vector and so on.
</p>

</div>
<a name="r3_3_1_11_1"></a>
<div class="content-level-h5" contains="Splines and Macros" id="r3_3_1_11_1">
<h5>3.3.1.11.1 Splines and Macros</h5>
<p>You can pass functions to macros, how to do this is best explained by an example</p>

<pre>
#macro Foo( Bar, Val )
  #declare Y = Bar(Val).y;
#end

#declare myspline = 
  spline { 
    1, &lt;4,5&gt; 
    3, &lt;5,5&gt; 
    5, &lt;6,5&gt;
    }

Foo(myspline, 2)

#debug str(Y,5,5)
#debug &quot;\n&quot;
</pre></div>

<a name="r3_3_1_12"></a>
<div class="content-level-h4" contains="Transformations" id="r3_3_1_12">
<h4>3.3.1.12 Transformations</h4>
<p>The supported transformations are <code>rotate</code>, <code>scale</code>, and <code>translate</code>. They are used to turn, size and move an object or texture. A transformation matrix may also be used to specify complex transformations directly. Groups of transformations may be merged together and stored in a transformation identifier.</p>
<p>The syntax for transformations is as follows:</p>
<pre>
TRANSFORMATION:
    rotate &lt;Rotate_Amt&gt; | scale &lt;Scale_Amt&gt; | 
    translate &lt;Translate_Amt&gt; | transform TRANSFORM_IDENTIFIER | 
    transform { TRANSFORMATION_BLOCK...} |
    matrix &lt;Val00, Val01, Val02,
        Val10, Val11, Val12,
        Val20, Val21, Val22,
        Val30, Val31, Val32&gt;
TRANSFORMATION_BLOCK:
    TRANSFORM_IDENTIFIER | TRANSFORMATION | inverse
TRANSFORM_DECLARATION:
    #declare IDENTIFIER = transform { TRANSFORMATION_BLOCK...} |
    #local IDENTIFIER = transform { TRANSFORMATION_BLOCK...}
</pre>

</div>
<a name="r3_3_1_12_1"></a>
<div class="content-level-h5" contains="Translate" id="r3_3_1_12_1">
<h5>3.3.1.12.1 Translate</h5>
<p>Items may be moved by adding a <code>translate</code> modifier. It consists of the keyword <code>translate</code> followed by a vector expression. The three terms of the vector specify the number of units to move in each of the x, y and z directions. Translate moves the element relative to its current position.</p>
<p>For example:</p>
<pre>
 sphere { &lt;10, 10, 10&gt;, 1
  pigment { Green }
  translate &lt;-5, 2, 1&gt;
 }
</pre>

<p>will move the sphere from the location <code>&lt;10,10,10&gt;</code> to <code>&lt;5,12,11&gt;</code>. It does not move it to the absolute location <code>&lt;-5,2,1&gt;</code>. Translations are always relative to the item's location before the move. Translating by zero will leave the element unchanged on that axis.</p>
<p>For example:</p>
<pre>
 sphere { &lt;10, 10, 10&gt;, 1
  pigment { Green }
  translate 3*x // evaluates to &lt;3,0,0&gt; so move 3 units
         // in the x direction and none along y or z
 }
</pre>

</div>
<a name="r3_3_1_12_2"></a>
<div class="content-level-h5" contains="Scale" id="r3_3_1_12_2">
<h5>3.3.1.12.2 Scale</h5>
<p>You may change the size of an object or texture pattern by adding a <code>scale</code> modifier. It consists of the keyword <code>scale</code> followed by a vector expression. The three terms of the vector specify the amount of scaling in each of the x, y and z directions.</p>

<p>Uneven scaling is used to <em> stretch</em> or <em>squish</em> an element. Values larger than one stretch the element on that axis while values smaller than one are used to squish it. Scale is relative to the current element size. If the element has been previously re-sized using scale then scale will size relative to the new size. Multiple scale values may used.</p>
<p>For example:</p>
<pre>
 sphere { &lt;0,0,0&gt;, 1
  scale &lt;2,1,0.5&gt;
 }
</pre>

<p>will stretch and smash the sphere into an ellipsoid shape that is twice the original size along the x-direction, remains the same size in the y-direction and is half the original size in the z-direction.</p>

<p>If a lone float expression is specified it is promoted to a three component vector whose terms are all the same. Thus the item is uniformly scaled by the same amount in all directions.</p>
<p>For example:</p>
<pre>
 object {
  MyObject
  scale 5 // Evaluates as &lt;5,5,5&gt; so uniformly scale
      // by 5 in every direction.
 }
</pre>

<p>When one of the scaling components is zero, POV-Ray changes this component to 1 since it assumes that 0 means no scaling in this direction. A warning &quot;Illegal Value: Scale X, Y or Z by 0.0. Changed to 1.0.&quot; is issued.</p>

</div>
<a name="r3_3_1_12_3"></a>
<div class="content-level-h5" contains="Rotate" id="r3_3_1_12_3">
<h5>3.3.1.12.3 Rotate</h5>
<p>You may change the orientation of an object or texture pattern by adding a <code>rotate</code> modifier. It consists of the keyword <code> rotate</code> followed by a vector expression. The three terms of the vector specify the number of degrees to rotate about each of the x-, y- and z-axes.</p>

<p class="Note"><strong>Note:</strong> The order of the rotations does matter. Rotations occur about the x-axis first, then the y-axis, then the z-axis. If you are not sure if this is what you want then you should only rotate on one axis at a time using multiple rotation statements to get a correct rotation.</p>
<pre>
 rotate &lt;0, 30, 0&gt;  // 30 degrees around Y axis then,
 rotate &lt;-20, 0, 0&gt; // -20 degrees around X axis then,
 rotate &lt;0, 0, 10&gt;  // 10 degrees around Z axis.
</pre>

<p>Rotation is always performed relative to the axis. Thus if an object is some distance from the axis of rotation it will not only rotate but it will <em>orbit</em> about the axis as though it was swinging around on an invisible string.</p>
<p>POV-Ray uses a left-handed rotation system. Using the famous <em>Computer Graphics Aerobics</em> exercise, you hold up your left hand and point your thumb in the positive direction of the axis of rotation. Your fingers will curl in the positive direction of rotation. Similarly if you point your thumb in the negative direction of the axis your fingers will curl in the negative direction of rotation. See <a href="t2_2.html#t2_2_1_1">Understanding POV-Ray's Coordinate System</a> for an illustration.</p>

</div>
<a name="r3_3_1_12_4"></a>
<div class="content-level-h5" contains="Matrix" id="r3_3_1_12_4">
<h5>3.3.1.12.4 Matrix</h5>
<p>The <code>matrix</code> keyword can be used to explicitly specify the transformation matrix to be used for objects or textures.</p>
<p>Its syntax is:</p>
<pre>
MATRIX:
    matrix &lt;Val00, Val01, Val02,
        Val10, Val11, Val12,
        Val20, Val21, Val22,
        Val30, Val31, Val32&gt;
</pre>

<p>Where <em><code>Val00</code></em> through <em><code>Val32</code></em> are float expressions enclosed in angle brackets and separated by commas.</p>
<p class="Note"><strong>Note:</strong> This is not a vector. It is a set of 12 float expressions.</p>
<p> These floats specify the elements of a 4 by 4 matrix with the fourth column implicitly set to <code>&lt;0,0,0,1&gt;</code>. At any given point <em>P,&nbsp;P=&lt;px,&nbsp;py,&nbsp;pz&gt;</em>, is transformed into the point <em>Q,&nbsp;Q=&lt;qx,&nbsp;qy,&nbsp;qz&gt;</em>
by</p>

<p>qx = Val00 * px + Val10 * py + Val20 * pz + Val30</p>
<p>qy = Val01 * px + Val11 * py + Val21 * pz + Val31</p>
<p>qz = Val02 * px + Val12 * py + Val22 * pz + Val32</p>

<p>Normally you will not use the matrix keyword because it is less descriptive than the transformation commands and harder to visualize. However the matrix command allows more general transformation effects like <em>shearing</em>. The following matrix causes an object to be sheared along the y-axis.</p>
<pre>
 object {
  MyObject
  matrix &lt; 1, 1, 0,
       0, 1, 0,
       0, 0, 1,
       0, 0, 0 &gt;
 }
</pre></div>

<a name="r3_3_2"></a>
<div class="content-level-h3" contains="Language Directives" id="r3_3_2">
<h3>3.3.2 Language Directives</h3>

<p>The POV Scene Language contains several statements called <em>language directives</em> which tell the file parser how to do its job. These directives can appear in almost any place in the scene file - even in the middle of some other statements. They are used to include other text files in the stream of commands, to declare identifiers, to define macros, conditional, or looped parsing and to control other important aspects of scene file processing.</p>

<p>Each directive begins with the hash character <code>#</code> (often called a number sign or pound sign). It is followed by a keyword and optionally other parameters.</p>

<p>In versions of POV-Ray prior to 3.0, the use of this <code>#</code> character was optional. Language directives could only be used between objects, camera or light_source statements and could not appear within those statements. The
exception was the <code> #include</code> which could appear anywhere. Now that all language directives can be used almost anywhere, the <code>#</code> character is mandatory. The following keywords introduce language directives.</p>

<table summary="All language directives">
<tr valign="top">
<td width="25%">
<code>
<a href="r3_3.html#r3_3_2_6_4">#break</a><br>
<a href="r3_3.html#r3_3_2_6_4">#case</a><br>
<a href="r3_3.html#r3_3_2_7_1">#debug</a><br>
<a href="r3_3.html#r3_3_2_2">#declare</a><br>
<a href="r3_3.html#r3_3_2_4">#default</a><br>
<a href="r3_3.html#r3_3_2_6_1">#else</a><br>
<a href="r3_3.html#r3_3_2_6_1">#elseif</a><br>
</code>
</td>
<td width="25%">
<code>
<a href="r3_3.html#r3_3_2_6_1">#end</a><br>
<a href="r3_3.html#r3_3_2_7_1">#error</a><br>
<a href="r3_3.html#r3_3_2_3_2">#fclose</a><br>
<a href="r3_3.html#r3_3_2_3_1">#fopen</a><br>
<a href="r3_3.html#r3_3_2_6_3">#for</a><br>
<a href="r3_3.html#r3_3_2_6_1">#if</a><br>
<a href="r3_3.html#r3_3_2_6_2">#ifdef</a><br>
</code>
</td>
<td width="25%">
<code>
<a href="r3_3.html#r3_3_2_6_2">#ifndef</a><br>
<a href="r3_3.html#r3_3_2_1">#include</a><br>
<a href="r3_3.html#r3_3_2_2">#local</a><br>
<a href="r3_3.html#r3_3_2_8_1">#macro</a><br>
<a href="r3_3.html#r3_3_2_6_4">#range</a><br>
<a href="r3_3.html#r3_3_2_3_3">#read</a><br>
<a href="r3_3.html#r3_3_2_7_1">#render</a><br>
</code>
</td>
<td width="25%">
<code>
<a href="r3_3.html#r3_3_2_7_1">#statistics</a><br>
<a href="r3_3.html#r3_3_2_6_4">#switch</a><br>
<a href="r3_3.html#r3_3_2_2_4">#undef</a><br>
<a href="r3_3.html#r3_3_2_5">#version</a><br>
<a href="r3_3.html#r3_3_2_7_1">#warning</a><br>
<a href="r3_3.html#r3_3_2_6_5">#while</a><br>
<a href="r3_3.html#r3_3_2_3_4">#write</a><br>
</code>
</td>
</tr>
</table>

<p>Earlier versions of POV-Ray considered the keyword <code>#max_intersections</code> and the keyword <code>#max_trace_level</code> to be language directives but they have been moved to the <code>global_settings</code> statement and should be placed there without the <code>#</code> sign. Their use as a directive still works but it generates a warning and may be discontinued in the future.</p></div>

<a name="r3_3_2_1"></a>
<div class="content-level-h4" contains="Include Directive" id="r3_3_2_1">
<h4>3.3.2.1 Include Directive</h4>

<p>The language allows include files to be specified by placing the line</p>
<pre>
#include &quot;filename.inc&quot;
</pre>

<p>at any point in the input file. The filename may be specified by any valid string expression but it usually is a literal string enclosed in double quotes. It may be up to 40 characters long (or your computer's limit), including the two double-quote characters.</p>

<p>The include file is read in as if it were inserted at that point in the file. Using include is almost the same as cutting and pasting the entire contents of this file into your scene.</p>

<p>Include files may be nested. You may have at most 10 nested include files. There is no limit on un-nested include files.</p>

<p>Generally, include files have data for scenes but are not scenes in themselves. By convention scene files end in <code>.pov</code> and include files end with <code>.inc</code>.</p>

<p>It is legal to specify drive and directory information in the file specification however it is discouraged because it makes scene files less portable between various platforms. Use of full lower case is also recommended but not required.</p>

<p class="Note"><strong>Note:</strong> If you ever intend to distribute any source files you make for POV-Ray, remember that some operating systems have case-sensitive file names).</p>

<p>It is typical to put standard include files in a special sub-directory. POV-Ray can only read files in the current directory or one referenced by the <code>Library_Path</code> option or <code>+L</code> switch. See the section
<a href="r3_2.html#r3_2_5_4">Library Paths</a>.</p>

<p>You may use the <code><a href="r3_3.html#r3_3_2_2">#local</a></code> directive to declare identifiers which are temporary in duration and local to the include file in scope. For details see <a href="r3_3.html#r3_3_2_2_2">#declare vs. #local</a>.</p></div>

<a name="r3_3_2_2"></a>
<div class="content-level-h4" contains="Declare and Local Directives" id="r3_3_2_2">
<h4>3.3.2.2 Declare and Local Directives</h4>

<p>Identifiers may be declared and later referenced to make scene files more
readable and to parameterize scenes so that changing a single declaration
changes many values. There are several built-in identifiers which POV-Ray
declares for you. See the sections: <a href="r3_3.html#r3_3_1_5_6">Built-in Variables</a> and <a href="r3_3.html#r3_3_1_5_5">Built-in Vector Identifiers</a> for details.</p>
</div>
<a name="r3_3_2_2_1"></a>
<div class="content-level-h5" contains="Declaring identifiers" id="r3_3_2_2_1">
<h5>3.3.2.2.1 Declaring identifiers</h5>
<p>An identifier is declared as follows.</p>
<pre>
DECLARATION:
  #declare [deprecated] IDENTIFIER = RVALUE |
  #local [deprecated] IDENTIFIER = RVALUE
RVALUE:
  FLOAT; | VECTOR; | COLOR; | STRING | OBJECT | TEXTURE |
  PIGMENT | NORMAL | FINISH | INTERIOR | MEDIA | DENSITY |
  COLOR_MAP | PIGMENT_MAP | SLOPE_MAP | NORMAL_MAP |
  DENSITY_MAP | CAMERA | LIGHT_SOURCE | FOG | RAINBOW |
  SKY_SPHERE | TRANSFORM
</pre>
<p class="Note"><strong>Note:</strong> See the section on <a href="r3_3.html#r3_3_2_2_5">Deprecation Support</a> for more information</p>
<p>Where <em>IDENTIFIER</em> is the name of the identifier up to 40
characters long and <em>RVALUE</em> is any of the listed items. They are
called that because they are values that can appear to the <em>right</em> of
the equals sign. The syntax for each is in the corresponding section of this
language reference. Here are some examples.</p>
<pre>
#declare Rows = 5;
#declare Count = Count+1;
#local  Here = &lt;1,2,3&gt;;
#declare White = rgb &lt;1,1,1&gt;;
#declare Cyan = color blue 1.0 green 1.0;
#declare Font_Name = &quot;ariel.ttf&quot;
#declare Rod = cylinder {-5*x,5*x,1}
#declare Ring = torus {5,1}
#local  Checks = pigment { checker White, Cyan }

object { Rod scale y*5 } // not &quot;cylinder { Rod }&quot;
object {
  Ring
  pigment { Checks scale 0.5 }
  transform Skew
  }
</pre>

<p class="Note"><strong>Note:</strong> There should be a semi-colon after the expression in all float,
vector and color identifier declarations. This semi-colon is introduced in POV-Ray
version 3.1. If omitted, it generates a warning and some macros may not work
properly. Semicolons after other declarations are optional.</p>
<p>
Declarations, like most language directives, can appear almost anywhere in the file
- even within other statements. For example:</p>
<pre>
#declare Here=&lt;1,2,3&gt;;
#declare Count=0;               // initialize Count
  union {
    object { Rod translate Here*Count }
    #declare Count=Count+1;     // re-declare inside union
    object { Rod translate Here*Count }
    #declare Count=Count+1;     // re-declare inside union
    object { Rod translate Here*Count }
    }
</pre>

<p>As this example shows, you can re-declare an identifier and may use
previously declared values in that re-declaration.</p>
<p class="Note"><strong>Note:</strong> Object identifiers use the generic wrapper statement <code>
object{</code> ... <code>}</code>. You do not need to know what kind of
object it is.</p>
<p>
Declarations may be nested inside each other within limits. In the example
in the previous section you could declare the entire union as a object.
However for technical reasons there are instances where you may not use any
language directive inside the declaration of floats, vectors or color
expressions. Although these limits have been loosened somewhat since POV-Ray
3.1, they still exist.</p>
<p>
Identifiers declared within <code><a href="r3_3.html#r3_3_2_8_1">#macro</a></code> ...
<code><a href="r3_3.html#r3_3_2_6_1">#end</a></code> blocks are not created at the time the macro is defined. They are only created at the time the macro is 
actually invoked. Like all other items inside such a #macro definition, 
they are ignored when the macro is defined.</p>

</div>
<a name="r3_3_2_2_2"></a>
<div class="content-level-h5" contains="declare vs. local" id="r3_3_2_2_2">
<h5>3.3.2.2.2 declare vs. local</h5>
<p>Identifiers may be declared either global using <code><a href="r3_3.html#r3_3_2_2_1">#declare</a></code> or local using the <code><a href="r3_3.html#r3_3_2_2_1">#local</a></code> directive.</p>
<p>
Those created by the <code>#declare</code> directive are permanent in
duration and global in scope. Once created, they are available throughout the
scene and they are not released until all parsing is complete or until they
are specifically released using <code>#undef</code>. See <a href="r3_3.html#r3_3_2_2_4">Destroying Identifiers</a>.</p>
<p>
Those created by the <code>#local</code> directive are temporary in duration
and local in scope. They temporarily override any identifiers with the same
name. See <a href="r3_3.html#r3_3_2_2_3">Identifier Name Collisions</a>.</p>
<p>
If <code>#local</code> is used inside a <code> #macro</code> then the
identifier is local to that macro. When the macro is invoked and the
<code>#local</code> directive is parsed, the identifier is created. It persists
until the <code>#end</code> directive of the macro is reached. At the <code>#end</code>
directive, the identifier is destroyed. Subsequent invocations of the macro
create totally new identifiers.</p>
<p>
Use of <code>#local</code> within an include file but not in a macro, also
creates a temporary identifier that is local to that include file. When the
include file is included and the <code>#local</code> directive is parsed, the
identifier is created. It persists until the end of the include file is
reached. At the end of file the identifier is destroyed. Subsequent inclusions
of the file create totally new identifiers.</p>
<p>
Use of <code>#local</code> in the main scene file (not in an include file
and not in a macro) is identical to <code>#declare</code>. For clarity sake
you should not use <code>#local</code> in a main file except in a macro.</p>
<p>
There is currently no way to create permanent, yet local identifiers in
POV-Ray.</p>
<p>
Local identifiers may be specifically released early using <code><a href="r3_3.html#r3_3_2_2_4">#undef</a></code> but in general there is no need to do so. See <a href="r3_3.html#r3_3_2_2_4">Destroying Identifiers</a>.</p>

</div>
<a name="r3_3_2_2_3"></a>
<div class="content-level-h5" contains="Identifier Name Collisions" id="r3_3_2_2_3">
<h5>3.3.2.2.3 Identifier Name Collisions</h5>
<p>Local identifiers may have the same names as previously declared
identifiers. In this instance, the most recent, most local identifier takes
precedence. Upon entering an include file or invoking a macro, a new symbol
table is created. When referencing identifiers, the most recently created
symbol table is searched first, then the next most recent and so on back to
the global table of the main scene file. As each macro or include file is
exited, its table and identifiers are destroyed. Parameters passed by value
reside in the same symbol table as the one used for identifiers local to the
macro.</p>
<p>
The rules for duplicate identifiers may seem complicated when multiple-nested
includes and macros are involved, but in actual practice the results are
generally what you intended.</p>
<p>
Consider this example: You have a main scene file called <code>myscene.pov</code>
and it contains</p>
<pre>
#declare A = 123;
#declare B = rgb&lt;1,2,3&gt;;
#declare C = 0;
#include &quot;myinc.inc&quot;
</pre>

<p>Inside the include file you invoke a macro called <code>MyMacro(J,K,L)</code>.
It is not important where <code> MyMacro</code> is defined as long 
as it is defined before it is invoked. In this example, it is important 
that the macro is invoked from within <code> myinc.inc</code>.</p>
<p>
The identifiers <code>A</code>, <code>B</code>, and <code> C</code> are
generally available at all levels. If either <code> myinc.inc</code> or
<code> MyMacro</code> contain a line such as <code> #declare C=C+1;</code>
then the value <code>C</code> is changed everywhere as you might expect.</p>
<p>
Now suppose inside <code>myinc.inc</code> you do...</p>
<pre>
#local A = 546;
</pre>

<p>The main version of <code>A</code> is hidden and a new <code>A</code> is
created. This new <code>A</code> is also available inside <code>
MyMacro</code> because <code>MyMacro</code> is nested inside <code>
myinc.inc</code>. Once you exit <code>myinc.inc</code>, the local <code>
A</code> is destroyed and the original <code>A</code> with its value of
<code>123</code> is now in effect. Once you have created the local <code>
A</code> inside <code>myinc.inc</code>, there is no way to reference the
original global <code>A</code> unless you <code>#undef A</code> or exit the
include file. Using <code>#undef</code> always undefines the most local
version of an identifier.</p>
<p>
Similarly if <code>MyMacro</code> contained...</p>
<pre>
#local B = box{0,1}
</pre>

<p>then a new identifier <code>B</code> is created local to the macro only.
The original value of <code>B</code> remains hidden but is restored when the
macro is finished. The local <code>B</code> need not have the same
type as the original.</p>
<p>
The complication comes when trying to assign a new value to an identifier at
one level that was declared local at an earlier level. Suppose inside <code>
myinc.inc</code> you do...</p>
<pre>
#local D = 789;
</pre>

<p>If you are inside <code>myinc.inc</code> and you want to increment <code>
D</code> by one, you might try to do...</p>
<pre>
#local D = D + 1;
</pre>

<p>but if you try to do that inside <code>MyMacro</code> you will create a
new <code>D</code> which is local to <code>MyMacro</code> and not the <code>
D</code> which is external to <code>MyMacro</code> but local to <code>
myinc.inc</code>. Therefore you've said &quot;create a <code> MyMacro
D</code> from the value of <code>myinc.inc</code>'s <code> D</code> plus
one&quot;. That's probably not what you wanted. Instead you should
do...</p>
<pre>
#declare D = D + 1;
</pre>

<p>You might think this creates a new <code>D</code> that is global but it
actually increments the myinc.inc version of <code>D</code>. Confusing
isn't it? Here are the rules:</p>

<ol>
<li>When referencing an identifier, you always get the most recent, most
local version. By &quot;referencing&quot; we mean using the value of the
identifier in a POV-Ray statement or using it on the right of an equals sign
in either a <code>#declare</code> or <code> #local</code>.</li>

<li>When declaring an identifier using the <code>#local</code> keyword,
the identifier which is created or has a new value assigned, is ALWAYS
created at the current nesting level of macros or include files.</li>

<li>When declaring a NEW, NON-EXISTANT identifier using <code>#declare</code>,
it is created as fully global. It is put in the symbol table of the main
scene file.</li>

<li>When ASSIGNING A VALUE TO AN EXISTING identifier using <code>#declare</code>,
it assigns it to the most recent, most local version at the time.</li>
</ol>

<p>In summary, <code>#local</code> always means &quot;the current
level&quot;, and <code>#declare</code> means &quot;global&quot; for new
identifiers and &quot;most recent&quot; for existing identifiers.</p>

</div>
<a name="r3_3_2_2_4"></a>
<div class="content-level-h5" contains="Destroying Identifiers with undef" id="r3_3_2_2_4">
<h5>3.3.2.2.4 Destroying Identifiers with undef</h5>
<p>Identifiers created with <code>#declare</code> will generally persist until parsing is complete. Identifiers created with <code>#local</code> will persist until the end of the macro or include file in which they were created. You may however un-define an identifier using the <code>#undef</code> directive. For example:</p>
<pre>
#undef MyValue
</pre>
<p>If multiple local nested versions of the identifier exist, the most local most recent version is deleted and any identically named identifiers which were created at higher levels will still exist.</p>
<p>See also <a href="r3_3.html#r3_3_2_6_2">The #ifdef and #ifndef Directives</a>.</p>

</div>
<a name="r3_3_2_2_5"></a>
<div class="content-level-h5" contains="Deprecation Support" id="r3_3_2_2_5">
<h5>3.3.2.2.5 Deprecation Support</h5>
<p>The ability to add a <code>deprecated</code> flag to a <code>#declare</code> has been added. This is to aid in migrating scenes away from old constructs (e.g. old textures). The usage is illustrated below:</p>
<pre>
#declare deprecated Col_Glass_Old=color rgbf &lt;0.8, 0.9, 0.85, 0.85&gt;;
#declare deprecated once Col_Glass_Old=... etc
#declare deprecated "Some message" Col_Glass_Old=... etc
</pre>
<p>A deprecated identifier generates no message at the time it is declared, a warning is only issued if it is used.</p>
<p>If the optional <code>once</code> keyword is present it must immediately follow the <code>deprecated</code> keyword and indicates that the warning should only be displayed once per parse.</p>
<p>If the optional message string is present, it will be used as the warning to be displayed if the identifier is used. Otherwise, a message in the form &quot;Identifier Col_Glass_Old was declared deprecated.&quot; is used.</p>	
<p>An identifier is considered <em>used</em> if it is referenced anywhere (even if in another <code>#declare</code>).</p></div>

<a name="r3_3_2_3"></a>
<div class="content-level-h4" contains="File I/O Directives" id="r3_3_2_3">
<h4>3.3.2.3 File I/O Directives</h4>

<p>You may open, read, write, append, and close plain ASCII text files 
while parsing POV-Ray scenes. This feature is primarily intended to help 
pass information between frames of an animation. Values such as an 
object's position can be written while parsing the current frame and 
read back during the next frame. Clever use of this feature could allow a 
POV-Ray scene to generate its own include files or write self-modifying 
scripts. We trust that users will come up with other interesting uses for 
this feature.</p>
<p class="Note"><strong>Note:</strong> Some platform versions of POV-Ray (e.g. Windows)
provide means to restrict the ability of scene files to read and write files.</p>

</div>
<a name="r3_3_2_3_1"></a>
<div class="content-level-h5" contains="The fopen Directive" id="r3_3_2_3_1">
<h5>3.3.2.3.1 The fopen Directive</h5>
<p>Users may open a text file using the <code>#fopen</code> directive. The syntax is as follows:</p>
<pre>
FOPEN_DIRECTIVE:
  #fopen FILE_HANDLE_IDENTIFIER &quot;filename&quot; OPEN_TYPE
OPEN_TYPE:
  read | write | append
</pre>
<p>Where <em>FILE_HANDLE_IDENTIFIER</em> is an undefined identifier used to reference this file as a file handle, <em>&quot;filename&quot;</em> is any string literal or string expression which specifies the file name. Files opened with the <code>read</code> are open for read only. Those opened with <code>write</code> create a new file with the specified name and it overwrites any existing file with that name. Those opened with <code>append</code> opens a file for writing but appends the text to the end of any existing file.</p>
<p>The file handle identifier created by <code>#fopen</code> is always global and remains in effect (and the file remains open) until the scene parsing is complete or until you <code>#fclose</code> the file. You may use <code>#ifdef</code> <em>FILE_HANDLE_IDENTIFIER</em> to see if a file is open.</p>

</div>
<a name="r3_3_2_3_2"></a>
<div class="content-level-h5" contains="The fclose Directive" id="r3_3_2_3_2">
<h5>3.3.2.3.2 The fclose Directive</h5>
<p>Files opened with the <code>#fopen</code> directive are automatically
closed when scene parsing completes however you may close a file using the
<code>#fclose</code> directive. The syntax is as follows:</p>
<pre>
FCLOSE_DIRECTIVE:
  #fclose FILE_HANDLE_IDENTIFIER
</pre>

<p>Where <em>FILE_HANDLE_IDENTIFIER</em> is previously opened file opened
with the <code>#fopen</code> directive.</p>

</div>
<a name="r3_3_2_3_3"></a>
<div class="content-level-h5" contains="The read Directive" id="r3_3_2_3_3">
<h5>3.3.2.3.3 The read Directive</h5>
<p>You may read string, float or vector values from a plain ASCII text file directly into POV-Ray variables using the <code>#read</code> directive. The file must first be opened in <em>read</em> mode using the <code>#fopen</code> directive. The syntax for <code>#read</code> is as follows:</p>
<pre>
READ_DIRECTIVE:
  #read (FILE_HANDLE_IDENTIFIER, DATA_IDENTIFIER[,DATA_IDENTIFIER]..)
DATA_IDENTIFIER:
  UNDECLARED_IDENTIFIER | FLOAT_IDENTIFIER | VECTOR_IDENTIFIER | 
  STRING_IDENTIFIER
</pre>

<p>Where <em>FILE_HANDLE_IDENTIFIER</em> is the previously opened file. It is followed by one or more <em>DATA_IDENTIFIER</em>(s) separated by commas. The parentheses around the identifier list are required. A <em>DATA_IDENTIFIER</em> is any undeclared identifier or any previously declared string identifier, float identifier, or vector identifier. Undefined identifiers will be turned into global identifiers of the type determined by the data which is read. Previously defined identifiers remain at whatever global/local status they had when originally created. Type checking is performed to insure that the proper type data is read into these identifiers.</p>
<p>The format of the data to be read must be a series of valid string literals, float literals, or vector literals separated by commas. Expressions or identifiers are not permitted in the data file however unary minus signs and exponential notation are permitted on float values.</p>
<p>If you attempt to read past end-of-file, the file is automatically closed and the <em>FILE_HANDLE_IDENTIFIER</em> is deleted from the symbol table. This means that the boolean function <code>defined(</code><em>FILE_HANDLE_IDENTIFIER</em><code>)</code> can be used to detect end-of-file.</p>
<p>For example:</p>
<pre>
#fopen FILE_HANDLE_IDENTIFIER &quot;mydata.txt&quot; read
#while (defined(FILE_HANDLE_IDENTIFIER))
  #read (FILE_HANDLE_IDENTIFIER,Var1,Var2,Var3)
  ...
#end
</pre>

</div>
<a name="r3_3_2_3_4"></a>
<div class="content-level-h5" contains="The write Directive" id="r3_3_2_3_4">
<h5>3.3.2.3.4 The write Directive</h5>
<p>You may write string, float or vector values to a plain ASCII text file from POV-Ray variables using the <code>#write</code> directive. Additionally it is now possible to write 8, 16, and 32-bit words to an external file.</p>
<p>These words may be arranged in either little or big-endian fashion. Placing one of the following keywords in the argument list of a <code>#write</code> statement causes the values up to the next comma to be written in binary format, using 2's complement integer representation, rounded to the nearest integer in the representable range:</p>
<pre>
  uint8              - unsigned byte (0..255)
  sint8              - signed byte (-128..127)
  uint16be, uint16le - unsigned 16-bit word (0..65535)
  sint16be, sint16le - signed 16-bit word (-32768..32767)
  sint32be, sint32le - signed 32-bit word (-2^31..2^31-1)
</pre>
<p class="Note"><strong>Note:</strong> Currently, <em>unsigned</em> 32-bit words are not supported.</p>
<p>Keywords ending in &quot;be&quot; will cause the values to be written most significant byte first (<em>big endian</em>, aka network byte order) while those ending in &quot;le&quot; will instead write the least significant byte first (<em>little endian</em>, Intel format).</p>
<p class="Note"><strong>Note:</strong> See the sample macro <code>ARRAYS_WriteDF3</code> in <a href="r3_4.html#r3_4_9_1_1">arrays.inc</a>  to see how this feature may be used.</p> 
<p>As always, the file must first be opened in either <code>write</code> or <code>append</code> mode using the <code>#fopen</code> directive. The syntax for the <code>#write</code> directive is as follows:</p>
<pre>
WRITE_DIRECTIVE:
  #write (FILE_HANDLE_IDENTIFIER, [BINARY_WORD_TYPE,] DATA_ITEM [,DATA_ITEM]...)
BINARY_WORD_TYPE:
  uint8 | sint8 | uint16be | uint16le | sint16be | sint16le | sint32be | sint32le
DATA_ITEM:
  FLOAT | VECTOR | STRING
</pre>
<p>Where <em>FILE_HANDLE_IDENTIFIER</em> is the previously opened file. It is followed by one or more  <em>DATA_ITEM</em>(s) separated by commas. The parentheses around the identifier list are required. A <em>DATA_ITEM</em> is any valid string expression, float expression, or vector expression. Float expressions are evaluated and written as signed float literals. If you require format control, you should use the <code>str(VALUE,L,P)</code> function to convert it to a formatted string. See <a href="r3_3.html#r3_3_1_9_4">String Functions</a> for details on the <code>str</code> function. Vector expressions are evaluated into three signed float constants and are written with angle brackets and commas in standard POV-Ray vector notation. String expressions are evaluated and written as specified.</p>
<p class="Note"><strong>Note:</strong> Data read by the <code>#read</code> directive must have comma
delimiters between values and quotes around string data but the <code>#write</code> directive does not automatically output commas or quotes.</p>
<p>For example the following <code>#read</code> directive reads a string, float and vector.</p>
<pre>
#read (FILE_HANDLE_IDENTIFIER,MyString,MyFloat,MyVect)
</pre>
<p>It expects to read something like:</p>
<pre>
&quot;A quote delimited string&quot;, -123.45, &lt;1,2,-3&gt;
</pre>
<p>The POV-Ray code to write this might be:</p>
<pre>
#declare Val1 = -123.45;
#declare Vect1 = &lt;1,2,-3&gt;;
#write (FILE_HANDLE_IDENTIFIER,&quot;\&quot;A quote delimited string\&quot;,&quot;,Val1,&quot;,&quot;,Vect1,&quot;\n&quot;)
</pre>
<p>See <a href="r3_3.html#r3_3_1_9_1">String Literals</a> and <a href="r3_3.html#r3_3_2_7_2">Text Formatting</a> for details on writing special characters such as quotes, newline, etc.</p></div>

<a name="r3_3_2_4"></a>
<div class="content-level-h4" contains="Default Directive" id="r3_3_2_4">
<h4>3.3.2.4 Default Directive</h4>

<p>POV-Ray creates a default texture when it begins processing. You may change those defaults as described below. Every time you specify a <code><a href="r3_4.html#r3_4_6">texture</a></code> statement, POV-Ray creates a copy of the default texture. Anything you put in the texture statement overrides the default settings. If you attach a <code>pigment</code>, <code>normal</code>, or <code>finish</code> to an object without any texture statement then POV-Ray checks to see if a texture has already been attached. If it has a texture then the pigment, normal or finish will modify the existing texture. If no texture has yet been attached to the object then the default texture is copied and the pigment, normal or finish will modify that texture.</p>
<p>
You may change the default texture, pigment, normal or finish using the language directive <code>#default</code> as follows:</p>
<pre>
DEFAULT_DIRECTIVE:
  #default {DEFAULT_ITEM }
DEFAULT_ITEM:
  TEXTURE | PIGMENT | NORMAL | FINISH
</pre>
<p>For example:</p>
<pre>
#default {
  texture {
    pigment { rgb &lt;1,0,0&gt; }
    normal { bumps 0.3 }
    finish { ambient 0.4 }
    }
  }
</pre>
<p>This means objects will default to red bumps and slightly high ambient finish. You may also change just part of it like this:</p>
<pre>
#default {
  pigment {rgb &lt;1,0,0&gt;}
  }
</pre>
<p>This still changes the pigment of the default texture. At any time there is only one default texture made from the default pigment, normal and finish. The example above does not make a separate default for pigments alone.</p>
<p class="Note"><strong>Note:</strong> The special textures <code>tiles</code> and <code>material_map</code>
or a texture with a <code>texture_map</code> may not be used as defaults.</p>
<p>You may change the defaults several times throughout a scene as you wish. Subsequent <code>#default</code> statements begin with the defaults that were in effect at the time. If you wish to reset to the original POV-Ray defaults then you should first save them as follows:</p>
<pre>
//At top of file
#declare Original_Default = texture {}
</pre>
<p>later after changing defaults you may restore it with...</p>
<pre>
#default {texture {Original_Default}}
</pre>
<p>If you do not specify a texture for an object then the default texture is attached when the object appears in the scene. It is not attached when an object is declared.</p>
<p>For example:</p>
<pre>
#declare My_Object =
sphere{ &lt;0,0,0&gt;, 1 } // Default texture not applied
object{ My_Object }        // Default texture added here
</pre>
<p>You may force a default texture to be added by using an empty texture statement as follows:</p>
<pre>
#declare My_Thing =
sphere { &lt;0,0,0&gt;, 1 texture {} } // Default texture applied
</pre>
<p>The original POV-Ray defaults for all items are given throughout the documentation under each appropriate section.</p></div>

<a name="r3_3_2_5"></a>
<div class="content-level-h4" contains="Version Directive" id="r3_3_2_5">
<h4>3.3.2.5 Version Directive</h4>

<p>As POV-Ray has evolved from version 1.0 through 3.6 we have made every effort to maintain some amount of backwards compatibility with earlier versions. Some old or obsolete features can be handled directly without any special consideration by the user. Some old or obsolete features can no longer be handled at all. However <em>some</em> old features can still be
used if you warn POV-Ray that this is an older scene. The <code>#version</code> directive can be used to switch version compatibility to different setting several times throughout a scene file. The syntax is:</p>
<pre>
VERSION_DIRECTIVE: 
  #version FLOAT;
</pre>
<p class="Note"><strong>Note:</strong> There should be a semi-colon after the float expression in a <code>#version</code> directive. This semi-colon is introduced in POV-Ray version 3.1. If omitted, it generates a warning and some macros may not work
properly.</p>
<p>Additionally you may use the <code>Version=</code><em>n.n</em> option or the <code>+MV</code><em>n.n</em> switch to establish the <em>initial</em> setting. See <a href="r3_2.html#r3_2_5_5">Language Version</a> for details. For example, one feature introduced in 2.0 that was incompatible with any 1.0 scene files is the parsing of float expressions. Using <code>#version 1.0</code> turns off expression parsing as well as many warning messages so that nearly all 1.0 files will still work. Naturally the default setting for this option is <code>#version 3.5</code>.</p>
<p class="Note"><strong>Note:</strong> Some obsolete or re-designed features <em>are totally unavailable in the current version of POV-Ray REGARDLESS OF THE VERSION SETTING.</em> Details on these features are noted throughout this documentation.</p>
<p>The built-in float identifier <code>version</code> contains the current setting of the version compatibility option. See
Float Expressions: <a href="r3_3.html#r3_3_1_5_6">Built-in Variables</a>. Together with the built-in <code>version</code> identifier the <code>#version</code> directive allows you to save and restore the previous values of this compatibility setting. The new <code>#local</code> identifier option is especially useful here. For example, suppose <code>mystuff.inc</code> is in version 1 format. At the top of the file you could put:</p>
<pre>
#local Temp_Vers = version;  // Save previous value
  #version 1.0;              // Change to 1.0 mode
    ... // Version 1.0 stuff goes here...
  #version Temp_Vers;        // Restore previous version
</pre>

<p>As of version 3.7, there has been a <em>requirement</em> implemented. In order to obtain full version 3.7
  functionality, you <em>MUST</em> specify the <code>#version 3.7</code> directive in your scene file. Prior to a <code>#version</code> directive appearing, the version defaults to 3.62. Additionally, if the first <code>#version</code> appears after any other declaration, or a <code>#version</code> directive does not appear at all, a post-parse warning is issued.</p>

<p class="Warning"><strong>Warning:</strong> The version directive and command-line setting no longer provide compatibility with most rendering bugs in versions prior to POV-Ray 3.5. However, compatibility with the scene language is provided for scenes as old as POV-Ray 1.0 just as in all previous versions of POV-Ray. Nevertheless, we strongly recommend you update scenes at least to POV-Ray 3.5 syntax if you plan to use them in future versions of POV-Ray.</p></div>

<a name="r3_3_2_6"></a>
<div class="content-level-h4" contains="Conditional Directives" id="r3_3_2_6">
<h4>3.3.2.6 Conditional Directives</h4>

<p>POV-Ray allows a variety of language directives to implement conditional parsing of various sections of your scene file. This is
especially useful in describing the motion for animations but it has other uses as well. Also available is a <code><a href="r3_3.html#r3_3_2_6_5">#while</a></code> loop directive. You may nest conditional directives 200 levels deep.</p>
</div>
<a name="r3_3_2_6_1"></a>
<div class="content-level-h5" contains="The if...else...end Directives" id="r3_3_2_6_1">
<h5>3.3.2.6.1 The if...else...end Directives</h5>
<p>The simplest conditional directive is the traditional <code>#if</code> directive. The syntax is:</p>
<pre>
IF_DIRECTIVE:
  #if ( Cond ) TOKENS... [ELSE_DIRECTIVE] #end
ELSE_DIRECTIVE:
  #else TOKENS... |
  #elseif ( Cond ) TOKENS... [ELSE_DIRECTIVE]
</pre>
<p>The <em>TOKENS</em> are any number of POV-Ray keyword, identifiers, or punctuation and <code>(</code> <em>Cond</em> <code>)</code> is a float expression that is interpreted as a boolean value. The parentheses and the <code>#end</code> directive are required, an optional <code>#elseif</code> clause is now supported.</p>
<p>A value of 0.0 is <code>false</code> (numbers &lt;= <em>1e-10</em> are also considered zero) while other any non-zero value is <code>true</code>.</p>
<p>For example:</p>
<pre>
#if (Foo)
  #debug "Foo is true\n"
#elseif (Bar)
  #debug "Foo is false, but Bar is true\n"
#else
  #debug "Foo and Bar are both false\n"
#end
</pre>
<p class="Note"><strong>Note:</strong> Nesting directives in the following manner has been known to cause problems during the parse phase.</p>
<pre>
#if( #if(yes) yes #end ) #end
</pre>

</div>
<a name="r3_3_2_6_2"></a>
<div class="content-level-h5" contains="The ifdef and ifndef Directives" id="r3_3_2_6_2">
<h5>3.3.2.6.2 The ifdef and ifndef Directives</h5>
<p>The <code>#ifdef</code> and <code>#ifndef</code> directive are similar to the <code>#if</code> directive however they are used to determine if an identifier has been previously declared.</p>
<pre>
IFDEF_DIRECTIVE:
  #ifdef ( IDENTIFIER ) TOKENS... [ELSE_DIRECTIVE] #end
IFNDEF_DIRECTIVE:
  #ifndef ( IDENTIFIER ) TOKENS... [ELSE_DIRECTIVE] #end
ELSE_DIRECTIVE:
  #else TOKENS... |
  #elseif ( Cond ) TOKENS... [ELSE_DIRECTIVE]
</pre>
<p>If the <em>IDENTIFIER</em> exists then the first group of tokens is parsed normally and the second set is skipped. If false, the first set is skipped and the second set is parsed. This is especially useful for replacing an undefined item with a default.</p>
<p>For example:</p>
<pre>
#ifdef (User_Thing)
  // This section is parsed if the
  // identifier &quot;User_Thing&quot; was
  // previously declared
  object{User_Thing} // invoke identifier
#else
  // This section is parsed if the
  // identifier &quot;User_Thing&quot; was not
  // previously declared
  box{&lt;0,0,0&gt;,&lt;1,1,1&gt;} // use a default
#end
// End of conditional part
</pre>
<p>The <code>#ifndef</code> directive works the opposite. The first group is parsed if the identifier is <em>not</em> defined. As with the <code>#if</code> directive, the <code>#else</code> clause is optional and the <code>#end</code> directive is required.</p>
<p>The <code>#ifdef</code> and <code>#ifndef</code> directives can be used to determine whether a specific element of an array has been assigned.</p>
<pre>
#declare MyArray=array[10]
//#declare MyArray[0]=7;
#ifdef(MyArray[0])
  #debug &quot;first element is assigned\n&quot;
#else 
  #debug &quot;first element is not assigned\n&quot;
#end
</pre>
<p class="Note"><strong>Note:</strong> Additionally, just like the <code>#if</code> directive, the <code>#ifdef</code> and <code>#ifndef</code> directives now also supports an <code>#elseif</code> clause.</p> 

</div>
<a name="r3_3_2_6_3"></a>
<div class="content-level-h5" contains="The for Directive" id="r3_3_2_6_3">
<h5>3.3.2.6.3 The for Directive</h5>
<p>A new <code>#for</code> loop construct is now available for simple loops incrementing Identifier from Start to End (inclusive) with the given Step size. The default Step size is  +1.0.</p>
<p>The syntax is:</p>
<pre>
#for (Identifier, Start, End [, Step])
  //...
#end
</pre>
<p>Consider the following example:</p>
<pre>
#for (i,0,330,30)
  sphere { 0,1 translate &lt;0,0,-10&gt; rotate y*i }
#end
</pre>
<p>The <em>Identifier</em> (<em>i</em> in this case) <em>starts</em> at 0 and <em>ends</em> at 330 ... an optional <em>step</em> value of 30 was added.</p>
<p>
Some additional notes:</p>
<ul>
<li>If Step is negative, comparison will be automatically adjusted to match a  <em>countdown</em> pattern.</li>
<li>Start, End and Step are evaluated only <em>once</em>.</li>
<li>The loop counter is a full-fledged local variable. Any local variable of the same name already defined before the loop <em>will</em> be overwritten without warning (note that in the main scene file, all local variables outside of macros are effectively global); inside the loop, any tampering with the variable is possible for effect, as long as it is defined as a local numeric variable at the end of each iteration.</li>
<li>After the loop has terminated, the variable will remain defined, typically holding the value End+Step.</li>
<li>The loop counter must <em>not</em> be an array element.</li>
</ul>

<p class="Note"><strong>Note:</strong> See the <em>end</em> of the next section for more information about <code>#break</code> directive behavior.</p>

</div>
<a name="r3_3_2_6_4"></a>
<div class="content-level-h5" contains="The switch, case, range and break Directives" id="r3_3_2_6_4">
<h5>3.3.2.6.4 The switch, case, range and break Directives</h5>
<p>A more powerful conditional is the <code>#switch</code> directive. The syntax is as follows...</p>
<pre>
SWITCH_DIRECTIVE:
  #switch ( Switch_Value ) SWITCH_CLAUSE... [#else TOKENS...] #end
SWITCH_CLAUSE:
  #case( Case_Value ) TOKENS... [#break] |
  #range( Low_Value , High_Value ) TOKENS... [#break]
</pre>
<p>The <em>TOKENS</em> are any number of POV-Ray keyword, identifiers, or punctuation and <code>(</code><em> Switch_Value</em> <code>)</code> is a float expression. The parentheses are required. The <code>#end</code> directive is required. The <em>SWITCH_CLAUSE</em> comes in two varieties. In the <code>#case</code> variety, the float <em>Switch_Value</em> is compared to the float <em>Case_Value</em>. If they are equal, the condition is true.</p>
<p class="Note"><strong>Note:</strong> Values whose difference is less than 1e-10 are considered equal in
case of round off errors.</p>
<p>In the <code>#range</code> variety, <em>Low_Value</em> and <em>High_Value</em> are floats separated by a comma and enclosed in parentheses.</p>
<p>If <em>Low_Value &lt;= Switch_Value</em> and <em>Switch_Value &lt;= High_Value</em> then the condition is true.</p>
<p>In either variety, if the clause's condition is true, that clause's tokens are parsed normally and parsing continues until a <code>#break</code>, <code>#else</code> or <code>#end</code> directive is reached. If the condition is false, POV-Ray skips until another <code>#case</code> or <code>#range</code> is found.</p>
<p>There may be any number of <code>#case</code> or <code>#range</code> clauses in any order you want. If a clause evaluates true but no <code>#break</code> is specified, the parsing will fall through to the next <code>#case</code> or <code>#range</code> and that clause conditional is evaluated. Hitting <code>#break</code> while parsing a successful section causes an immediate jump to the <code>#end</code> without processing subsequent sections, even if a subsequent condition would also have been satisfied.</p>
<p>An optional <code>#else</code> clause may be the last clause. It is only executed if the clause before it was a false clause.</p>
<p>Additionally, within the <code>#switch</code> directive, the <code>#else</code> clause acts like a <code>#range</code> directive that encompasses any possible number. To avoid execution of the <code>#else</code> block, the preceding <code>#case</code> or <code>#range</code> directives must be ended with a <code>#break</code> statement.</p>
<p class="Note"><strong>Note:</strong> The above behavior applies <em>only</em> within the <code>#switch</code> directive.</p> 
<p>For example:</p>
<pre>
#switch (VALUE)
  #case (TEST_1)
    // This section is parsed if VALUE=TEST_1
  #break //First case ends
  #case (TEST_2)
    // This section is parsed if VALUE=TEST_2
  #break //Second case ends
  #range (LOW_1,HIGH_1)
    // This section is parsed if (VALUE&gt;=LOW_1)&amp;(VALUE&lt;=HIGH_1)
  #break //Third case ends
  #range (LOW_2,HIGH_2)
    // This section is parsed if (VALUE&gt;=LOW_2)&amp;(VALUE&lt;=HIGH_2)
  #break //Fourth case ends
  #else
    // This section is parsed if no other case or
    // range is true.
#end
</pre>
<p class="Note"><strong>Note:</strong> As of version 3.7 the <code>#break</code> directive can now be used:</p>
<ul>
<li>anywhere within a <code>#case</code> or <code>#range</code> block, to skip to the end of the <code>#switch</code> directive (previously, <code>#break</code> was only useful right before the next <code>#case</code>, <code>#range</code> or <code>#else</code> directive, to indicate that a slip-through was not desired).</li>
<li>anywhere within a loop block (both <code>#while</code> and <code>#for</code>), to terminate the loop.</li>
<li>anywhere within a <code>#macro</code> to preliminarily terminate the macro.</li>
</ul>
<p>Example for the use in a loop:</p>	
<pre>
#local R = seed(4711);
#for (I, 1, 100)
  #if (rand(R) &lt; I/1000)
    #break // terminate loop early
  #end
  #debug concat(str(I,0,0), " iterations and counting\n")
#end
</pre>
<p>Where multiple <code>#switch</code>, loop and/or <code>#macro</code> blocks are nested, <code>#break</code> will leave only the innermost of these.</p>

</div>
<a name="r3_3_2_6_5"></a>
<div class="content-level-h5" contains="The while...end Directive" id="r3_3_2_6_5">
<h5>3.3.2.6.5 The while...end Directive</h5>
<p>The <code>#while</code> directive is a looping feature that makes it easy to place multiple objects in a pattern or other uses.</p>
<pre>
WHILE_DIRECTIVE:
  #while ( Cond ) TOKENS... #end
</pre>
<p>The <em>TOKENS</em> are any number of POV-Ray keyword, identifiers, or punctuation marks which are the <em>body</em> of the loop. The <code>#while</code> directive is followed by a float expression that evaluates to a boolean value. A value of 0.0 is false and any non-zero value is true.</p>
<p class="Note"><strong>Note:</strong> Extremely small values of about 1e-10 are considered zero in case of round off errors.</p>
<p>The parentheses around the expression are required. If the condition is true parsing continues normally until an <code>#end</code> directive is reached. At the end, POV-Ray loops back to the <code>#while</code> directive and the condition is re-evaluated. Looping continues until the condition fails. When it fails, parsing continues after the <code>#end</code> directive.</p>
<p class="Note"><strong>Note:</strong> It is possible for the condition to fail the first time and the loop is totally skipped. It is up to the user to insure that something inside the loop changes so that it eventually terminates.</p>
<p>Here is a properly constructed loop example:</p>
<pre>
#declare Count=0;
#while (Count &lt; 5)
  object { MyObject translate x*3*Count }
  #declare Count=Count+1;
#end
</pre>
<p>This example places five copies of <code>MyObject</code> in a row spaced three units apart in the x-direction.</p>

<p class="Note"><strong>Note:</strong> See the <em>end</em> of the previous section for more information about <code>#break</code> directive behavior.</p></div>

<a name="r3_3_2_7"></a>
<div class="content-level-h4" contains="User Message Directives" id="r3_3_2_7">
<h4>3.3.2.7 User Message Directives</h4>

<p>With the addition of conditional and loop directives, the POV-Ray language has the potential to be more like an actual programming language. This means that it will be necessary to have some way to see what is going on when trying to debug loops and conditionals. To fulfill this need we have added the ability to print text messages to the screen. You have a choice of five
different text streams to use including the ability to generate a fatal error if you find it necessary. Limited formatting is available for strings output by this method.</p>
</div>
<a name="r3_3_2_7_1"></a>
<div class="content-level-h5" contains="Text Message Streams" id="r3_3_2_7_1">
<h5>3.3.2.7.1 Text Message Streams</h5>
<p>The syntax for a text message is any of the following:</p>
<pre>
TEXT_STREAM_DIRECTIVE:
  #debug STRING | #error STRING | #warning STRING
</pre>

<p>Where <em>STRING</em> is any valid string of text including string
identifiers or functions which return strings. For example:</p>
<pre>
#switch (clock*360)
  #range (0,180)
    #debug &quot;Clock in 0 to 180 range\n&quot;
  #break
  #range (180,360)
    #debug &quot;Clock in 180 to 360 range\n&quot;
  #break
  #else
    #warning &quot;Clock outside expected range\n&quot;
    #warning concat(&quot;Value is:&quot;,str(clock*360,5,0),&quot;\n&quot;)
#end
</pre>

<p>There are seven distinct <a href="r3_2.html#r3_2_7_1">text streams</a> that POV-Ray uses for output. You
may output only to three of them. On some versions of POV-Ray, each stream is
designated by a particular color. Text from these streams are displayed
whenever it is appropriate so there is often an intermixing of the text. The
distinction is only important if you choose to turn some of the streams off
or to direct some of the streams to text files. On some systems you may be
able to review the streams separately in their own scroll-back buffer. See
<a href="r3_2.html#r3_2_7_3">Directing Text Streams to Files</a> for details on re-directing the
streams to a text file.</p>
<p>
Here is a description of how POV-Ray uses each stream. You may use them for
whatever purpose you want except note that use of the <code>#error</code>
stream causes a fatal error after the text is displayed.</p>

<p> <strong>Debug:</strong> This stream displays debugging messages. It was
primarily designed for developers but this and other streams may also be used
by the user to display messages from within their scene files.</p>
<p>
<strong>Error:</strong> This stream displays fatal error messages. After
displaying this text, POV-Ray will terminate. When the error is a scene
parsing error, you may be shown several lines of scene text that leads up to
the error.</p>
<p>
<strong>Warning:</strong> This stream displays warning messages during the
parsing of scene files and other warnings. Despite the warning, POV-Ray can
continue to render the scene.</p>

<p>The <code>#render</code> and <code>#statistsics</code> could be accessed in previous versions.
Their output is now redirected to the <code>#debug</code> stream. 
The <code>#banner</code> and <code>#status</code> streams can not be accessed by the user.</p>

</div>
<a name="r3_3_2_7_2"></a>
<div class="content-level-h5" contains="Text Formatting" id="r3_3_2_7_2">
<h5>3.3.2.7.2 Text Formatting</h5>
<p>Some escape sequences are available to include non-printing control
characters in your text. These sequences are similar to those used in string
literals in the C programming language. The sequences are:</p>

<table SUMMARY="All character escape sequences" width="100%">
<tr>
<td width="25%"><code>&quot;\a&quot;</code></td>

<td width="65%">Bell or alarm,</td>

<td width="10%">0x07</td>
</tr>

<tr>
<td><code>&quot;\b&quot;</code></td>

<td>Backspace,</td>

<td>0x08</td>
</tr>

<tr>
<td><code>&quot;\f&quot;</code></td>

<td>Form feed,</td>

<td>0x0C</td>
</tr>

<tr>
<td><code>&quot;\n&quot;</code></td>

<td>New line (line feed)</td>

<td>0x0A</td>
</tr>

<tr>
<td><code>&quot;\r&quot;</code></td>

<td>Carriage return</td>

<td>0x0D</td>
</tr>

<tr>
<td><code>&quot;\t&quot;</code></td>

<td>Horizontal tab</td>

<td>0x09</td>
</tr>

<tr>
<td><code>&quot;\uNNNN&quot;</code></td>

<td>Unicode character code NNNN</td>

<td>0xNNNN</td>
</tr>

<tr>
<td><code>&quot;\v&quot;</code></td>

<td>Vertical tab</td>

<td>0x0B</td>
</tr>

<tr>
<td><code>&quot;\0&quot;</code></td>

<td>Null</td>

<td>0x00</td>
</tr>

<tr>
<td><code>&quot;\\&quot;</code></td>

<td>Backslash</td>

<td>0x5C</td>
</tr>

<tr>
<td><code>&quot;\'&quot;</code></td>

<td>Single quote</td>

<td>0x27</td>
</tr>

<tr>
<td><code>&quot;\&quot;&quot;</code></td>

<td>Double quote</td>

<td>0x22</td>
</tr>
</table>

<p>For example:</p>
<pre>
#debug &quot;This is one line.\nBut this is another\n&quot;
</pre>

<p>Depending on what platform you are using, they may not be fully supported
for console output. However they will appear in any text file if you
re-direct a stream to a file.</p></div>

<a name="r3_3_2_8"></a>
<div class="content-level-h4" contains="User Defined Macros" id="r3_3_2_8">
<h4>3.3.2.8 User Defined Macros</h4>

<p>POV-Ray 3.1 introduced user defined macros with parameters. This feature,
along with the ability to declare <code>#local</code> variables, turned the
POV-Ray Language into a fully functional programming language. Consequently,
it is now possible to write scene generation tools in POV-Ray's own language
that previously required external utilities.</p>

</div>
<a name="r3_3_2_8_1"></a>
<div class="content-level-h5" contains="The macro Directive" id="r3_3_2_8_1">
<h5>3.3.2.8.1 The macro Directive</h5>
<p>The syntax for declaring a macro is:</p>
<pre>
MACRO_DEFINITION:
  #macro IDENTIFIER ([PARAM_IDENT] [, PARAM_IDENT]... ) TOKENS... #end
</pre>
<p>Where <em>IDENTIFIER</em> is the name of the macro and <em>PARAM_IDENT</em> is a list of zero or more formal parameter identifiers separated by commas and enclosed by parentheses. The parentheses are required even if no parameters are specified.</p>
<p>The <em>TOKENS</em> are any number of POV-Ray keyword, identifiers, or punctuation marks which are the <em> body</em> of the macro. The body of the macro may contain almost any POV-Ray syntax items you desire. It is terminated by the <code>#end</code> directive.</p>
<p class="Note"><strong>Note:</strong> Any conditional directives such as <code>#if</code>...<code>#end</code>, <code>#while</code>...<code>#end</code>, etc. must be fully nested inside or outside the macro so that the corresponding <code>#end</code> directives pair-up properly.</p>
<p>A macro must be declared before it is invoked. All macro names are global in scope and permanent in duration. You may redefine a macro by another <code>#macro</code> directive with the same name. The previous definition is lost. Macro names respond to <code>#ifdef</code>, <code>#ifndef</code>, and <code>#undef</code> directives. See <a href="r3_3.html#r3_3_2_6_2">The #ifdef and #ifndef Directives</a> and <a href="r3_3.html#r3_3_2_2_4">Destroying Identifiers with #undef</a>.</p>

</div>
<a name="r3_3_2_8_2"></a>
<div class="content-level-h5" contains="Invoking Macros" id="r3_3_2_8_2">
<h5>3.3.2.8.2 Invoking Macros</h5>
<p>You invoke the macro by specifying the macro name followed by a list of zero or more actual parameters enclosed in parentheses and separated by commas. The number of actual parameters must match the number of formal parameters in the definition. The parentheses are required even if no parameters are specified. The syntax is:</p>
<pre>
MACRO_INVOCATION:
  MACRO_IDENTIFIER ( [ACTUAL_PARAM] [, ACTUAL_PARAM]... )
ACTUAL_PARAM:
  IDENTIFIER | RVALUE
</pre>
<p>An <em>RVALUE</em> is any value that can legally appear to the right of an equals sign in a <code>#declare</code> or <code>#local</code> declaration. See <a href="r3_3.html#r3_3_2_2_1">Declaring identifiers</a> for information on <em> RVALUE</em>.
When the macro is invoked, a new local symbol table is created. The actual parameters are assigned to formal parameter identifiers as local, temporary variables. POV-Ray jumps to the body of the macro and continues parsing until the matching <code>#end</code> directive is reached. There, the local variables created by the parameters are destroyed as well as any local
identifiers expressly created in the body of the macro. It then resumes parsing at the point where the macro was invoked. It is as though the body of the macro was cut and pasted into the scene at the point where the macro was invoked.</p>
<p class="Note"><strong>Note:</strong> It is possible to invoke a macro that was declared in another file. This is quite normal and in fact is how many <em>plug-ins</em> work (such as the popular Lens Flare macro). However, be aware that calling a macro that was declared in a file different from the one that it is being called from involves more overhead than calling one in the same file.</p>
<p>This is because POV-Ray does not tokenize and store its language. Calling a macro in another file therefore requires that the other file be opened and closed for each call. Normally, this overhead is inconsequential; however, if you are calling the macro many thousands of times, it can cause significant delays. A future version of the POV-Ray language will remove this problem.</p>
<p>Here is a simple macro that creates a window frame object when you specify the inner and outer dimensions.</p>
<pre>
#macro Make_Frame(OuterWidth,OuterHeight,InnerWidth,
        InnerHeight,Depth)
#local Horz = (OuterHeight-InnerHeight)/2;
#local Vert = (OuterWidth-InnerWidth)/2;
difference {
  box {
    &lt;0,0,0&gt;,&lt;OuterWidth,OuterHeight,Depth&gt;
    }
  box {
    &lt;Vert,Horz,-0.1&gt;,
    &lt;OuterWidth-Vert,OuterHeight-Horz,Depth+0.1&gt;
    }
  }
#end
Make_Frame(8,10,7,9,1) //invoke the macro
</pre>
<p>In this example, the macro has five float parameters. The actual parameters (the values 8, 10, 7, 9, and 1) are assigned to the five identifiers in the <code>#macro</code> formal parameter list. It is as though you had used the following five lines of code.</p>
<pre>
#local OuterWidth = 8;
#local OuterHeight = 10;
#local InnerWidth, = 7;
#local InnerHeight = 9;
#local Depth = 1;
</pre>
<p>These five identifiers are stored in the same symbol table as any other local identifier such as <code>Horz</code> or <code>Vert</code> in this example. The parameters and local variables are all destroyed when the <code>#end</code> statement is reached. See <a href="r3_3.html#r3_3_2_2_3">Identifier Name Collisions</a> for a detailed discussion of how local identifiers, parameters, and global identifiers work when a local identifier has the same name as a previously declared identifier.</p>

</div>
<a name="r3_3_2_8_3"></a>
<div class="content-level-h5" contains="Are POV-Ray Macros a Function or a Macro?" id="r3_3_2_8_3">
<h5>3.3.2.8.3 Are POV-Ray Macros a Function or a Macro?</h5>
<p>POV-Ray macros are a strange mix of macros and functions. In traditional
computer programming languages, a macro works entirely by token substitution.
The body of the routine is inserted into the invocation point by simply
copying the tokens and parsing them as if they had been cut and pasted in
place. Such cut-and-paste substitution is often called <em>macro
substitution</em> because it is what macros are all about. In this respect,
POV-Ray macros are exactly like traditional macros in that they use macro
substitution for the body of the macro. However traditional macros also use
this cut-and-paste substitution strategy for parameters but POV-Ray does
not.</p>
<p>
Suppose you have a macro in the C programming language <code>
Typical_Cmac(Param)</code> and you invoke it as <code>Typical_Cmac(else
A=B)</code>. Anywhere that <code>Param</code> appears in the macro body, the
four tokens <code>else</code>, <code>A</code>, <code>=</code>, and <code>
B</code> are substituted into the program code using a cut-and-paste
operation. No type checking is performed because anything is legal. The
ability to pass an arbitrary group of tokens via a macro parameter is a
powerful (and sadly often abused) feature of traditional macros.</p>
<p>
After careful deliberation, we have decided against this type of parameters
for our macros. The reason is that POV-Ray uses commas more frequently in its
syntax than do most programming languages. Suppose you create a macro that is
designed to operate on one vector and two floats. It might be defined <code>
OurMac(V,F1,F2)</code>. If you allow arbitrary strings of tokens and invoke a
macro such as <code>OurMac(&lt;1,2,3&gt;,4,5)</code> then it is impossible to
tell if this is a vector and two floats or if its 5 parameters with the two
tokens <code>&lt;</code> and <code>1</code> as the first parameter. If we
design the macro to accept 5 parameters then we cannot invoke it like this...
<code>OurMac(MyVector,4,5)</code>.</p>
<p>
Function parameters in traditional programming languages do not use token
substitution to pass values. They create temporary, local variables to store
parameters that are either constant values or identifier references which are
in effect a pointer to a variable. POV-Ray macros use this function-like
system for passing parameters to its macros. In our example <code>
OurMac(&lt;1,2,3&gt;,4,5)</code>, POV-Ray sees the <code>&lt;</code> and
knows it must be the start of a vector. It parses the whole vector expression
and assigns it to the first parameter exactly as though you had used the
statement <code>#local V=&lt;1,2,3&gt;;</code>.</p>
<p>
Although we say that POV-Ray parameters are more like traditional function
parameters than macro parameters, there still is one difference. Most
languages require you to declare the type of each parameter in the definition
before you use it but POV-Ray does not. This should be no surprise because
most languages require you to declare the type of any identifier before you
use it but POV-Ray does not. This means that if you pass the wrong type value
in a POV-Ray macro parameter, it may not generate an error until you
reference the identifier in the macro body. No type checking is performed as
the parameter is passed. So in this very limited respect, POV-Ray parameters
are somewhat macro-like but are mostly function-like.</p>

</div>
<a name="r3_3_2_8_4"></a>
<div class="content-level-h5" contains="Returning a Value Like a Function" id="r3_3_2_8_4">
<h5>3.3.2.8.4 Returning a Value Like a Function</h5>
<p>POV-Ray macros have a variety of uses. Like most macros, they provide a
parameterized way to insert arbitrary code into a scene file. However most
POV-Ray macros will be used like functions or procedures in a traditional
programming language. Macros are designed to fill all
of these roles.</p>
<p>
When the body of a macro consists of statements that create an entire item
such as an object, texture, etc. then the macro acts like a function which
returns a single value. The <code>Make_Frame</code> macro example in the
section <a href="r3_3.html#r3_3_2_8_2">Invoking Macros</a> above is such a macro which returns a
value that is an object. Here are some examples of how you might invoke
it.</p>
<pre>
union {  //make a union of two objects
  object{ Make_Frame(8,10,7,9,1) translate  20*x}
  object{ Make_Frame(8,10,7,9,1) translate -20*x}
  }
#declare BigFrame = object{ Make_Frame(8,10,7,9,1)}
#declare SmallFrame = object{ Make_Frame(5,4,4,3,0.5)}
</pre>

<p>Because no type checking is performed on parameters and because the
expression syntax for floats, vectors, and colors is identical, you can
create clever macros which work on all three. See the sample scene <code>
MACRO3.POV</code> which includes this macro to interpolate values.</p>
<pre>
// Define the macro.  Parameters are:
//   T:  Middle value of time
//   T1: Initial time
//   T2: Final time
//   P1: Initial position (may be float, vector or color)
//   P2: Final position (may be float, vector or color)
//   Result is a value between P1 and P2 in the same proportion
//    as T is between T1 and T2.
#macro Interpolate(T,T1,T2,P1,P2)
  (P1+(T1+T/(T2-T1))*(P2-P1))
#end
</pre>

<p>You might invoke it with <code>P1</code> and <code>P2</code> as floats,
vectors, or colors as follows.</p>
<pre>
sphere{
  Interpolate(I,0,15,&lt;2,3,4&gt;,&lt;9,8,7&gt;), //center location is vector
  Interpolate(I,0,15,3.0,5.5)          //radius is float
  pigment {
    color Interpolate(I,0,15,rgb&lt;1,1,0&gt;,rgb&lt;0,1,1&gt;)
    }
  }
</pre>

<p>As the float value <code>I</code> varies from 0 to 15, the location,
radius, and color of the sphere vary accordingly.</p>
<p>
There is a danger in using macros as functions. In a traditional programming
language function, the result to be returned is actually assigned to a
temporary variable and the invoking code treats it as a variable of a given
type. However macro substitution may result in invalid or undesired syntax.
The definition of the macro <code>Interpolate</code> above has an
outermost set of parentheses. If those parentheses are omitted, it will not
matter in the examples above, but what if you do this...</p>
<pre>
#declare Value = Interpolate(I,0,15,3.0,5.5)*15;
</pre>

<p>The end result is as if you had done...</p>
<pre>
#declare Value = P1+(T1+T/(T2-T1))*(P2-P1) * 15;
</pre>

<p>which is syntactically legal but not mathematically correct because the
<code>P1</code> term is not multiplied. The parentheses in the original
example solves this problem. The end result is as if you had done...</p>
<pre>
#declare Value = (P1+(T1+T/(T2-T1))*(P2-P1)) * 15;
</pre>

<p>which is correct.</p>

</div>
<a name="r3_3_2_8_5"></a>
<div class="content-level-h5" contains="Returning Values Via Parameters" id="r3_3_2_8_5">
<h5>3.3.2.8.5 Returning Values Via Parameters</h5>
<p>Sometimes it is necessary to have a macro return more than one value or
you may simply prefer to return a value via a parameter as is typical in
traditional programming language procedures. POV-Ray macros are capable of
returning values this way. The syntax for POV-Ray macro parameters says that
the actual parameter may be an <em>IDENTIFIER</em> or an <em> RVALUE</em>.
Values may only be returned via a parameter if the parameter is an <em>
IDENTIFIER</em>. Parameters that are <em>RVALUES</em> are constant values
that cannot return information. An <em>RVALUE</em> is anything that legally
may appear to the right of an equals sign in a <code>#declare</code> or
<code>#local</code> directive. For example consider the following trivial
macro which rotates an object about the x-axis.</p>
<pre>
#macro Turn_Me(Stuff,Degrees)
  #declare Stuff = object{Stuff rotate x*Degrees}
#end
</pre>

<p>This attempts to re-declare the identifier <code>Stuff</code> as the
rotated version of the object. However the macro might be invoked with <code>
Turn_Me(box{0,1},30)</code> which uses a box object as an <em> RVALUE</em>
parameter. This will not work because the box is not an identifier. You can
however do this</p>
<pre>
#declare MyObject=box{0,1}
Turn_Me(MyObject,30)
</pre>

<p>The identifier <code>MyObject</code> now contains the rotated box.</p>
<p>
See <a href="r3_3.html#r3_3_2_2_3">Identifier Name Collisions</a> for a detailed discussion of how
local identifiers, parameters, and global identifiers work when a local
identifier has the same name as a previously declared identifier.</p>
<p>
While it is obvious that <code>MyObject</code> is an identifier and <code>
box{0,1}</code> is not, it should be noted that <code>
Turn_Me(object{MyObject},30)</code> will not work because <code>
object{MyObject}</code> is considered an object statement and is not a <em>
pure</em> identifier. This mistake is more likely to be made with float
identifiers versus float expressions. Consider these examples.</p>
<pre>
#declare Value=5.0;
MyMacro(Value)     //MyMacro can change the value of Value but...
MyMacro(+Value)    //This version and the rest are not lone
MyMacro(Value+0.0) // identifiers. They are float expressions
MyMacro(Value*1.0) // which cannot be changed.
</pre>

<p>Although all four invocations of <code>MyMacro</code> are passed the value
5.0, only the first may modify the value of the identifier.</p></div>

</div>

</div>
</body>
</html>