Navigation Menu

Skip to content

wbabic/hello-devcards

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello devcards

An exploration of turtle programming using svg, reagent, core.async and devcards.

The goal being to connect geometry, number and algebra through computer programming and computer graphics.

usage

This requires my complex library which is not yet in clojars.

https://github.com/wbabic/complex

to install the complex library locally:

git clone git@github.com:wbabic/complex.git
cd complex
lein install

and then:

lein figwheel

http://localhost:3451/cards.html

pixie-turtle

A restricted svg turtle using simple turtle math involving addition and multiplication of whole numbers, halving and doubling, left and right 90 degree turns and is implemented directly in screen coordinates, making use of svg transformations.

http://wbabic.github.io/hello-devcards/#!/hello_devcards.pixie_turtle

complex turtle

A turtle implemented using complex numbers.

A mapping transforms the turtle into screen coordinates.

see complex.cljc and mappings.cljc

used by polygon

svg bezier

An exploration of bezier paths, xlink-href use and transform. Contains an interactive quadratic bazier with draggable points.

http://wbabic.github.io/hello-devcards/#!/hello_devcards.bezier

polygon

Turtle commands, command-processor and programs to make regular polygons, sections and wheels.

see polygon.cljc

Can be used from a clojure repl, from figwheel, or from within a devcard.

color wheel

A color wheel made using a complex turtle, polygon and svg.

http://wbabic.github.io/hello-devcards/#!/hello_devcards.color_wheel

colored polygon

Use polygon and color-wheel so that color-wheel manages the current color and when polygons are closed, the current color is used as the fill color of the polygon.

http://wbabic.github.io/hello-devcards/#!/hello_devcards.colored_polygon

lattice turtle

A lattice turtle has a position and two heading vectors

the lattice turtle can

  • move forward and backward along those two dimensions
  • leave a point at each position it visits
(reduce
 (fn [state command]
   (process-command command state))
 standard-turtle
 turtle-program)

See latice.cljc and

http://wbabic.github.io/hello-devcards/#!/hello_devcards.transforms

turtle transforms

A playground for exploring interaction of turtles and transformations.

Transformations are applied to a turtle as well as to the perspective mapping.

Turtles can also generate transformations.

A sequence of transformations can be composed or reduced to a single transformation.

Every transformation has an inverse.

Geometric objects are Transformable.

A transform is itself Transformable.

see geometry.cljc

projective turtle

http://wbabic.github.io/hello-devcards/#!/hello_devcards.projective_turtle

Use the concept of a virtual turtle sent forth along the x-axis taking one step at a time.

The original turtle remains fixed and with each step, draws a line from i (eye) to the virtual turtle and in this way, projects a line to a circle.

The turtle math involves finding the intersection of a line and a circle. It is a nice little bit of algebra that makes a direct connection with geometry, using turtle graphics to illuminate and animate the process. And in the process, Pythagorean triples are generated.

[2n/(n^2 - 1), (n^2 + 1)/(n^2 - 1)]

recursive turtle

http://wbabic.github.io/hello-devcards/#!/hello_devcards.sierpensky

A turtle program which calls itself recursively.

An animation of a recursive turtle program drawing one triangle at a time to make a Sierpensky gasket.

pulsating pencils

http://localhost:3449/cards.html#!/hello_devcards.pencils

Here we see how a turtle can generate pencils of parallel lines, concentric circles and radial lines.

see pencil.cljc

the notion of motion

Connect the mind to the physical world by imagining applying motions to to a virtual turtle. Motions like Move, Turn, and Resize connect tangible ideas to transformations.

Connecting algebraic operations of addition and multiplication to turtle motions and geometric notions of translation, rotation and dilation.

They are tools for thinking.

Pencils illuminate space like tracer bullets.

Create Mobius transformations by adding the reciprocal transformation, that sends z to 1/z where z = 0 is allowed and yields infinity, motivated by stereographic projection.

See a line as a generalized circle and Mobius transformations as circle preserving mappings (in the generalized sense).

About

an exploration of turtle geometry using devcards, reagent and core.async

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published