[Fluxus] potentially silly question (colour)

Kassen signal.automatique at gmail.com
Sun Aug 2 14:47:29 PDT 2009


Hi all,

If I could please return to the subject of colouring faces for a moment?
I've had some time to let more of Scheme sink in and browse the manual some
more and made this edit of Gabor's example. What I wanted to do was to give
each face a random colour. This led to a big series of experiments with
tie-died cubes as colouring the vertices led to interpolated colours on
faces. I got around this while also gaining a deeper understanding of
Gabor's example. Here is as my experiment stands right now;

(clear)
(hint-unlit)

(define obj1 (build-cube))

(define (divby? x y)
    (if (=  (/ x y)  (floor (/ x y)))  #t #f))


(with-primitive obj1
    (let ((facecol .3) (corners 3))
        (hint-vertcols)
        (display (poly-type)) (newline)
        (if (equal? (poly-type) 'quad-list) (set! corners 4) (set! corners
3))
        (pdata-index-map!
            (lambda (i c)
                (if (divby? i corners) (set! facecol (flxrnd)) (set! facecol
facecol))
                (hsv->rgb (vector facecol 1 .9)))
            "c")))


One of the things I'm trying to do here is get of the "4" (corners per face)
and "6" (faces per object) magic numbers in Gabor's code and generalise the
function for more kinds of shapes. I think I've got this down here; I can
figure out the number of vertices per face from the poly-type and figure out
the amount of faces by dividing the total length of the pdata array by that.
This should go fine... except for this "polygon" type; in that case all bets
are off, as far as I can see.

Is there any way of reliably and generally taking a vertex and figuring out
what face it belongs to in order to do something to that face?

Yours,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20090802/a07836c9/attachment-0001.htm>


More information about the Fluxus mailing list