; file: flower.lsp

(defun c:flower( / )
 (setq r1 (getreal "\n r1= ? (60) ")
       r2 (getreal "\n r2= ? (15) ")
       r3 (getreal "\n r3= ? (20) ")

       n1 (getreal "\n n1= ? (1) ")
       n2 (getreal "\n n2= ? (64) ")

       x1 0.0
       y1 0.0
       )
 ;
 (setq nt (* n1 2.0 pi)
       dt (/ (* 2.0 pi) n2))

 ; for t1= 0.0 to nt step dt
 (setq t1 0.0
       nt (+ nt (/ dt 10.0))
       r4 (- r1 r2)
       )

 (command "spline")

 (while (<= t1 nt)
   (setq s1 (* r1 t1)
         s2 s1
         t2 (/ s2 r2)
         t2 (* -1 t2)

         x2 (+ x1 (* r4 (cos t1)))
         y2 (+ y1 (* r4 (sin t1)))

         x3 (+ x2 (* r3 (cos t2)))
         y3 (+ y2 (* r3 (sin t2)))
         )

   (command (list x3 y3))

   (setq t1 (+ t1 dt))
   ); end of while

 (command "" "" "")
 (princ)
 ); end of defun
; end of file
