Skip to content

Examples

Aviral Sharma edited this page Aug 20, 2020 · 4 revisions

This page lists out some examples of figures that can be generated using piplada.

Elementary Figures

Triangle

Command:

Move pointer 250 pixels forward
Rotate pointer 120 degrees

Config Commands:

pointer: shown
speed: slow
bg_color = "navajo white" 
line color = "dark gold"

This generates a triangle of side 250 and an interior angle 60 degrees. (This is because rotating pointer 120 degrees anti-clockwise positions the pointer in a direction 60 degrees (clockwise) from the existing line.)


Square


Command:

Move pointer 200 pixels forward
Rotate pointer 90 degrees

Config Commands:

pointer: shown
speed: slow
bg_color = "forest green" 
line color = "SeaGreen1"

This generates a square of side length 200.


Hexagon


Command:

Move pointer 100 pixels forward
Rotate pointer 60 degrees

Config Commands:

pointer: shown
speed: normal
bg_color = "red4" 
line color = "white"

This generates a hexagon of side length 100. (and interior angle 120 degrees)


Circle


Command:

Move pointer 2 pixels forward
Rotate pointer 1 degrees

Config Commands:

pointer: hidden
speed: normal
bg_color = "white" 
line color = "black"

This command instructs pointer to move 2 pixels, then change its trajectory by 1 degree. This generates an approximate circle on the canvas.

Complex Figures

Spoked Hexagon


Command:

Move pointer 40 pixels forward
Rotate pointer by 300 degrees
Move pointer 40 pixels forward
Rotate pointer by 120 degrees
Move pointer 40 pixels forward
Rotate pointer by 300 degrees
Move pointer 40 pixels forward
Rotate pointer by 60 degrees

Config Commands:

pointer: hidden
speed: normal
bg_color = "gold" 
line color = "red"

This generates a hexagon of side 120, with a spoke of length 40 on each side protruding at an angle of 60 degrees from the surface.


Regular Icosagon


Command:

Move pointer 200 pixels forward
Rotate pointer by 162 degrees

Config Commands:

pointer: hidden
speed: normal
bg_color = "white" 
line color = "navy"

This generates a 20-sided polygon, called an icosagon. The internal angle in an icosagon is 162 degrees, with the spoke length of this polygon being 200 pixels.