tower.gdl 892 Bytes
Newer Older
Dave Cooper's avatar
Dave Cooper committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(in-package :gdl-user)

(define-object tower (base-object)
  :input-slots 
  ((height 42)
   (block-height 1)
   (width +phi+)
   (length (* (the width) +phi+)))

  :computed-slots
  ((number-of-blocks (floor (the height)
                            (the block-height))))

  :objects
  ((blocks :type 'box
           :sequence (:size (the number-of-blocks))
           :length (the length)
           :height (the block-height)
           :width (the width)
           :center (translate (the center) :up 
                              (* (the-child height)
                                 (the-child index)))
           :orientation (alignment :rear (rotate-vector-d 
                                          (the (face-normal-vector :rear))
                                          (twice (the-child index))
                                          (the (face-normal-vector :top)))))))