# Transformations # Transformations Overview

Transformations are used by the Fractal Science Kit fractal generator to transform one complex value into another. When the transformation is used as an Orbit Transformation, the entire set of orbit points are available to the transformation as well. In all other cases, you do not have access to the orbit points.

Each program is composed of a set of properties and instructions.

Always remember to click the Toggle Code View toolbar button at the top of the Program Editor and read the comments given in the comment section of the program's instructions. The comment section contains usage instructions, hints, notes, documentation, and other important information that will help you understand how best to use the program. Once you are done reading the comments, click the Toggle Code View toolbar button again to view the program's properties.

# Properties The following properties are supported:

• Add Trans Array is a checkbox that can be checked to add a Transformation Array editor as one of the program's properties pages. Users can add 1 or more transformations to the editor and your program can access the transformations using the Transformation Functions.

• Force Execution is a checkbox that can be checked to force execution of the instructions. If Force Execution is unchecked, the instructions will execute only if required based on what changes were made to the fractal's properties since the last time the instructions ran. This is rarely checked.

# Instructions

The remainder of this page can be ignored if you are not a programmer.

At the bottom of the window is an editor pane named Instructions. The editor pane is a simple text editor to view/edit your Program Instructions. See Editing Text for details.

The instructions are divided into sections. Within each section are statements that conform to the Programming Language syntax.

In addition to the Standard Sections, Transformations support 1 other section:

transform:

The transform section is responsible for updating z with its transformed value. That is, when the transform section is called, the variable z contains the point to be transformed. You should transform z and assign the transformed value to the variable z to return the result.

Example:

transform:

z *= Cis(Arg(z))

This example rotates z based on the angle Arg(z). Recall that multiplying a point z by Cis(A), where A is an angle given in radians, has the effect of rotating the point z by A radians counterclockwise about the origin. Since Arg(z) is the angle in radians of a line through the origin and terminating at z relative to the X axis, this transformation has the effect of doubling the angle associated with z. The same thing could have been achieved using the following less efficient method:

transform:

p = ComplexToPolar(z)
p.a *= 2
z = PolarToComplex(p)

Example:

comment:

Apply composite function.

transform:

z = G(F(z))

properties:

#include ComplexFunctions

divider {
caption = "z = G(F(z))"
}
option F {
type = ComplexFunctions
caption = "F(z)"
default = Ident
}
option G {
type = ComplexFunctions
caption = "G(z)"
default = Ident
}

This example returns the composite function result G(F(z)) where F and G are arbitrary complex functions.

Example:

comment:

Transform the point z by reflecting z in a circle.

global:

const Circle c = CircleC(Center, Radius)

transform:

z = Circle.ReflectPoint(c, z)

properties:

option Center {
type = Complex
caption = "Center"
details = "Center of circle of inversion"
default = 0
}
type = Float
details = "Radius of circle of inversion"
default = 1
range = (0,)
}

This example defines a circle of inversion c based on the Center and Radius given in the associated section. In the transform section, the point z is transformed by reflecting it in the circle c and the resulting point assigned back into the variable z.

# Built-in Variables

Several built-in variables are available to your instructions:

• z

The built-in variable z is the point to transform and is used to return the results computed by the program.

When the transformation is used as an Orbit Transformation, the entire set of orbit points are available to the transformation as well. In all other cases, you do not have access to the orbit points. In truth, Orbital fractals do not have access to the entire orbit but only the last N points, where N is the value of the Orbit Buffer Size property set on the Orbital / IFS / Strange Attractor page.

In those cases where it is supported, you can access the entire set of orbit points using the Orbit Functions.

Example:

comment:

Modify point based on previous orbit point.

transform:

z = z + K*Orbit.Point(-1)

properties:

option K {
type = Float
caption = "Factor"
default = -0.5
}

This example adds K*Orbit.Point(-1) to z and assigns the result back into z. Orbit.Point(-1) is the orbit point just prior to the current orbit point z.