English فارسی Suomi
Français Nederlands Translate


Fluxus: TurtleBuilder

Turtle Builder

A circle

The turtle polybuilder is an experimental way of building polygonal objects using a logo style turtle in 3D space. As you drive the turtle around you can place vertices and build shapes procedurally. The turtle can also be used to deform existing polygonal primitives, by attaching it to objects you have already created.

This script simply builds a single polygon circle, by playing the age old turtle trick of looping a function that moves a bit, turns a bit...


(define (build n)
    (turtle-prim 4)
    (build-loop n n)

(define (build-loop n t)
    (turtle-turn (vector 0 (/ 360 t) 0))
    (turtle-move 1)
    (if (< n 1)
        (build-loop (- n 1) t)))

(backfacecull 0)
(wire-colour (vector 0 0 0))
(line-width 4)
(build 10)

A circle of circles.jpgFor a more complex example, just modify the (build-loop) function as so:

(define (build-loop n t)
    (turtle-turn (vector 0 (/ 360 t) 0))
    (turtle-move 1)
    (if (< n 1)
             ; add another call to the recursion
             (build-loop (- n 1) t)
             (turtle-turn (vector 0 0 45))   ; twist a bit
             (build-loop (- n 1) t))))