[Fluxus] animated grid

Dave Griffiths dave at pawfal.org
Mon Dec 3 15:34:46 PST 2007


On Mon, 2007-12-03 at 01:18 +0000, Gerry Grainger wrote:
> Also, I wish to pick your brains - I have altered one of your example
> scripts a bit, because I reckon that it could be pressed into use in a
> way that could be helpful explaining how I 'visualise' sound to my
> band mates: 
> (clear)
> (define (deform n)
>     (pdata-set! "p" n (vadd  (pdata-ref "p" n)
>         (vmul (vector 0 0 (gh n)) 0.5)))
>     (if (zero? n)
>         0
>         (deform (- n 1)))) 
> (hint-unlit) 
> (hint-wire)
> (line-width 4)
> (define myobj (build-seg-plane 4 4))
> (define (render)
> (grab myobj)
> (deform (pdata-size))
> (ungrab))
> (every-frame (render))
> 
> What I need to know is 1) how to get it to restore itself to a flat
> grid every frame, so it doesn't just explode out of shape, and how to
> determine that the point alterations go along the whole of the shape
> in both axes, as opposed to just the one, like 
> 
> o+++o+++o+++o
> +++++++++++++
> +++++++++++++
> o+++o+++o+++o
> +++++++++++++
> +++++++++++++
> o+++o+++o+++o
> +++++++++++++
> +++++++++++++
> o+++o+++o+++o
> 
> where the 'o' characters are the manipulated points, from 1-16, in
> accordance with gh
> If that makes any sense. I'm trying to build a 3D waveform,
> basically. 
>  I'm going to include the colour manipulations and have fun with
> opacity later on, but I'm still unsure as to how to do this,
> basically. Is there anyway of setting the points up so they go
> sequentially like this, or does the seg-plane not get built like
> that? 

If I understand you correctly, this is what you are after (added 3
lines, and changed one, see comments):

---8<---

(clear)
(define (deform n)
    ; add the displacement to the start
    ; positions, not the last positions
    (pdata-set! "p" n (vadd  (pdata-ref "pref" n)
        (vmul (vector 0 0 (gh n)) 0.5)))
    (if (zero? n)
        0
        (deform (- n 1)))) 


(hint-unlit) 
(hint-wire)
(line-width 4)

(define myobj (build-seg-plane 4 4))

; lets mix styles ;)
(with-primitive myobj
    (poly-convert-to-indexed) ; "joins" up the polys
    (pdata-copy "p" "pref"))  ; copy the start positions 

(define (render)
    (grab myobj)
    (deform (pdata-size))
    (ungrab))

(every-frame (render))

--->8---

convert to indexed deserves a bit more of an explanation, from the docs:

(poly-convert-to-indexed)

Returns void

Converts the currently grabbed polygon primitive from 
raw vertex arrays to indexed arrays. This removes duplicate 
vertices from the polygon, making the pdata arrays shorter, 
which speeds up processing time.

You'll be wanting to get more than 16 harmonic bands next aren't you...

cheers,

dave




More information about the Fluxus mailing list