next up previous
Next: 24.4 表示画面の設定 Up: 24 ハノイの塔のモデル sample/hanoi.l Previous: 24.2 面データの検索と座標系設定

24.3 ディスクの定義


(defun hanoi-disk (&optional r h)
  (let* ((c (make-cylinder r h)))
    (setf (get c :top-face)
          (car (send c :get-face :cylinder :top)))
    (setf (get c :top-coords)
          (face-coords (get c :top-face)))
    (send c :assoc (get c :top-coords))
    (setf (get c :grasp-width) (* r 2))
    c
    ))

(defun disks (n &optional disks)
  (dotimes (i n)
    (setq disks (cons (hanoi-disk (+ (* (/ 27 n) i) 12) 20)
                      disks)))
  (reverse disks))

(defun disk (i) (elt *disks* (1- i)))


generated through LaTeX2HTML. M.Inaba 平成18年5月7日