Page:
Primitive Shapes
Pages
About
Configuration Variables
Control Flow
Expressions
Home
Import Directives
Mirror Axis
Namespaces
Parameters
Path Declarations
Primitive Shapes
Shape Adjustments
Shape Replacements
Shape Rules
Startshape Directive
Symmetry Operations
Tiled Rendering
User Functions
Variables
Vectors
Version 2 Paths
Version 2 Syntax
No results
2
Primitive Shapes
John Horigan edited this page 2020-10-12 23:33:32 -07:00
Table of Contents
Primitive Shapes
Primitive shapes are the shapes that Context Free/CFDG knows how to draw onto a canvas. Whenever Context Free encounters a primitive shape in a shape rule it draws it immediately. There are four primitive shapes that are pre-defined in Context Free: squares, circles, triangles, or fills. Path declarations can be used to teach Context Free how to draw new primitive shapes.
The sizes of these primitive shapes are:
- Squares are unit squares. If two squares are drawn one unit apart in x or y then that will be drawn edge-to-edge.
SQUARE []
SQUARE [x 1 b 0.5] // gray square right next to the black square
- Circles are unit circles. They have the same diameter as the side of a square.
- Triangles are unit triangles. The have the same side length as squares.
- Fills draw on the entire canvas with a solid color
Here is what the primitive shapes look like with respect to each other:
shape foo {
SQUARE []
CIRCLE [b 1]
SQUARE [x 1.5]
TRIANGLE [b 0.5 x 1.5]
SQUARE [x 3]
CIRCLE [b 1 x 3]
TRIANGLE [b 0.5 x 3]
}
Unicode Ephemera
To facilitate code golf, some Unicode synonyms have been defined for the simple primitive shapes:
- SQUARE:
- ⬛ (Black Large Square, U+2B1B)
- ◼ (Black Medium Square, U+25FC)
- ◾ (Black Medium Small Square, U+25FE)
- ■ (Halfwidth Black Square, U+FFED)
- CIRCLE:
- ⬤ (Black Large Circle, U+2B24)
- ⚫ (Medium Black Circle, U+26AB)
- ● (Black Circle, U+25CF)
- TRIANGLE:
- ▲ (Black Up-Pointing Triangle, U+25B2)
- ▴ (Black Up-Pointing Small Triangle, U+25B4)
