Thanks
In glorious 3D now - mixed it with a paraboloid (Z value) -- compiled with GFA under Wine (the nice thing is , here the hlp files do work)
More later - the number of petals can be changed now (not included in the interface) -- compositions next (spirals , concentric etc ...)
best Rob
(will convert to Gauche as a test - already around 110.000 points calculated)
added : the exec. 9 petals (somewhat nicer) -- runs from the flower3D.exe locations
addendum : the Gauche Scheme script -- amazingly fast speed (measured on setting up the GL_COMPILE list ) -- easy interface :
use the mouse to start / stop rotation (left/right) -- (display (number->string pi)) may be removed from the script (just checking the value)
identical script runs on Win32 / Wine / Linux
-------------------------------
(use gl)
(use gl.glut)
(define pi (* 2.0 (acos 0)))
(display (number->string pi))
(define (Fflower a t nr)
(let ((x (* a (- (* nr (cos t)) (cos (* nr t)))))
(y (* a (- (* nr (sin t)) (sin (* nr t)))))
(z (* a a 0.5) ))
(list x y z)))
(define *spin* 0.0)
(define *title* "Left mouse to start rotation - Right to stop")
(define (init)
(gl-clear-color 0.0 0.0 0.0 0.0)
(gl-shade-model GL_FLAT)
)
(define (make-list)
(gl-new-list 1 GL_COMPILE)
(gl-begin GL_POINTS)
(do ((a 0.2 (+ a 0.06)))
((> a 5.0))
(do ((t 0.0 (+ t (/ pi 500))))
((> t (* 2 pi)))
(let ((res (Fflower a t 8.0)) (color (/ a 5.0)) )
(gl-color color (- 1 color) 0.0)
(gl-vertex (car res) (cadr res) (caddr res) ))))
(gl-end)
(gl-end-list))
(define (disp)
(gl-clear GL_COLOR_BUFFER_BIT)
(gl-push-matrix)
(gl-rotate *spin* 1.0 1.0 1.0)
(gl-call-list 1)
(gl-pop-matrix)
(glut-swap-buffers)
)
(define (spin-display)
(set! *spin* (modulo (+ *spin* 2.0) 360.0))
(glut-post-redisplay)
)
(define (reshape w h)
(gl-viewport 0 0 w h)
(gl-matrix-mode GL_PROJECTION)
(gl-load-identity)
(gl-ortho -50.0 50.0 -50.0 50.0 -100.0 100.0)
(gl-matrix-mode GL_MODELVIEW)
(gl-load-identity)
)
(define (mouse button state x y)
(cond
((= button GLUT_LEFT_BUTTON)
(when (= state GLUT_DOWN) (glut-idle-func spin-display)))
((= button GLUT_RIGHT_BUTTON)
(when (= state GLUT_DOWN) (glut-idle-func #f))))
)
(define (keyboard key x y)
(cond
((= key 27) (exit 0))
))
(define (main args)
(glut-init args)
(glut-init-display-mode (logior GLUT_DOUBLE GLUT_RGB))
(glut-init-window-size 500 500)
(glut-init-window-position 100 100)
(glut-create-window *title*)
(init)
(glut-display-func disp)
(glut-reshape-func reshape)
(glut-keyboard-func keyboard)
(glut-mouse-func mouse)
(make-list)
(glut-main-loop)
0)
---------------------------------------------------------------------
.