Symmetry Transformations

Home • Gallery • Tutorials • Download • Purchase • Site Map
 

Symmetry Transformations Overview

The Fractal Science Kit fractal generator Symmetry Transformation properties page is used to define a symmetry transformation. A symmetry transformation is used to transform an orbit point into multiple points. In addition, the symmetry transformation associates each output point with a symmetry index that can be used by the Color Controllers to color the point. Despite the name, the symmetry transformation need not produce a symmetric design. Many of the built-in symmetry transformations do produce symmetric designs but a Symmetry Transformation can be used whenever a 1-to-many transformation is required.

See also:

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

Comments

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

Fractal Science Kit - Symmetry Transformation 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, Symmetry Transformations support 1 other section:

transform:

The code in this section takes the input point z and populates an array of SymmetryTransformationInfo objects called symmetryArray[]. symmetryCount is used to return the number of objects found in the array.

SymmetryTransformationInfo is defined in the built-in macros as:

Object SymmetryTransformationInfo {
  Point
  Index
}

Point is a complex value that represents a point on the complex plane. Index (called the symmetry index) is a small integer value between 0 and 32767 that characterizes the point in some way and can be accessed from the controllers and used for coloring. In many cases, Index is simply the index in the array associated with the point but that need not be the case. For example, the built-in symmetry transformations Plane Symmetry Groups - Square Lattice and Plane Symmetry Groups - Hexagonal Lattice use the symmetry index to support 2-color symmetry patterns.

Example:

comment:
 
  Reflect each point in line, and return both
  the original point and the reflected point.
 
global:
 
  const Affine T = Affine.Identity()
 
  Affine.ReflectAboutLine(T, Point, DegreeToRadian(Angle))
  '
  ' Set symmetryCount to the number of points we will generate.
  '
  symmetryCount = 2
  '
  ' Dimension array for transformed points.
  '
  SymmetryTransformationInfo symmetryArray[symmetryCount]

transform:
 
  p = Affine.TransformPoint(T, z)
  symmetryArray[0] = SymmetryTransformationInfo(z, 0)
  symmetryArray[1] = SymmetryTransformationInfo(p, 1)
 
properties:
 
  option Point {
    type = Complex
    caption = "Point"
    details = "Point on line of reflection"
    default = 0
  }
  option Angle {
    type = Float
    caption = "Angle"
    details = "Angle of line of reflection"
    default = 0
    range = [-360,360]
  }

This example defines a symmetry transformation that takes the input point z and returns 2 points as output. To this end, symmetryCount is set to 2 and symmetryArray[] is dimensioned 2 in the global section using:

global:
  ...
  symmetryCount = 2
  ...
  SymmetryTransformationInfo symmetryArray[symmetryCount]

Your program must dimension the symmetryArray[] array in the global section. If the size is fixed as in this example, you can set symmetryCount in the global section too. Otherwise, dimension the array symmetryArray[] in the global section to the maximum number of points possible, and then set symmetryCount in the transform section to the actual number of points placed in symmetryArray[].

The global section should also be used to perform any processing that is independent of the input point z. In this example we initialize the affine transformation T based on the properties defined in the properties section.

Finally, in the transform section we process the input point z and return the transformed points in symmetryArray[]:

transform:
 
  p = Affine.TransformPoint(T, z)
  symmetryArray[0] = SymmetryTransformationInfo(z, 0)
  symmetryArray[1] = SymmetryTransformationInfo(p, 1)

symmetryArray[0] is set to the input point z, and symmetry index 0. symmetryArray[1] is set to the result of applying the affine transformation T to z (i.e., the reflected point), and symmetry index 1.

Since the symmetry index is invariant for this transformation, we could improve efficiency slightly by setting the index values in the global section as shown below.

Example:

global:
 
  ...
 
  symmetryArray[0].Index = 0 ' original point
  symmetryArray[1].Index = 1 ' reflected point

transform:
 
  symmetryArray[0].Point = z
  symmetryArray[1].Point = Affine.TransformPoint(T, z)
 

Here we set the Index values in the global section and the Point values in the transform section. In this example it probably does not make much difference since the logic is simple and the number of points small but in some situations you can speed up your transformation using this strategy.

Built-in Variables

Several built-in variables are available to your instructions:

  • SymmetryTransformationInfo symmetryArray[]
  • symmetryCount
  • z

The variables symmetryArray[] and symmetryCount are used to return the results computed by the program. z is the point to transform. For convenience, z can be changed but these changes have no effect outside the context of the specific symmetry transformation program where the change occurs; i.e., it does not affect the orbit or any future transformation processing, it is simply a local variable set to the value of the point to transform before each invocation of the transform section.

 

Copyright © 2004-2019 Ross Hilbert
All rights reserved