[Fluxus] hsv support

gabor papp gabor.lists at mndl.hu
Sat Jun 21 15:25:51 PDT 2008


some new hsv functions are committed to the cvs.

(hsv->rgb)
(rgb->hsv)
(colour-mode)

examples:

; builds a 10x10 hsv colour pattern

(clear)

(for* ((x (in-range 0 10))
        (y (in-range 0 10)))
     (identity)
     (translate (vector x y 0))
     (colour (hsv->rgb (vector (/ x 10) (/ y 10) 1)))
     (build-cube))

----

; particles with hsv colours

(clear)
(colour-mode 'hsv)

(define p (build-particles 100))

(with-primitive p
     (pdata-map!
         (lambda (c)
             (vector (rndf) 1 1))
         "c")
     (pdata-map!
         (lambda (p)
             (srndvec))
         "p"))


i was not really sure how to add hsv colours to the system, so i kind of 
hacked it to the dColour class. now the r, g and b fields are used 
sometimes for the h, s, v values. i was thinking to use unions with 
anonymous structs to store the rgb and hsv values at the same place, but 
that's not iso c++. maybe dColour should know its colour model, but that 
probably complicates things. suggestions are welcome.

best,
gabor



More information about the Fluxus mailing list