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
Expressions
Operators
Functions
Control Structures
Compiler Directives
Functions
Interface to ChaosPro
Escapetime Formulas
Quaternion Formulas
Transformations
Iteration Formulas
Coloring Formulas
Attractor Formulas
Libraries
How it works together
Description function
Special Features, Notes...
Compatibility
Fractal Type Reference
Tutorials
Appendix
CHAOSPRO 4.0
Release 4.0
.

Quaternion - Transformation Formulas

A transformation formula transforms the quaternion space into another "space". This formula is rather simple to write and understand, because all it does - or better - has to do, is to modify the value of the predefined variable pixel.

A transformation formula can have upto three member function:

  1. void init_once(void): Called only once, i.e. when the fractal calculation starts: In this routine you can initialize variables and allocate arrays.
  2. void transform(void): This is the main member function: Its purpose is to modify the value of pixel.
  3. void description(void): This member function lets you define labels for your parameters, enumeration lists, default values and hints. Each formula can have a description function.

In order to tell ChaosPro that this formula is ment for fractal type Quaternion (and thus the proper predefined variables are defined), you need to specify the keyword QUATERNION in brackets after the formula identifier. This tells ChaosPro that pixel and z are quaternion variables (instead of complex variables) and that the other predefined variables for this fractal type are defined.

So a transformation mainly consists of a member function void transform(void) which gets called for each pixel before the main fractal loop gets called.

Thus a transformation could look as follows:


Displace(QUATERNION) {
parameter quaternion c;

	void transform(void)
	{
		pixel=pixel+c;
	}
	void description(void)
	{
		this.title="Simple Displacement";

		c.caption="Displace";
		c.default=(0,0,0,0);
		c.hint="Displace by this number.";
	}
}

So all you need to do is to modify the predefined variable pixel in a way you like!