ChaosPro Home
Introduction
What's New
Palettes
Using Formulas
Layering in ChaosPro
Rendering
Fractal Parameter Windows
Windows
Menu
3D Transformations
Animations
Formula Compiler
Writing Formulas
Language Reference
Introduction
Basic Syntax
Datatypes
Constants
Variables
Basics
Variable Scope
Predefined Variables
Predefined Variables - Escapetime
Predefined Variables - Quaternion
Predefined Variables - Attractor
Parameters
Expressions
Operators
Functions
Control Structures
Compiler Directives
Functions
Interface to ChaosPro
Special Features, Notes...
Compatibility
Fractal Type Reference
Tutorials
Appendix
CHAOSPRO 4.0
Release 4.0
.

Predefined Variables

ChaosPro provides several predefined variables on class level. Some of these variables are used as parameters from outside, i.e. they are initialized by the fractal calculation routine and the corresponding interface function inside the class is expected to use the variable in order to provide a result depending on that variable.

Example

The following (small) formula uses only predefined variables, i.e. z and pixel:

my_formula
{
  void init(void)
  {
    z=0; // z is a predefined (complex) variable, you should use it as the main iteration variable...
  }
  void loop(void)
  {
    // a variable called "pixel" has been predefined and
    // contains the complex number which corresponds to the current pixel.
    z=z*z+pixel;
  }
  bool bailout(void)
  {
    return(cabs(z)<4);
  }
}
Notes:

  • Due to the nature of these predefined variables the term predefined parameter will also be used for them, so please do not be confused if you sometimes read about predefined variables and sometimes about predefined parameters. It's all the same...

  • It depends on the formula type (transformation, iteration, coloring) and the fractal type (Escapetime, Quaternion) what parameters are actually defined.

  • Some parameters are just input parameters, others are in/out, i.e. they are initialized and you can set them to some value: The fractal calculation routine then will use that value. For example a coloring formula has a predefined parameter called index which should be set by the formula: The calculation routine then will take this value to color the current pixel.