4.207 Formal Design Knowledge and
Programming Constructs

Homework 2

Lira Nikolovska
Design and Computation program



Use of parameters

Josef Albers, Bundled, 1926
View code here



function for drawing red, black and white rectangles
variables: x and y are coordinates of bottom left corner;
height and width

(defun drawrect (x y width height)

    (command "solid" (list x y )
      (list x (+ y height))
      (list (+ x width) y)
      (list (+ x width) (+ y height)) ""
    )
)



Use of control statement

Variation scaled squares
View code here

Variation scaled and rotated squares
View code here



function for drawing square

(defun square (p1 radius)

    (setq p1 (list x1 y1))
    (setq x1 0)
    (setq y1 0)
      (command "polygon" 4 p1 "i" radius)
)



control statement: reduce radius of previous square,
make new square and rotate it 5 degrees

(setq count 0)
(while (and (< count radius) (>= radius 10))

    (setq radius (- radius 5))
    (square p1 radius)
    (command "rotate" "last" "" (list 0 0) (+ count 5) )
    (setq count (+ count 5))
)









Back to main page.