Code Monkey home page Code Monkey logo

hello-devcards's Introduction

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 [email protected]: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).

hello-devcards's People

Contributors

wbabic avatar

Watchers

 avatar

Forkers

plumpmath

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.