Show megapov0121.html syntax highlighted
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>MegaPOV Documentation</title><link rel="stylesheet" href="megapov.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><meta name="description" content="
This documentation contains a complete set of information about MegaPOV.
Here you can find descriptions from either script and patch writer point
of view. This work is supposed to be an addition to complete the POV-Ray Documentation.
"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id2437388"></a>MegaPOV Documentation</h1></div><div><h2 class="subtitle">
<img src="img/titlepage.png">
</h2></div><div><div class="author"><h3 class="author"><span class="surname">MegaPOV-Team</span></h3><div class="affiliation"><div class="address"><p><tt class="email"><<a href="mailto:megapov@megapov.inetart.net">megapov@megapov.inetart.net</a>></tt></p></div></div></div></div><div><p class="releaseinfo">MegaPOV 1.2.1</p></div><div><p class="copyright">Copyright © 2002-2005 MegaPOV-Team</p></div><div><p class="pubdate">24 August 2005</p></div><div><div class="abstract"><p class="title"><b>Abstract</b></p><p>
This documentation contains a complete set of information about MegaPOV.
Here you can find descriptions from either script and patch writer point
of view. This work is supposed to be an addition to complete the <a href="http://www.povray.org/documentation/" target="_top"><span class="trademark">POV-Ray</span>™ Documentation</a>.
</p></div></div></div><div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="chapter"><a href="#introduction">1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#what">1.1. What is MegaPOV?</a></span></dt><dt><span class="section"><a href="#news">1.2. What's new</a></span></dt><dd><dl><dt><span class="section"><a href="#latest_changes">1.2.1. MegaPOV 1.2.1 - 24 August 2005</a></span></dt><dt><span class="section"><a href="#id2438813">1.2.2. MegaPOV 1.2 - 4 July 2005</a></span></dt><dt><span class="section"><a href="#id2436923">1.2.3. Previous versions of MegaPOV</a></span></dt></dl></dd><dt><span class="section"><a href="#why">1.3. Why should i use MegaPOV?</a></span></dt><dt><span class="section"><a href="#enable">1.4. Enabling MegaPOV features</a></span></dt><dt><span class="section"><a href="#where">1.5. Where do I find MegaPOV?</a></span></dt><dd><dl><dt><span class="section"><a href="#id2437092">1.5.1. Sources and binaries</a></span></dt><dt><span class="section"><a href="#id2437126">1.5.2. Documentation and samples</a></span></dt><dt><span class="section"><a href="#discussion">1.5.3. Discussions</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#references">2. MegaPOV References</a></span></dt><dd><dl><dt><span class="section"><a href="#options">2.1. Options</a></span></dt><dd><dl><dt><span class="section"><a href="#frame_step">2.1.1. Frame_Step</a></span></dt><dt><span class="section"><a href="#hdr_write">2.1.2. HDR (High Dynamic Range) image output</a></span></dt></dl></dd><dt><span class="section"><a href="#expressions">2.2. Expressions</a></span></dt><dd><dl><dt><span class="section"><a href="#id2499336">2.2.1. Language directives</a></span></dt><dt><span class="section"><a href="#tokens">2.2.2. Built-in tokens</a></span></dt><dt><span class="section"><a href="#functions">2.2.3. Functions</a></span></dt><dt><span class="section"><a href="#internal_functions">2.2.4. Internal functions</a></span></dt><dt><span class="section"><a href="#polynomial_solver">2.2.5. Polynomial solver in parser</a></span></dt><dt><span class="section"><a href="#splines">2.2.6. Splines</a></span></dt><dt><span class="section"><a href="#transforms">2.2.7. Transforms</a></span></dt></dl></dd><dt><span class="section"><a href="#camera">2.3. Camera</a></span></dt><dd><dl><dt><span class="section"><a href="#user_defined_camera">2.3.1. user_defined camera type</a></span></dt></dl></dd><dt><span class="section"><a href="#objects">2.4. Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#common_features">2.4.1. Common features</a></span></dt><dt><span class="section"><a href="#text">2.4.2. Text</a></span></dt><dt><span class="section"><a href="#cloth">2.4.3. Cloth simulation</a></span></dt><dt><span class="section"><a href="#isosurface">2.4.4. Isosurface</a></span></dt><dt><span class="section"><a href="#light">2.4.5. Light Sources</a></span></dt></dl></dd><dt><span class="section"><a href="#effects">2.5. Effects</a></span></dt><dd><dl><dt><span class="section"><a href="#glow">2.5.1. Glow</a></span></dt><dt><span class="section"><a href="#motion_blur">2.5.2. Motion blur</a></span></dt><dt><span class="section"><a href="#fur">2.5.3. Fur</a></span></dt></dl></dd><dt><span class="section"><a href="#patterns">2.6. Textures and patterns</a></span></dt><dd><dl><dt><span class="section"><a href="#aoi_pattern">2.6.1. Angle of incidence</a></span></dt><dt><span class="section"><a href="#listed_pattern">2.6.2. Listed pattern</a></span></dt><dt><span class="section"><a href="#projection_pattern">2.6.3. Projection pattern</a></span></dt><dt><span class="section"><a href="#displace_warp">2.6.4. Displace warp for patterns</a></span></dt><dt><span class="section"><a href="#noisepigment">2.6.5. Noise pigment</a></span></dt><dt><span class="section"><a href="#hdr">2.6.6. HDR (High Dynamic Range) image type</a></span></dt><dt><span class="section"><a href="#bicubic_image">2.6.7. Bicubic interpolation for images</a></span></dt><dt><span class="section"><a href="#camera_view">2.6.8. New camera_view pigment</a></span></dt></dl></dd><dt><span class="section"><a href="#global_settings">2.7. Global Settings</a></span></dt><dd><dl><dt><span class="section"><a href="#film_exposure">2.7.1. Film exposure simulation</a></span></dt><dt><span class="section"><a href="#tone_mapping">2.7.2. Custom tone mapping function</a></span></dt><dt><span class="section"><a href="#radiosity">2.7.3. Radiosity</a></span></dt><dt><span class="section"><a href="#mechsim">2.7.4. Mechanics simulation patch</a></span></dt><dt><span class="section"><a href="#post_processing">2.7.5. Post processing</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#include">3. MegaPOV Include files</a></span></dt><dd><dl><dt><span class="section"><a href="#mp_functions.inc">3.1. The 'mp_functions.inc' include file</a></span></dt><dt><span class="section"><a href="#mp_consts.inc">3.2. The 'mp_consts.inc' include file</a></span></dt><dd><dl><dt><span class="section"><a href="#mp_consts_camera_view">3.2.1. Output types for camera_view pigment</a></span></dt></dl></dd><dt><span class="section"><a href="#mp_types.inc">3.3. The 'mp_types.inc' include file</a></span></dt><dd><dl><dt><span class="section"><a href="#id2553742">3.3.1. The Type_Of(Id) macro</a></span></dt><dt><span class="section"><a href="#id2555017">3.3.2. The Type_Of_Spline(Id) macro</a></span></dt><dt><span class="section"><a href="#id2555084">3.3.3. The Type_Of_Object(Id) macro</a></span></dt><dt><span class="section"><a href="#id2555156">3.3.4. The Type_Of_Camera(Id) macro</a></span></dt></dl></dd><dt><span class="section"><a href="#mechsim.inc">3.4. The 'mechsim.inc' include file</a></span></dt><dd><dl><dt><span class="section"><a href="#mechsim_inc_general">3.4.1. general aspects</a></span></dt><dt><span class="section"><a href="#mechsim_inc_const">3.4.2. constants</a></span></dt><dt><span class="section"><a href="#mechsim_inc_vector_function">3.4.3. The Vector_Function() macro</a></span></dt><dt><span class="section"><a href="#mechsim_inc_object">3.4.4. The Object generation macros</a></span></dt><dt><span class="section"><a href="#mechsim_inc_topology">3.4.5. The topology generation macros</a></span></dt></dl></dd><dt><span class="section"><a href="#inc_pprocess.inc">3.5. The 'pprocess.inc' include file</a></span></dt><dd><dl><dt><span class="section"><a href="#post_proc_macros">3.5.1. Macros with effects</a></span></dt><dt><span class="section"><a href="#shared_effects">3.5.2. Shared predefined effects</a></span></dt></dl></dd><dt><span class="section"><a href="#tone_mapping.inc">3.6. The 'tone_mapping.inc' include file</a></span></dt><dd><dl><dt><span class="section"><a href="#id2567246">3.6.1. The Clip_Colors() macro</a></span></dt><dt><span class="section"><a href="#id2568434">3.6.2. The Film_Exposure() macro</a></span></dt><dt><span class="section"><a href="#id2568502">3.6.3. The Film_Exposure_Invert() macro</a></span></dt><dt><span class="section"><a href="#id2568567">3.6.4. The Gamma_Correct() macro</a></span></dt><dt><span class="section"><a href="#id2568630">3.6.5. The Brightness_Contrast() macro</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#tutorials">4. Tutorials</a></span></dt><dd><dl><dt><span class="section"><a href="#tutorials_objects">4.1. Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#id2573903">4.1.1. Cloth simulation</a></span></dt></dl></dd><dt><span class="section"><a href="#tutorials_simulation">4.2. Simulation</a></span></dt><dd><dl><dt><span class="section"><a href="#mechsim_tutorial">4.2.1. Mechanics simulation tutorial</a></span></dt></dl></dd><dt><span class="section"><a href="#tutorials_hdri">4.3. HDRI (High dynamic range illumination)</a></span></dt><dd><dl><dt><span class="section"><a href="#hdri_tutorial">4.3.1. HDRI tutorial</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#internals">5. Internals</a></span></dt><dd><dl><dt><span class="section"><a href="#sources">5.1. Sources</a></span></dt><dd><dl><dt><span class="section"><a href="#architecture">5.1.1. Understanding the POV-Ray source structure</a></span></dt><dt><span class="section"><a href="#patching">5.1.2. Creating your own patches</a></span></dt></dl></dd><dt><span class="section"><a href="#binaries">5.2. Binaries</a></span></dt><dd><dl><dt><span class="section"><a href="#windows_compile">5.2.1. compiling on Windows systems</a></span></dt><dt><span class="section"><a href="#mac_compile">5.2.2. compiling on Macintosh systems</a></span></dt><dt><span class="section"><a href="#unix_compile">5.2.3. compiling on Unix systems</a></span></dt></dl></dd><dt><span class="section"><a href="#parser">5.3. Parser</a></span></dt><dd><dl><dt><span class="section"><a href="#internals_tokens">5.3.1. Adding tokens</a></span></dt></dl></dd><dt><span class="section"><a href="#internals_patterns">5.4. Patterns</a></span></dt><dd><dl><dt><span class="section"><a href="#internals_mem_patterns">5.4.1. Reducing memory usage</a></span></dt></dl></dd><dt><span class="section"><a href="#internals_expressions">5.5. Expressions</a></span></dt><dd><dl><dt><span class="section"><a href="#internals_polynomials">5.5.1. Polynomial solver</a></span></dt></dl></dd><dt><span class="section"><a href="#multiformat_documentation">5.6. Multi-format Documentation with DocBook</a></span></dt><dd><dl><dt><span class="section"><a href="#docbook_environment">5.6.1. Environment for DocBook documentation</a></span></dt><dt><span class="section"><a href="#docbook_editing">5.6.2. Editing DocBook documentation</a></span></dt><dt><span class="section"><a href="#docbook_conversion">5.6.3. Converting DocBook documents</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#appendices">6. Appendices</a></span></dt><dd><dl><dt><span class="section"><a href="#megapov_authors">6.1. MegaPOV-Team</a></span></dt><dt><span class="section"><a href="#contribution">6.2. Contribution</a></span></dt><dt><span class="section"><a href="#old_megapov">6.3. MegaPOV before POV-Ray 3.6</a></span></dt><dd><dl><dt><span class="section"><a href="#id2600959">6.3.1. MegaPOV history</a></span></dt><dt><span class="section"><a href="#old_authors">6.3.2. Authors of patches in MegaPOV below version 1.0</a></span></dt></dl></dd></dl></dd><dt><span class="index"><a href="#megapov_index">Index</a></span></dt></dl></div><div class="list-of-figures"><p><b>List of Figures</b></p><dl><dt>2.1. <a href="#id2526851">Force based environment collisions illustration</a></dt><dt>2.2. <a href="#id2526910">Impact based environment collisions illustration</a></dt><dt>2.3. <a href="#id2527077">Mass-mass collisions illustration</a></dt><dt>2.4. <a href="#id2527095">Mass-face collisions illustration</a></dt><dt>2.5. <a href="#id2527112">Connection-connection collisions illustration</a></dt><dt>3.1. <a href="#id2560478">patch connection numbers</a></dt></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>2.1. <a href="#id2501699">The following time formatting strings are available:</a></dt><dt>2.2. <a href="#id2519204">HDR image ambient variations</a></dt><dt>2.3. <a href="#id2520929">Exposure influence comparison</a></dt><dt>2.4. <a href="#id2521418">internal sequence</a></dt><dt>2.5. <a href="#id2521534">halton sequence</a></dt><dt>3.1. <a href="#id2557362">MechSim_Show_Grid() variations</a></dt><dt>3.2. <a href="#id2557746">MechSim_Show_Patch() variations</a></dt><dt>3.3. <a href="#id2558703">MechSim_Show_Patch() variations</a></dt><dt>4.1. <a href="#id2582523">Example for high dynamic range of raytraced scene</a></dt><dt>4.2. <a href="#id2582636">Views and illumination maps from the scene</a></dt><dt>4.3. <a href="#id2582734">The illumination maps being used in a scene</a></dt><dt>6.1. <a href="#id2598230">Current MegaPOV-Team Members</a></dt></dl></div><div class="list-of-examples"><p><b>List of Examples</b></p><dl><dt>2.1. <a href="#id2499847">Influence of Frame_Step on generated files</a></dt><dt>2.2. <a href="#id2499366">Using the #set directive</a></dt><dt>2.3. <a href="#id2501642">date function usage</a></dt><dt>2.4. <a href="#id2501537">Using the timer function</a></dt><dt>2.5. <a href="#id2501223">Averaging frames with output_filename function</a></dt><dt>2.6. <a href="#id2507860">Polynomial solver usage</a></dt><dt>2.7. <a href="#id2506293">Conversion from the sor object definition to the sor_spline type in spline</a></dt><dt>2.8. <a href="#id2511852">Alternative forms of user_defined camera type definition</a></dt><dt>2.9. <a href="#id2519179">HDR image example</a></dt><dt>2.10. <a href="#id2519018">Bicubic interpolation for an image map</a></dt><dt>2.11. <a href="#id2521004">Various values for film exposure simulations</a></dt><dt>2.12. <a href="#id2520810">Exponential tone mapping</a></dt><dt>2.13. <a href="#id2526500">Adaptive time stepping</a></dt><dt>2.14. <a href="#id2527253">An example for a complete collision{} section:</a></dt><dt>2.15. <a href="#id2528291">Mass interaction</a></dt><dt>2.16. <a href="#id2528416">Constant downward force in Mechanics simulation</a></dt><dt>2.17. <a href="#id2528522">Attachment in Mechanics simulation</a></dt><dt>2.18. <a href="#id2529508">The simulation data file format</a></dt><dt>2.19. <a href="#id2534727">The internal post process function asking for red color at the middle of image</a></dt><dt>2.20. <a href="#id2534858">Post processing which does nothing (only duplicate the original image)</a></dt><dt>2.21. <a href="#id2535014">Post processing which turns the rendered image into a gray scale image</a></dt><dt>3.1. <a href="#id2556810">MechSim_Show_Objects() macro usage</a></dt><dt>3.2. <a href="#id2557036">MechSim_Show_All_Objects() macro usage</a></dt><dt>3.3. <a href="#id2557321">MechSim_Show_Grid() macro usage</a></dt><dt>3.4. <a href="#id2557706">MechSim_Show_Patch() macro usage</a></dt><dt>3.5. <a href="#id2558057">MechSim_Show_Sphere() macro usage</a></dt><dt>3.6. <a href="#id2558338">VE_Elements array generation</a></dt><dt>3.7. <a href="#id2558833">MechSim_Generate_Grid_Fn() macro usage</a></dt><dt>3.8. <a href="#id2559157">MechSim_Generate_Grid() macro usage</a></dt><dt>3.9. <a href="#id2559477">MechSim_Generate_Grid_Std() macro usage</a></dt><dt>3.10. <a href="#id2559797">MechSim_Generate_Box() macro usage</a></dt><dt>3.11. <a href="#id2560134">MechSim_Generate_Block() macro usage</a></dt><dt>3.12. <a href="#id2560495">MechSim_Generate_Patch() macro usage</a></dt><dt>3.13. <a href="#id2560820">MechSim_Generate_Patch_Std() macro usage</a></dt><dt>3.14. <a href="#id2561068">MechSim_Generate_Line() macro usage</a></dt><dt>3.15. <a href="#id2561279">MechSim_Generate_Line() macro usage</a></dt><dt>3.16. <a href="#id2561512">MechSim_Generate_Sphere() macro usage</a></dt><dt>3.17. <a href="#id2567694">Find edge macro</a></dt><dt>5.1. <a href="#id2588585">Typical patch markup</a></dt></dl></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="introduction"></a>Chapter 1. Introduction</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#what">1.1. What is MegaPOV?</a></span></dt><dt><span class="section"><a href="#news">1.2. What's new</a></span></dt><dd><dl><dt><span class="section"><a href="#latest_changes">1.2.1. MegaPOV 1.2.1 - 24 August 2005</a></span></dt><dt><span class="section"><a href="#id2438813">1.2.2. MegaPOV 1.2 - 4 July 2005</a></span></dt><dt><span class="section"><a href="#id2436923">1.2.3. Previous versions of MegaPOV</a></span></dt></dl></dd><dt><span class="section"><a href="#why">1.3. Why should i use MegaPOV?</a></span></dt><dt><span class="section"><a href="#enable">1.4. Enabling MegaPOV features</a></span></dt><dt><span class="section"><a href="#where">1.5. Where do I find MegaPOV?</a></span></dt><dd><dl><dt><span class="section"><a href="#id2437092">1.5.1. Sources and binaries</a></span></dt><dt><span class="section"><a href="#id2437126">1.5.2. Documentation and samples</a></span></dt><dt><span class="section"><a href="#discussion">1.5.3. Discussions</a></span></dt></dl></dd></dl></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="what"></a>1.1. What is MegaPOV?</h2></div></div><div></div></div><p xmlns="">
MegaPOV is a custom and unofficial patched version of <span class="trademark">POV-Ray</span>™.
It is a compilation of separately released patches and techniques
released within the <span class="trademark">POV-Ray</span>™ Community and dedicated work of the MegaPOV-Team.
</p><p xmlns="">
Many patches from MegaPOV 0.7 were included in official <span class="trademark">POV-Ray</span>™ 3.5.
It will probably not be the case with patches included in MegaPOV 1.0 and later
in such a large scale because current official <span class="trademark">POV-Ray</span>™ development involves larger
changes that make it less straight away to integrate MegaPOV patches.
</p></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="news"></a>1.2. What's new</h2></div></div><div></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="latest_changes"></a>1.2.1. MegaPOV 1.2.1 - 24 August 2005</h3></div></div><div></div></div><p xmlns="">
MegaPOV 1.2.1 is a bugfix release and contain the following changes:
</p><div xmlns="" class="orderedlist"><ol type="1" compact><li>Several Mechsim bugfixes</li><li>Improved compatibility of the PPM/PGM reader with the standard</li><li>Resolution of problems of the Windows version</li></ol></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="id2438813"></a>1.2.2. MegaPOV 1.2 - 4 July 2005</h3></div></div><div></div></div><p xmlns="">
MegaPOV 1.2 includes the following new features and changes:
</p><div xmlns="" class="orderedlist"><ol type="1" compact><li>Control up to which trace level area lights are calculated (see <a href="#area_light_mtl" title="2.4.5.1. Area Light max_trace_level">Section 2.4.5.1, “Area Light max_trace_level”</a>)</li><li>Bicubic interpolation for images (see <a href="#bicubic_image" title="2.6.7. Bicubic interpolation for images">Section 2.6.7, “Bicubic interpolation for images”</a>)</li><li>Custom tone mapping feature that offers detailed control of how the
colors are mapped to the resulting image and how this interacts with antialiasing (see <a href="#tone_mapping" title="2.7.2. Custom tone mapping function">Section 2.7.2, “Custom tone mapping function”</a>)</li><li>Radiosity improvements:
<div class="itemizedlist"><ul type="disc" compact><li>new adaptive pretrace mode (see <a href="#radiosity_adaptive_pretrace" title="2.7.3.6. Adaptive radiosity pretrace">Section 2.7.3.6, “Adaptive radiosity pretrace”</a>)</li><li>adaptive search radius/<tt class="function">error_bound</tt> (see <a href="#radiosity_error_bound_adaptive" title="2.7.3.4. Adaptive radiosity error_bound">Section 2.7.3.4, “Adaptive radiosity error_bound”</a>)</li><li>more detailed radiosity statistics (see <a href="#radiosity_additional_statistics" title="2.7.3.5. Additional radiosity statistics">Section 2.7.3.5, “Additional radiosity statistics”</a>)</li><li>sampling visualizations (see <a href="#radiosity_visualize" title="2.7.3.7. Radiosity visualizations">Section 2.7.3.7, “Radiosity visualizations”</a>)</li><li>bug fixes for randomized radiosity sampling directions (see <a href="#radiosity_randomize" title="2.7.3.3. Randomized radiosity sampling directions">Section 2.7.3.3, “Randomized radiosity sampling directions”</a>)</li></ul></div>
</li><li>Mechsim changes (see <a href="#mechsim" title="2.7.4. Mechanics simulation patch">Section 2.7.4, “Mechanics simulation patch”</a>):
<div class="itemizedlist"><ul type="disc" compact><li>improved collision bounding/hashing system</li><li>viscoelastic connections</li><li>global fixation in 1 or 2 dimensions</li><li>attachments can be limited to 1 or two dimensions (free movement in the others)</li><li>adaptive time stepping for 4th order Runge-Kutta method</li><li>new simulation data file format</li><li>custom forces that can be applied to individual masses</li><li>more detailed simulation statistics</li><li>access to simulation forces from SDL</li><li>various bug fixes and improvements</li></ul></div>
</li><li>Bug fix for problem with alpha channel output and bright colors</li><li>Bug fix <tt class="function">crand</tt> in textures resulting in negative color values</li></ol></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="id2436923"></a>1.2.3. Previous versions of MegaPOV</h3></div></div><div></div></div><p xmlns="">
For an overview of the previous versions, (see <a href="#old_megapov" title="6.3. MegaPOV before POV-Ray 3.6">Section 6.3, “MegaPOV before POV-Ray 3.6”</a>)
</p></div></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="why"></a>1.3. Why should i use MegaPOV?</h2></div></div><div></div></div><p xmlns="">
In case you are new to <span class="trademark">POV-Ray</span>™ and maybe have not even used the official <span class="trademark">POV-Ray</span>™ before it is
not recommended to use MegaPOV. Instead get the official <span class="trademark">POV-Ray</span>™ from the <a href="http://www.povray.org/" target="_top"><span class="trademark">POV-Ray</span>™ website</a>.
</p><p xmlns="">
MegaPOV will be interesting for more advanced <span class="trademark">POV-Ray</span>™ users who are particularly interested
in the additional functionality the patches offer. We try to ensure a relatively high quality of the
patches added to MegaPOV but still some of these patches are still under development
so you have to expect that not everything will run as smoothly as on official <span class="trademark">POV-Ray</span>™ and that features
will possibly change in future versions.
</p><p xmlns="">
Some people may wonder why a MegaPOV version is still maintained when most MegaPOV features have been incorporated and
improved in <span xmlns="" class="trademark">POV-Ray</span>™ 3.5. Here are some reasons why:
</p><div xmlns="" class="itemizedlist"><ul type="disc" compact><li>There are already several patched versions of <span class="trademark">POV-Ray</span>™ 3.5;</li><li>Many patched versions are only available for a specific platform;</li><li>You often need to switch between patched versions for different features;</li><li>The next update of <span class="trademark">POV-Ray</span>™ will probably take some time;</li><li>MegaPOV is a public test version. Features which prove to be popular and more or less bug free might get the
attention of the <span class="trademark">POV-Team</span>™ and make it into the next <span class="trademark">POV-Ray</span>™.</li></ul></div><p xmlns="">
So the MegaPOV-Team collects available patches, tries to merge them into one
patch collection and makes it available for the most common platforms.
</p></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="enable"></a>1.4. Enabling MegaPOV features</h2></div></div><div></div></div><p xmlns="">
MegaPOV features are enabled by using:
</p><pre xmlns="" class="programlisting">#<tt class="function">version</tt> unofficial megapov 1.2; // version number may be different</pre><p xmlns="">
The new features are disabled by default, and only the official version's syntax will be accepted. The above line of POV code must be included
in every include file with MegaPOV features as well, not just the main POV file.
Once the unofficial features have been enabled, they can be again disabled by using:
</p><pre xmlns="" class="programlisting">#version 3.6;</pre><p xmlns="">
This is useful to allow backwards compatibility for some features.
</p></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="where"></a>1.5. Where do I find MegaPOV?</h2></div></div><div></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="id2437092"></a>1.5.1. Sources and binaries</h3></div></div><div></div></div><p xmlns="">
Packages with compiled binaries are available for the most common
platforms. They can be obtained at the
<a xmlns="" href="http://megapov.inetart.net/" target="_top">MegaPOV site</a>
where you can also find the source code.
</p><div xmlns="" class="literallayout"><p><br>
</p></div><p xmlns="">The Mac version with its special user interface is maintained separately on
<a xmlns="" href="http://users.skynet.be/smellenbergh/" target="_top">Smellenbergh's site</a>.
</p></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="id2437126"></a>1.5.2. Documentation and samples</h3></div></div><div></div></div><p xmlns="">
An online version of the MegaPOV documentation as well as downloadable
archives in various formats are located at the
<a href="http://megapov.inetart.net/documentation/" target="_top">MegaPOV site - documentation section</a>.
</p><p xmlns="">
A preview of the samples coming with MegaPOV can be found in our
<a href="http://megapov.inetart.net/samples.html" target="_top">demo section</a>.
The thumbnails there have a link to a larger image (640*480)
and an mpeg file in case of animations and some description is available there as well.
</p><div xmlns="" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="icons/note.gif"></td><th align="left">Note</th></tr><tr><td colspan="2" align="left" valign="top"><p>
None of the MegaPOV packages includes the official <span class="trademark">POV-Ray</span>™ documentation, samples
and include files although these are essential for using MegaPOV. If you do not
already have installed <span class="trademark">POV-Ray</span>™ you should get the official version from the
<a href="http://www.povray.org/" target="_top"><span class="trademark">POV-Ray</span>™ website</a>.
</p></td></tr></table></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="discussion"></a>1.5.3. Discussions</h3></div></div><div></div></div><p xmlns="">
We don't maintain our own forum for discussions.
MegaPOV is an unofficial patch to <span class="trademark">POV-Ray</span>™
and the MegaPOV-Team is just part of the <span class="trademark">POV-Ray</span>™ Community.
That's why you can use the povray.unofficial.patches group
for discussions related to MegaPOV.
You can also use povray.binaries.* and povray.text.* groups
to upload files related to MegaPOV. All mentioned groups
are located on <a href="news://news.povray.org" target="_top">news.povray.org</a>.
</p></div></div></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="references"></a>Chapter 2. MegaPOV References</h2></div></div><div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#options">2.1. Options</a></span></dt><dd><dl><dt><span class="section"><a href="#frame_step">2.1.1. Frame_Step</a></span></dt><dt><span class="section"><a href="#hdr_write">2.1.2. HDR (High Dynamic Range) image output</a></span></dt></dl></dd><dt><span class="section"><a href="#expressions">2.2. Expressions</a></span></dt><dd><dl><dt><span class="section"><a href="#id2499336">2.2.1. Language directives</a></span></dt><dt><span class="section"><a href="#tokens">2.2.2. Built-in tokens</a></span></dt><dt><span class="section"><a href="#functions">2.2.3. Functions</a></span></dt><dt><span class="section"><a href="#internal_functions">2.2.4. Internal functions</a></span></dt><dt><span class="section"><a href="#polynomial_solver">2.2.5. Polynomial solver in parser</a></span></dt><dt><span class="section"><a href="#splines">2.2.6. Splines</a></span></dt><dt><span class="section"><a href="#transforms">2.2.7. Transforms</a></span></dt></dl></dd><dt><span class="section"><a href="#camera">2.3. Camera</a></span></dt><dd><dl><dt><span class="section"><a href="#user_defined_camera">2.3.1. user_defined camera type</a></span></dt></dl></dd><dt><span class="section"><a href="#objects">2.4. Objects</a></span></dt><dd><dl><dt><span class="section"><a href="#common_features">2.4.1. Common features</a></span></dt><dt><span class="section"><a href="#text">2.4.2. Text</a></span></dt><dt><span class="section"><a href="#cloth">2.4.3. Cloth simulation</a></span></dt><dt><span class="section"><a href="#isosurface">2.4.4. Isosurface</a></span></dt><dt><span class="section"><a href="#light">2.4.5. Light Sources</a></span></dt></dl></dd><dt><span class="section"><a href="#effects">2.5. Effects</a></span></dt><dd><dl><dt><span class="section"><a href="#glow">2.5.1. Glow</a></span></dt><dt><span class="section"><a href="#motion_blur">2.5.2. Motion blur</a></span></dt><dt><span class="section"><a href="#fur">2.5.3. Fur</a></span></dt></dl></dd><dt><span class="section"><a href="#patterns">2.6. Textures and patterns</a></span></dt><dd><dl><dt><span class="section"><a href="#aoi_pattern">2.6.1. Angle of incidence</a></span></dt><dt><span class="section"><a href="#listed_pattern">2.6.2. Listed pattern</a></span></dt><dt><span class="section"><a href="#projection_pattern">2.6.3. Projection pattern</a></span></dt><dt><span class="section"><a href="#displace_warp">2.6.4. Displace warp for patterns</a></span></dt><dt><span class="section"><a href="#noisepigment">2.6.5. Noise pigment</a></span></dt><dt><span class="section"><a href="#hdr">2.6.6. HDR (High Dynamic Range) image type</a></span></dt><dt><span class="section"><a href="#bicubic_image">2.6.7. Bicubic interpolation for images</a></span></dt><dt><span class="section"><a href="#camera_view">2.6.8. New camera_view pigment</a></span></dt></dl></dd><dt><span class="section"><a href="#global_settings">2.7. Global Settings</a></span></dt><dd><dl><dt><span class="section"><a href="#film_exposure">2.7.1. Film exposure simulation</a></span></dt><dt><span class="section"><a href="#tone_mapping">2.7.2. Custom tone mapping function</a></span></dt><dt><span class="section"><a href="#radiosity">2.7.3. Radiosity</a></span></dt><dt><span class="section"><a href="#mechsim">2.7.4. Mechanics simulation patch</a></span></dt><dt><span class="section"><a href="#post_processing">2.7.5. Post processing</a></span></dt></dl></dd></dl></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="options"></a>2.1. Options</h2></div></div><div></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="frame_step"></a>2.1.1. <tt class="function">Frame_Step</tt></h3></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><a xmlns="" class="indexterm" name="id2436812"></a><a xmlns="" class="indexterm" name="id2436779"></a><p xmlns="">
The <tt class="function">Frame_Step</tt>=<i class="parameter"><tt>n</tt></i> (<tt class="function">+STP</tt><i class="parameter"><tt>n</tt></i>)
option introduces breaks in the order of rendered steps.
It splits the order of rendered frames into a 'virtual' and a 'real' order.
</p><p xmlns="">
'Virtual' order is the same as the traditional (used in <span class="trademark">POV-Ray</span>™ 3.5) order
described with <tt class="function">Initial_Frame</tt>, <tt class="function">Final_Frame</tt>,
<tt class="function">Initial_Clock</tt>, <tt class="function">Final_Clock</tt>,
<tt class="function">Subset_Start_Frame</tt>, <tt class="function">Subset_End_Frame</tt>.
This order is what the scripts reads from <tt class="function">initial_frame</tt>, <tt class="function">clock_delta</tt>
and other animation related build-in tokens in SDL.
</p><p xmlns="">
'Real' order is a subset of 'virtual' order. It is every <span class="emphasis"><em>n</em></span>-th
frame where <span class="emphasis"><em>n</em></span> is the value of <tt class="function">Frame_Step</tt>. Selected
frames are reordered (with ascending or descending order) according to
the sign of <tt class="function">Frame_Step</tt> option.
</p><p xmlns="">
<tt class="function">Frame_Step</tt> is supposed to use parallel rendering over one source
with one location shared between instances of renderer.
</p><div xmlns="" class="example"><a name="id2499847"></a><p class="title"><b>Example 2.1. Influence of <tt class="function">Frame_Step</tt> on generated files</b></p><p xmlns="">
The following command line:
</p><pre class="screen">megapov +Iscene.pov Initial_Frame=1 Final_Frame=5 +FN</pre><p xmlns="">
causes the creation of files in such order:
</p><pre class="screen">scene1.png
scene2.png
scene3.png
scene4.png
scene5.png</pre><p xmlns="">
while when using <tt xmlns="" class="function">Frame_Step</tt>:
</p><pre class="screen">megapov +Iscene.pov Initial_Frame=1 Final_Frame=5 +FN Frame_Step=-2</pre><p xmlns="">
causes a subset of it in the following order:
</p><pre class="screen">scene5.png
scene3.png
scene1.png</pre><p xmlns="">
</p></div><div xmlns="" class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="icons/important.gif"></td><th align="left">Important</th></tr><tr><td colspan="2" align="left" valign="top"><p>
<tt class="function">Frame_Step</tt> different than <i class="parameter"><tt>1</tt></i> works fine for
those animations where variables are not passed between frames when using
external files and where the next frame does not use values derived from a previous
(in the meaning of virtual order) frame by other ways.
</p></td></tr></table></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="hdr_write"></a>2.1.2. HDR (High Dynamic Range) image output</h3></div><div><div class="author"><h3 class="author"><span class="firstname">Christoph</span> <span class="surname">Hormann</span></h3></div></div></div><div></div></div><a xmlns="" class="indexterm" name="id2498812"></a><a xmlns="" class="indexterm" name="id2498835"></a><p xmlns="">
Apart from reading HDR images as image maps (see <a href="#hdr" title="2.6.6. HDR (High Dynamic Range) image type">Section 2.6.6, “HDR (High Dynamic Range) image type”</a>)
MegaPOV also supports this file format for image output. Further information
on this file format can be found in <a href="#hdr" title="2.6.6. HDR (High Dynamic Range) image type">Section 2.6.6, “HDR (High Dynamic Range) image type”</a> as well.
</p><p xmlns="">
The file format identification character is <tt xmlns="" class="function">H</tt>.
Writing this file format is activated by the command line option
</p><pre xmlns="" class="programlisting">+FH</pre><p xmlns="">
or the ini option
</p><pre xmlns="" class="programlisting">Output_File_Type=H</pre><p xmlns="">
</p></div></div><div xmlns="http://www.w3.org/1999/xhtml" class="section_1" lang="en"><div xmlns="" class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="expressions"></a>2.2. Expressions</h2></div></div><div></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="id2499336"></a>2.2.1. Language directives</h3></div></div><div></div></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="set"></a>2.2.1.1. Set directive</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Chris</span> <span class="surname">Huff</span></h3></div></div></div><div></div></div><p xmlns="">
The <tt class="function">#set</tt><a class="indexterm" name="id2499454"></a>
keyword modifies the most recently created version of a variable. So, if a variable has been created previously with either <tt class="function">#declare</tt> or <tt class="function">#local</tt>,
its value can be changed with the <tt class="function">#set</tt> directive.
</p><div xmlns="" class="example"><a name="id2499366"></a><p class="title"><b>Example 2.2. Using the #set directive</b></p><pre class="programlisting"><tt class="function">#declare</tt> MyCounter = 0:
<tt class="function">#set</tt> MyCounter = MyCounter + 1;</pre><p xmlns="">
One advantage is that it makes it more visually clear where variables are 'created', and where they are only 'changed'.
</p></div><p xmlns="">
Another advantage is that if you try to change a variable that doesn't yet exist, it produces an error.
This could happen if you make a typing mistake, like this:
</p><pre xmlns="" class="programlisting"><tt class="function">#declare</tt> MyCounter = 0;
<tt class="function">#while</tt> (MyCounter < 10)
<tt class="function">#declare</tt> MyCountr = MyCounter+1;
<tt class="function">#end</tt></pre><p xmlns="">
This would normally cause an infinite loop, and may take a while to track down, especially in complex scenes and with typos
that "look right" at a glance. If <tt xmlns="" class="function">#set</tt> was used, it would cause an error ("#set cannot assign to uninitialized identifier MyCountr.")
at that line, pointing you directly at the problem.
</p></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="tokens"></a>2.2.2. Built-in tokens</h3></div></div><div></div></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="additional_tokens"></a>2.2.2.1. Additional tokens in function syntax</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
<span class="trademark">POV-Ray</span>™ 3.5 in its official release does not accept all built-in constants
and variables to be used in functions. Following tokens are recognized
additionally in VM since MegaPOV 1.0:
<span class="simplelist"><tt class="function">clock_delta</tt><a class="indexterm" name="id2499265"></a>, <tt class="function">clock_on</tt><a class="indexterm" name="id2500406"></a>, <tt class="function">false</tt><a class="indexterm" name="id2499303"></a>, <tt class="function">final_clock</tt><a class="indexterm" name="id2499319"></a>, <tt class="function">final_frame</tt><a class="indexterm" name="id2500543"></a>, <tt class="function">frame_number</tt><a class="indexterm" name="id2500582"></a>, <tt class="function">initial_clock</tt><a class="indexterm" name="id2500564"></a>, <tt class="function">initial_frame</tt><a class="indexterm" name="id2500553"></a>, <tt class="function">image_height</tt><a class="indexterm" name="id2500601"></a>, <tt class="function">image_width</tt><a class="indexterm" name="id2500335"></a>, <tt class="function">no</tt><a class="indexterm" name="id2500318"></a>, <tt class="function">off</tt><a class="indexterm" name="id2500333"></a>, <tt class="function">on</tt><a class="indexterm" name="id2500374"></a>, <tt class="function">true</tt><a class="indexterm" name="id2500373"></a>, <tt class="function">version</tt><a class="indexterm" name="id2500349"></a>, <tt class="function">yes</tt><a class="indexterm" name="id2500370"></a></span>
. All mentioned tokens return the same values as in the whole SDL parser.
</p></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="frame_step_token"></a>2.2.2.2. <tt class="function">frame_step</tt> key-word</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
<a class="indexterm" name="id2499162"></a>
As other animation options, also <tt class="function">Frame_Step</tt> has its own equivalent in SDL.
You can use the <tt class="function">frame_step</tt> key-word to get the value which was passed to <tt class="function">Frame_Step</tt>
(see <a href="#frame_step" title="2.1.1. Frame_Step">Section 2.1.1, “Frame_Step”</a>). Default value is 1.
</p></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="functions"></a>2.2.3. Functions</h3></div></div><div></div></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="time_date"></a>2.2.3.1. Time and date functions</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Yvo</span> <span class="surname">Smellenbergh</span></h3></div></div></div><div></div></div><p xmlns="">
With the keyword <tt xmlns="" class="function">date</tt>, time and/or a date can be used in your images.
This might be useful in a macro to place a time stamp in your images, along with your name.
The keyword <tt xmlns="" class="function">date</tt> works like other string functions, except that you have to supply a format string.
</p><div xmlns="" class="example"><a name="id2501642"></a><p class="title"><b>Example 2.3. <tt class="function">date</tt> function usage</b></p><p>
Suppose it's Saturday 1 January. The following script:
</p><pre class="programlisting"><tt class="function">#declare</tt> TheString=<tt class="function">date</tt>("%a %B")</pre><p>
will return the string: Sat January
</p></div><p xmlns="">
The most flexible implementation was chosen (which is probably not the easiest ...) because not all countries write
dates in the same way. Just think of the difference between the USA and most parts of Europe.
These are the possible specifiers for the format string:
Please note that these should be equal for all platforms but if you don't get the expected result, contact the
person who compiled your version to find out if there are differences.
</p><div xmlns="" class="table"><a name="id2501699"></a><p class="title"><b>Table 2.1. The following time formatting strings are available:</b></p><table summary="The following time formatting strings are available:" border="0" style="border-collapse: collapse;"><colgroup><col><col></colgroup><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">a </td><td style="border-bottom: 0.5pt solid ; ">Abbreviated weekday name.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">A</td><td style="border-bottom: 0.5pt solid ; ">Full weekday name.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">b</td><td style="border-bottom: 0.5pt solid ; ">Abbreviated month name.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">B</td><td style="border-bottom: 0.5pt solid ; ">Full month name.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">c</td><td style="border-bottom: 0.5pt solid ; ">The strftime() format equaling the format string of "%x %X".</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">d</td><td style="border-bottom: 0.5pt solid ; ">Day of the month as a decimal number.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">H</td><td style="border-bottom: 0.5pt solid ; ">The hour (24-hour clock) as a decimal number from 00 to 23.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">I</td><td style="border-bottom: 0.5pt solid ; ">The hour (12-hour clock) as a decimal number from 01 to 12</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">j</td><td style="border-bottom: 0.5pt solid ; ">The day of the year as a decimal number from 001 to 366</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">m</td><td style="border-bottom: 0.5pt solid ; ">The month as a decimal number from 01 to 12.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">M</td><td style="border-bottom: 0.5pt solid ; ">The minute as a decimal number from 00 to 59.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">p</td><td style="border-bottom: 0.5pt solid ; ">"AM" or "PM".</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">S</td><td style="border-bottom: 0.5pt solid ; ">The seconds as a decimal number from 00 to 59.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">U</td><td style="border-bottom: 0.5pt solid ; ">The week number of the year as a decimal number from 00 to 52. Sunday is considered the first day of the week.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">w</td><td style="border-bottom: 0.5pt solid ; ">The weekday as a decimal number from 0 to 6. Sunday is (0) zero.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">W</td><td style="border-bottom: 0.5pt solid ; ">The week of the year as a decimal number from 00 to 51. Monday is the first day of the week.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">x</td><td style="border-bottom: 0.5pt solid ; ">The date representation of the current locale.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">X</td><td style="border-bottom: 0.5pt solid ; ">The time representation of the current locale.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">y</td><td style="border-bottom: 0.5pt solid ; ">The last two digits of the year as a decimal number.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Y</td><td style="border-bottom: 0.5pt solid ; ">The century as a decimal number.</td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">z</td><td style="border-bottom: 0.5pt solid ; ">The time zone name or nothing if it is unknown.</td></tr><tr><td style="border-right: 0.5pt solid ; ">% </td><td style="">The percent sign is displayed.</td></tr></tbody></table></div><p xmlns="">
</p><div xmlns="" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note: Note:"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="icons/note.gif"></td><th align="left">Note:</th></tr><tr><td colspan="2" align="left" valign="top"><p>
To use the '%' character in the result, use it twice: <tt class="function">date</tt>("%%")
</p></td></tr></table></div><p xmlns="">
Refer to <tt xmlns="" class="filename">date.pov</tt> for an example scene.
Please note that you might have to write the result in a file if you want to abort the rendering and continue later
on. Otherwise you could get a different result because time goes on :-)
</p></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="timer"></a>2.2.3.2. Timer function</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Yvo</span> <span class="surname">Smellenbergh</span></h3></div></div></div><div></div></div><p xmlns="">
The keyword <tt xmlns="" class="function">start_chrono</tt> sets an internal variable and returns the current internal clock counter of your computer.
The return value is not important. However, you must assign this return value from <tt xmlns="" class="function">start_chrono</tt> otherwise you get
an error.
Use it like this:
</p><pre xmlns="" class="programlisting"><tt class="function">#declare</tt> Stopwatch = <tt class="function">start_chrono</tt>;</pre><p xmlns="">
or use it like this:
</p><pre xmlns="" class="programlisting"><tt class="function">#if</tt> (<tt class="function">start_chrono</tt>)</pre><p xmlns="">
but not:
</p><pre xmlns="" class="programlisting"><tt class="function">start_chrono</tt> //parsing stops with a fatal error</pre><p xmlns="">
The keyword <tt xmlns="" class="function">current_chrono</tt> returns the time in full seconds (no fractions of seconds) between <tt xmlns="" class="function">start_chrono</tt> and
<tt xmlns="" class="function">current_chrono</tt>. The start value is not changed. A second <tt xmlns="" class="function">current_chrono</tt> will still return the seconds between
<tt xmlns="" class="function">start_chrono</tt> and the second <tt xmlns="" class="function">current_chrono</tt>.
</p><div xmlns="" class="literallayout"><p><br>
</p></div><p xmlns="">If you don't call <tt xmlns="" class="function">start_chrono</tt> somewhere before you call <tt xmlns="" class="function">current_chrono</tt>, you will get the seconds elapsed since the
beginning of the current render (parsing).
</p><div xmlns="" class="example"><a name="id2501537"></a><p class="title"><b>Example 2.4. Using the timer function</b></p><pre class="programlisting">//reset the chrono and return the internal clock counter
<tt class="function">#declare</tt> ParseStart = <tt class="function">start_chrono</tt>;
<i class="parameter"><tt>... syntax to be parsed</tt></i>
//read the seconds elapsed since chrono_start
<tt class="function">#declare</tt> ParseEnd = <tt class="function">current_chrono</tt>;
<tt class="function">#debug</tt> <tt class="function">concat</tt>("\nParsing took ",str((ParseEnd, 1, 0)," seconds\n")</pre><p>
</p></div><p xmlns="">
Refer to <tt xmlns="" class="function">chrono.pov</tt> for a demo scene.
</p></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="output_filename"></a>2.2.3.3. Filename with frame number</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
Some animators want to use filenames of previous, already rendered frames to average them
to mimic motion_blur in one turn. But the concatenation of filename with frame number is not a trivial thing
and can be platform dependant. MegaPOV allows you to get <i class="parameter"><tt>n</tt></i>-th filename of current
animation. For stills it always returns filename without numbers.
</p><p xmlns="">Syntax is:
<a xmlns="" class="indexterm" name="id2501204"></a>
</p><pre xmlns="" class="synopsis">#declare File_Name=<tt class="function">output_filename</tt>(<i class="parameter"><tt>Frame_Number</tt></i>)</pre><p xmlns="">
</p><div xmlns="" class="example"><a name="id2501223"></a><p class="title"><b>Example 2.5. Averaging frames with <tt class="function">output_filename</tt> function</b></p><p>
You can force every 10th frame to be averaged content of previous nine frames, this way:
</p><pre class="programlisting"><tt class="function">#if</tt>(<tt class="function">mod</tt>(<tt class="function">frame_number</tt>,10)=9)
<tt class="function">#declare</tt> Averaged_Frames=<tt class="function">pigment</tt>{
<tt class="function">average</tt>
<tt class="function">#local</tt> Counter=1;
<tt class="function">#while</tt>(Counter<10)
[1 <tt class="function">image_map</tt>{<tt class="function">output_filename</tt>(<tt class="function">frame_number</tt>-Counter)}]
<tt class="function">#set</tt> Counter=Counter+1;
<tt class="function">#end</tt>
}
// placing of pigment in output area
<tt class="function">#else</tt>
// conventional scene
<tt class="function">#end</tt></pre></div></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="images_sizes"></a>2.2.3.4. Sizes of images</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
You probably already know that the <tt class="function">image_width</tt> and <tt class="function">image_height</tt>
keywords return the sizes of a rendered image. But there are cases when you would like
to change the content of a scene depending on the sizes of the images used for maps. For this
purpose the <tt class="function">image_width</tt> and <tt class="function">image_height</tt> keywords are extended with an
optional parameter which is the identifier of an item using an image.
</p><p xmlns="">Syntax is:
<a xmlns="" class="indexterm" name="id2503425"></a>
<a xmlns="" class="indexterm" name="id2503436"></a>
</p><pre xmlns="" class="synopsis"><tt class="function">#declare</tt> Identifier=<tt class="function">image_width</tt> [ (ITEM_WITH_IMAGE) ];
<tt class="function">#declare</tt> Identifier=<tt class="function">image_height</tt> [ (ITEM_WITH_IMAGE) ];
ITEM_WITH_IMAGE: PIGMENT_ID | NORMAL_ID | TEXTURE_ID</pre><p xmlns="">
</p></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="vectors_dimensions"></a>2.2.3.5. Dimensions of vectors</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
The usage of the <tt class="function">dimension_size</tt> is extended since MegaPOV 1.1 with a measurement of
floats, vectors and colors. If you want to write a universal script which works differently
depending on the number of components in an identifier, you can use the <tt class="function">dimension_size</tt> to
get 1,2,3,4 or 5 as number of the components in the given identifier.
</p><p xmlns="">Syntax is:
<a xmlns="" class="indexterm" name="id2501030"></a>
</p><pre xmlns="" class="synopsis"><tt class="function">#declare</tt> Identifier=<tt class="function">dimension_size</tt> ( FLOAT | VECTOR | COLOR );</pre><p xmlns="">
</p></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="is"></a>2.2.3.6. Type checking</h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
MegaPOV 1.1 allows the verification of the type (and in some cases subtypes) of identifiers.
It is possible thanks to the <tt class="function">is</tt> function which tests the internal type of an identifier.
</p><p xmlns="">Syntax is:
<a xmlns="" class="indexterm" name="id2501161"></a>
<a xmlns="" class="indexterm" name="id2501169"></a>
<a xmlns="" class="indexterm" name="id2501124"></a>
<a xmlns="" class="indexterm" name="id2501134"></a>
<a xmlns="" class="indexterm" name="id2501145"></a>
<a xmlns="" class="indexterm" name="id2503187"></a>
<a xmlns="" class="indexterm" name="id2503198"></a>
<a xmlns="" class="indexterm" name="id2503209"></a>
<a xmlns="" class="indexterm" name="id2503220"></a>
<a xmlns="" class="indexterm" name="id2503230"></a>
<a xmlns="" class="indexterm" name="id2503241"></a>
<a xmlns="" class="indexterm" name="id2503252"></a>
<a xmlns="" class="indexterm" name="id2503263"></a>
<a xmlns="" class="indexterm" name="id2503274"></a>
<a xmlns="" class="indexterm" name="id2503285"></a>
<a xmlns="" class="indexterm" name="id2503296"></a>
<a xmlns="" class="indexterm" name="id2503307"></a>
<a xmlns="" class="indexterm" name="id2503318"></a>
<a xmlns="" class="indexterm" name="id2504035"></a>
<a xmlns="" class="indexterm" name="id2504046"></a>
<a xmlns="" class="indexterm" name="id2504057"></a>
<a xmlns="" class="indexterm" name="id2504068"></a>
<a xmlns="" class="indexterm" name="id2504078"></a>
<a xmlns="" class="indexterm" name="id2504089"></a>
<a xmlns="" class="indexterm" name="id2504100"></a>
<a xmlns="" class="indexterm" name="id2504112"></a>
<a xmlns="" class="indexterm" name="id2504122"></a>
<a xmlns="" class="indexterm" name="id2504134"></a>
<a xmlns="" class="indexterm" name="id2504144"></a>
<a xmlns="" class="indexterm" name="id2504155"></a>
<a xmlns="" class="indexterm" name="id2504166"></a>
<a xmlns="" class="indexterm" name="id2504177"></a>
<a xmlns="" class="indexterm" name="id2504188"></a>
<a xmlns="" class="indexterm" name="id2504200"></a>
<a xmlns="" class="indexterm" name="id2504210"></a>
<a xmlns="" class="indexterm" name="id2504221"></a>
<a xmlns="" class="indexterm" name="id2504232"></a>
<a xmlns="" class="indexterm" name="id2504243"></a>
<a xmlns="" class="indexterm" name="id2504254"></a>
<a xmlns="" class="indexterm" name="id2504265"></a>
<a xmlns="" class="indexterm" name="id2504276"></a>
<a xmlns="" class="indexterm" name="id2504287"></a>
<a xmlns="" class="indexterm" name="id2504298"></a>
<a xmlns="" class="indexterm" name="id2504309"></a>
<a xmlns="" class="indexterm" name="id2504320"></a>
<a xmlns="" class="indexterm" name="id2504331"></a>
<a xmlns="" class="indexterm" name="id2504342"></a>
<a xmlns="" class="indexterm" name="id2504353"></a>
<a xmlns="" class="indexterm" name="id2504364"></a>
<a xmlns="" class="indexterm" name="id2504375"></a>
<a xmlns="" class="indexterm" name="id2504386"></a>
<a xmlns="" class="indexterm" name="id2504397"></a>
<a xmlns="" class="indexterm" name="id2504408"></a>
<a xmlns="" class="indexterm" name="id2504419"></a>
<a xmlns="" class="indexterm" name="id2504430"></a>
<a xmlns="" class="indexterm" name="id2504440"></a>
<a xmlns="" class="indexterm" name="id2504451"></a>
<a xmlns="" class="indexterm" name="id2504462"></a>
<a xmlns="" class="indexterm" name="id2504473"></a>
<a xmlns="" class="indexterm" name="id2504484"></a>
<a xmlns="" class="indexterm" name="id2504495"></a>
<a xmlns="" class="indexterm" name="id2504506"></a>
<a xmlns="" class="indexterm" name="id2504517"></a>
<a xmlns="" class="indexterm" name="id2504528"></a>
<a xmlns="" class="indexterm" name="id2504539"></a>
<a xmlns="" class="indexterm" name="id2504550"></a>
<a xmlns="" class="indexterm" name="id2504561"></a>
<a xmlns="" class="indexterm" name="id2504572"></a>
<a xmlns="" class="indexterm" name="id2504583"></a>
<a xmlns="" class="indexterm" name="id2504594"></a>
<a xmlns="" class="indexterm" name="id2504605"></a>
<a xmlns="" class="indexterm" name="id2504616"></a>
<a xmlns="" class="indexterm" name="id2504627"></a>
<a xmlns="" class="indexterm" name="id2504638"></a>
<a xmlns="" class="indexterm" name="id2504649"></a>
<a xmlns="" class="indexterm" name="id2504660"></a>
<a xmlns="" class="indexterm" name="id2504671"></a>
<a xmlns="" class="indexterm" name="id2504682"></a>
</p><pre xmlns="" class="synopsis"><tt class="function">#declare</tt> Identifier=<tt class="function">is</tt> ( IDENTIFIER , TYPE | SUBTYPE );
TYPE: <tt class="function">array</tt> | <tt class="function">camera</tt> | <tt class="function">color</tt> |
<tt class="function">color_map</tt> | <tt class="function">density</tt> | <tt class="function">density_map</tt> |
<tt class="function">finish</tt> | <tt class="function">float</tt> | <tt class="function">fog</tt> |
<tt class="function">function</tt> | <tt class="function">interior</tt> | <tt class="function">light_source</tt> |
<tt class="function">material</tt> | <tt class="function">media</tt> | <tt class="function">normal</tt> |
<tt class="function">normal_map</tt> | <tt class="function">object</tt> | <tt class="function">pigment</tt> |
<tt class="function">pigment_map</tt> | <tt class="function">rainbow</tt> | <tt class="function">sky_sphere</tt> |
<tt class="function">slope_map</tt> | <tt class="function">spline</tt> | <tt class="function">string</tt> |
<tt class="function">texture</tt> | <tt class="function">texture_map</tt> | <tt class="function">transform</tt> |
<tt class="function">vector</tt>
SUBTYPE: SPLINE_TYPE | OBJECT_TYPE | CAMERA_TYPE
SPLINE_TYPE: <tt class="function">akima_spline</tt> | <tt class="function">basic_x_spline</tt> |
<tt class="function">cubic_spline</tt> | <tt class="function">extended_x_spline</tt> |
<tt class="function">general_x_spline</tt> | <tt class="function">linear_spline</tt> |
<tt class="function">natural_spline</tt> | <tt class="function">quadratic_spline</tt> |
<tt class="function">sor_spline</tt> | <tt class="function">tcb_spline</tt>
OBJECT_TYPE: <tt class="function">bicubic_patch</tt> | <tt class="function">blob</tt> | <tt class="function">box</tt> |
<tt class="function">cone</tt> | <tt class="function">cubic</tt> | <tt class="function">cylinder</tt> |
<tt class="function">disc</tt> | <tt class="function">height_field</tt> | <tt class="function">intersection</tt> |
<tt class="function">isosurface</tt> | <tt class="function">julia_fractal</tt> | <tt class="function">lathe</tt> |
<tt class="function">merge</tt> | <tt class="function">mesh</tt> | <tt class="function">parametric</tt> |
<tt class="function">plane</tt> | <tt class="function">poly</tt> | <tt class="function">polygon</tt> |
<tt class="function">prism</tt> | <tt class="function">quadric</tt> | <tt class="function">quartic</tt> |
<tt class="function">smooth_triangle</tt> | <tt class="function">sor</tt> | <tt class="function">sphere</tt> |
<tt class="function">sphere_sweep</tt> | <tt class="function">superellipsoid</tt> | <tt class="function">text</tt> |
<tt class="function">torus</tt> | <tt class="function">triangle</tt> | <tt class="function">union</tt>
CAMERA_TYPE: <tt class="function">cylinder</tt> | <tt class="function">fisheye</tt> | <tt class="function">omnimax</tt> |
<tt class="function">orthographic</tt> | <tt class="function">panoramic</tt> | <tt class="function">perspective</tt> |
<tt class="function">spherical</tt> | <tt class="function">ultra_wide_angle</tt> | <tt class="function">user_defined</tt></pre><p xmlns="">
</p><div xmlns="" class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="icons/important.gif"></td><th align="left">Important</th></tr><tr><td colspan="2" align="left" valign="top"><p>
<a class="indexterm" name="id2504710"></a>
<a class="indexterm" name="id2505241"></a>
Internally <tt class="function">mesh2</tt> is stored as <tt class="function">mesh</tt>. Similar <tt class="function">difference</tt>
is stored as <tt class="function">intersection</tt>.
</p></td></tr></table></div><p xmlns="">
An example using the <tt class="function">is</tt> keyword can be found in the <tt class="filename">mp_types.inc</tt> include file
(see <a href="#mp_types.inc" title="3.3. The 'mp_types.inc' include file">Section 3.3, “The 'mp_types.inc' include file”</a>).
</p></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="internal_functions"></a>2.2.4. Internal functions</h3></div></div><div></div></div><p xmlns="">
MegaPOV delivers new pre-defined functions. These new internal functions can be accessed
through the <tt class="filename">mp_functions.inc</tt> include file, so it should be included
in your scene to make use of them.
</p><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="f_triangle"></a>2.2.4.1. <tt class="function">f_triangle</tt></h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><a xmlns="" class="indexterm" name="id2505697"></a><p xmlns="">
<tt xmlns="" class="function">f_triangle</tt> function has 10 parameters:
</p><div xmlns="" class="funcsynopsis"><p><code class="funcdef">FLOAT <b class="fsfunc">f_triangle</b>(</code>FLOAT <var class="pdparam">V1x</var>, FLOAT <var class="pdparam">V1y</var>, FLOAT <var class="pdparam">V1z</var>, FLOAT <var class="pdparam">V2x</var>, FLOAT <var class="pdparam">V2y</var>, FLOAT <var class="pdparam">V2z</var>, FLOAT <var class="pdparam">V3x</var>, FLOAT <var class="pdparam">V3y</var>, FLOAT <var class="pdparam">V3z</var>, FLOAT <var class="pdparam">Thickness</var><code>)</code>;</p></div><p xmlns="">
The parameters <i xmlns="" class="parameter"><tt>V1x</tt></i>, <i xmlns="" class="parameter"><tt>V1y</tt></i>, <i xmlns="" class="parameter"><tt>V1z</tt></i>
describe the coordinates of the first vertex in the triangle.
</p><div xmlns="" class="literallayout"><p><br>
</p></div><p xmlns="">The parameters <i xmlns="" class="parameter"><tt>V2x</tt></i>, <i xmlns="" class="parameter"><tt>V2y</tt></i>, <i xmlns="" class="parameter"><tt>V2z</tt></i>
describe the coordinates of the second
vertex in the triangle.
</p><div xmlns="" class="literallayout"><p><br>
</p></div><p xmlns="">The parameters <i xmlns="" class="parameter"><tt>V3x</tt></i>, <i xmlns="" class="parameter"><tt>V3y</tt></i>, <i xmlns="" class="parameter"><tt>V3z</tt></i>
describe the coordinates of the third vertex in the triangle.
</p><div xmlns="" class="literallayout"><p><br>
</p></div><p xmlns="">The parameter <i xmlns="" class="parameter"><tt>Thickness</tt></i> describes how thick the triangle is.
</p><div xmlns="" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="icons/note.gif"></td><th align="left">Note</th></tr><tr><td colspan="2" align="left" valign="top"><p>
In order to achieve the fastest calculation, try to pass the parameters so that the side
<i class="parameter"><tt>V1</tt></i>-<i class="parameter"><tt>V2</tt></i> represents the longest side and
<i class="parameter"><tt>V1</tt></i>-<i class="parameter"><tt>V3</tt></i> represents the shortest side.
</p></td></tr></table></div></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="polynomial_solver"></a>2.2.5. Polynomial solver in parser</h3></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><p xmlns="">
The polynomial solver is accessible from scripts via the float functions <tt xmlns="" class="function">n_roots</tt>
<a xmlns="" class="indexterm" name="id2506058"></a>
and <tt xmlns="" class="function">nth_root</tt><a xmlns="" class="indexterm" name="id2506722"></a>
with the following syntax:
</p><div xmlns="" class="funcsynopsis"><p><code class="funcdef">INT <b class="fsfunc">n_roots</b>(</code>FLOAT <var class="pdparam">an</var>, <var class="pdparam">...</var>, FLOAT <var class="pdparam">a0</var>, BOOL <var class="pdparam">sturm_flag</var>, FLOAT <var class="pdparam">epsilon</var><code>)</code>;</p><p><code class="funcdef">FLOAT <b class="fsfunc">nth_root</b>(</code>FLOAT <var class="pdparam">nth</var>, FLOAT <var class="pdparam">an</var>, <var class="pdparam">...</var>, FLOAT <var class="pdparam">a0</var>, BOOL <var class="pdparam">sturm_flag</var>, FLOAT <var class="pdparam">epsilon</var><code>)</code>;</p></div><p xmlns="">
</p><p xmlns="">
<tt class="function">n_roots</tt> returns the number of roots derived from the polynomial given by the parameters
<i class="parameter"><tt>a<sub>n</sub></tt></i>, <i class="parameter"><tt>...</tt></i>, <i class="parameter"><tt>a<sub>0</sub></tt></i>
and calculated under the conditions specified by the parameters
<i class="parameter"><tt>sturm_flag</tt></i> and <i class="parameter"><tt>epsilon</tt></i>.
</p><p xmlns="">
<tt class="function">nth_root</tt> returns the value of the <i class="parameter"><tt>nth</tt></i> root of a given polynomial.
</p><p xmlns="">
The sturm flag turns on a different algorithm of calculation.
Its usage influences the number of returned roots.
Epsilon (positive) value means that the roots below Epsilon value are ignored.
Epsilon=0 means that none of the roots are ignored.
</p><div xmlns="" class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="icons/important.gif"></td><th align="left">Important</th></tr><tr><td colspan="2" align="left" valign="top"><p>
You don't have to call <tt class="function">n_roots</tt> before <tt class="function">nth_root</tt>, but if you do call
<tt class="function">nth_root</tt> with the wrong root number then it causes an error and breaks parsing.
It is better to call <tt class="function">n_roots</tt> first to verify the number of available roots.
</p></td></tr></table></div><div xmlns="" class="example"><a name="id2507860"></a><p class="title"><b>Example 2.6. Polynomial solver usage</b></p><p xmlns="">
Imagine that we have
x<sup xmlns="">3</sup>+6*x<sup xmlns="">2</sup>-x-6
and that we are interested in its roots for further calculations. So if we declare:
</p><pre class="programlisting"><tt class="function">#declare</tt> N=<tt class="function">n_roots</tt>(1, 6, -1, -6, <tt class="function">off</tt>, 0);</pre><p xmlns="">
then N has value 3 because the mentioned equation has 3 roots.
If we are interested in what roots it has, we can use the following calls:
</p><pre class="programlisting"><tt class="function">#declare</tt> R0=<tt class="function">nth_root</tt>(0, 1, 6, -1, -6, <tt class="function">off</tt>, 0);
<tt class="function">#declare</tt> R1=<tt class="function">nth_root</tt>(1, 1, 6, -1, -6, <tt class="function">off</tt>, 0);
<tt class="function">#declare</tt> R2=<tt class="function">nth_root</tt>(2, 1, 6, -1, -6, <tt class="function">off</tt>, 0);</pre><p xmlns="">
And it returns R0=-6, R1=1 and R2=-1. So finally we know that
x<sup xmlns="">3</sup>+6*x<sup xmlns="">2</sup>-x-6=(x+6)*(x-1)*(x+1)
.
</p></div></div><div class="section_2" lang="en"><div xmlns="" class="titlepage"><div><div><h3 class="title"><a name="splines"></a>2.2.6. Splines</h3></div></div><div></div></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="sor_spline"></a>2.2.6.1. <tt class="function">spline</tt> follows <tt class="function">sor</tt></h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><a xmlns="" class="indexterm" name="id2506230"></a><a xmlns="" class="indexterm" name="id2507673"></a><p xmlns="">
Splines in <span class="trademark">POV-Ray</span>™ can be used to create objects through rotation,
translation or by being a border of a surface.
Usually it is hard to match those surfaces with calculations developed in SDL because they are mostly
hard-coded within the source core code of <span class="trademark">POV-Ray</span>™. The <tt class="function">spline</tt> feature introduced in <span class="trademark">POV-Ray</span>™ 3.5
makes such operations much easier but some spline types are still missing. <tt class="function">sor_spline</tt> is
introduced to access the surface of the <tt class="function">sor</tt> object in SDL.
</p><p xmlns="">
To use the data from the <tt class="function">sor</tt> object in a <tt class="function">sor_spline</tt>, the order of coordinates has to be
changed. The old <tt class="function">y</tt> coordinate is now the clock value in the spline.
The advantage is that one <tt class="function">sor_spline</tt> can hold data from five old <tt class="function">sor</tt>-s.
That's because every <tt class="function">spline</tt> can operate up to five dimensions along the clock value.
</p><div xmlns="" class="example"><a name="id2506293"></a><p class="title"><b>Example 2.7. Conversion from the <tt class="function">sor</tt> object definition to the <tt class="function">sor_spline</tt> type in <tt class="function">spline</tt></b></p><pre class="programlisting"><tt class="function">spline</tt>{
<tt class="function">sor_spline</tt>
-1.000000,0.000000*<tt class="function">x</tt>
0.000000,0.118143*<tt class="function">x</tt>
0.540084,0.620253*<tt class="function">x</tt>
0.827004,0.210970*<tt class="function">x</tt>
0.962025,0.194093*<tt class="function">x</tt>
1.000000,0.286920*<tt class="function">x</tt>
1.033755,0.468354*<tt class="function">x</tt>
}
<tt class="function">sor</tt>{
7
<0.000000, -1.000000>
<0.118143, 0.000000>
<0.620253, 0.540084>
<0.210970, 0.827004>
<0.194093, 0.962025>
<0.286920, 1.000000>
<0.468354, 1.033755>
}</pre></div></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="akima_spline"></a>2.2.6.2. akima <tt class="function">spline</tt></h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><a xmlns="" class="indexterm" name="id2508769"></a><a xmlns="" class="indexterm" name="id2508780"></a><p xmlns="">
An <tt xmlns="" class="function">akima_spline</tt> is a spline that goes smoothly (pleasingly for some) through
all points. ACM Press abstracts original work of Hiroshi Akima:
</p><div xmlns="" class="blockquote"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="blockquote" summary="Block quote"><tr><td width="10%" valign="top"> </td><td width="80%" valign="top"><p>
This method is devised in such a way that the resultant curve will pass through
the given points and will appear smooth and natural. It is based on a piecewise
function composed of a set of polynomials, each of degree three, at most, and
applicable to successive intervals of the given points. In this method, the slope
of the curve is determined at each given point locally, and each polynomial
representing a portion of the curve between a pair of given points is determined by
the coordinates of and the slopes at the points. Comparison indicates that the curve
obtained by this new method is closer to a manually drawn curve than those drawn by
other mathematical methods.
</p></td><td width="10%" valign="top"> </td></tr><tr><td colspan="2" align="right" valign="top">--<span class="attribution"><a href="http://portal.acm.org/" target="_top"><i class="citetitle">The Guide to Computing Literature.</i></a></span></td><td width="10%" valign="top"> </td></tr></table></div><p xmlns="">
</p><p xmlns="">
Syntax is:
</p><pre xmlns="" class="synopsis"><tt class="function">spline</tt> {
<tt class="function">akima_spline</tt>
<i class="parameter"><tt>time_Val_1</tt></i>, <<i class="parameter"><tt>Vector_1</tt></i>> [,]
<i class="parameter"><tt>time_Val_2</tt></i>, <<i class="parameter"><tt>Vector_2</tt></i>> [,]
...
<i class="parameter"><tt>time_Val_n</tt></i>, <<i class="parameter"><tt>Vector_n</tt></i>>
}</pre><p xmlns="">
</p></div><div class="section_3" lang="en"><div xmlns="" class="titlepage"><div><div><h4 class="title"><a name="tcb_spline"></a>2.2.6.3. tcb <tt class="function">spline</tt></h4></div><div><div class="author"><h3 class="author"><span class="firstname">Włodzimierz</span> <span class="othername">ABX</span> <span class="surname">Skiba</span></h3></div></div></div><div></div></div><a xmlns="" class="indexterm" name="id2508928"></a><a xmlns="" class="indexterm" name="id2508939"></a><p xmlns="">
This spline is also known as Kochanek-Bartels spline.
</p><p xmlns="">
Syntax is:
</p><pre xmlns="" class="synopsis"><tt class="function">spline</tt> {
<tt class="function">tcb_spline</tt> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>]
<i class="parameter"><tt>time_Val_1</tt></i> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>], <<i class="parameter"><tt>Vector_1</tt></i>> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>][,]
<i class="parameter"><tt>time_Val_2</tt></i> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>], <<i class="parameter"><tt>Vector_2</tt></i>> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>][,]
...
<i class="parameter"><tt>time_Val_n</tt></i> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>], <<i class="parameter"><tt>Vector_n</tt></i>> [<i class="parameter"><tt>TCB_PARAMETERS</tt></i>]
}
<i class="parameter"><tt>TCB_PARAMETERS</tt></i>:
[<tt class="function">tension</tt> <i class="parameter"><tt>FLOAT</tt></i>] [<tt class="function">continuity</tt> <i class="parameter"><tt>FLOAT</tt></i>] [<tt class="function">bias</tt> <i class="parameter"><tt>FLOAT</tt></i>]</pre><p xmlns="">
The <tt xmlns="" class="function">tension</tt>, <tt xmlns="" class="function">continuity</tt> and <tt xmlns="" class="function">bias</tt> are fully optional. Depending on the place
where they appear, they control the spline in different ways:
</p><div xmlns="" class="itemizedlist"><ul type="disc" compact><li>
Placed right after the <tt class="function">tcb_spline</tt> keyword, they set the default values for
all ends of the spline segments. This placement is ignored in case of copying spline
without adding new controls because previous defaults were already propagated to each
side of control points.
</li><li>
Placed between the time_value and the corresponding vector, the tcb parameters determine the
properties of the spline segment ending in the vector that follows these parameters.
</li><li>
For tcb parameters following a vector, the properties of the spline segment beginning after
this vector are set.
</li></ul></div><p xmlns="">
</p><p xmlns="">
What is controlled by these parameters?
</p><div xmlns="" class="itemizedlist"><ul type="disc" compact><li><tt class="function">tension</tt> controls how sharply the curve bends.</li><li><tt class="function">continuity</tt> controls how rapid speed and direction change.</li><li><tt class="function">bias</tt> controls the direction of the curve as it passes through the control point.</li></ul></div><p xmlns="">
</p><p xmlns="">
</p><div xmlns="" class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align