Skip to content

The Basics (primitives and modifiers)

Martin Prout edited this page Sep 2, 2013 · 9 revisions

Primitives

In line with the C++ cfdg program, their are three basic primitive shapes (that get called as terminals)

  1. circle (does not support rotation:, w: or h:)

  2. square (supports rotation:, w: and h:)

  3. triangle (supports rotation:)

Extra primitive

ellipse alias oval (supports rotation:, w: and h:)

Shape operations

  1. size: unless specified there is a default size, rendering is often terminated by reaching a size limit

  2. w: and h: only available since version 0.0.4, used to create ellipse and rectangular shapes

  3. x: and y: used for horizontal and vertical translation

  4. rotation: for rotations since version 0.0.3 primitives as specified as above accept "degrees" for rotation, as well as the derived shapes

  5. flip: invert

Color operations

Color ( since version 0.0.3 ) is specified like C++ cfdg, HSB 360 1 1 1 last being alpha/transparency

  1. color: expects and an array as input eg [60, 1, 1, 1] is yellow

  2. hue: expects scalar in range 0 to 360

  3. saturation:, brightness:, alpha: expects scalar in range 0 to 1.0 alpha for transparency

Context saving / restoring

Context is saved by using the split command (think of pushMatrix)

Original context is restored using the unwind command (think of popMatrix)

This behaviour mimics, but does not exactly replicate the way C++ cfdg splits operations (the "y" design sample is an example of this divergent behaviour where the split goes down one branch and then another in this implementation, whereas in the C++ the branches are followed simultaneously). Certain fractals such as the levy curve also demonstrate this behaviour, but are more subtly affected.