[fluxus] build error: PDataArithmetic.cpp

Dave Griffiths dave at pawfal.org
Tue Nov 29 07:32:57 PST 2005


> On Nov 29, 2005, at 4:37 AM, Dave Griffiths wrote:
>> well spotted! bad programming by me... all's good, except it should
>> be the
>> other way round - take the * out of the cpp file so the dVector's
>> pass by
>> value.
>>
>> does that work too?
>
> ...yup, compiles just fine (I figured it'd be one way or
> another)...tho I don't know if I've "exercised" the code:  is there a
> pdata operation or script that would test this for sure?

this one should do it:

(clear)
(point-width 3)
(rotate (vector 0 90 0))
(define p (build-particles 100))

(define (init n)
    (pdata-set "p" n (vsub (vector 0 (flxrnd) (flxrnd)) (vector 0 0.5 0.5)))
    (let ((c (flxrnd)))
    (pdata-set "c" n (vector c c c)))
    (if (< n 1)
        0
        (init (- n 1))))

(define (update n)
    (let ((closest (pdata-op "closest" "p" n)))
        (let ((dir (vmul (vnormalise (vsub (pdata-get "p" n) closest)) 0.4))
              (centre (vmul (vnormalise (vsub (vector 0 0 0) (pdata-get
"p" n))) 0.3)))
            (pdata-set "vel" n
                (vmul (vnormalise
                    (vadd (vmul (vadd dir centre) 0.001) (pdata-get "vel"
n))) 0.02 ))))

    (if (< n 1)
        0
        (update (- n 1))))

(define (anim)
    (grab p)
    (update (pdata-size))
    (pdata-op "+" "p" "vel")
    (ungrab))

(grab p)
(pdata-add "vel" "v")
(init (pdata-size))
(ungrab)

(every-frame "(anim)")

(blur 0.1)

> ...there are a coupla weird things I've noticed:
>
> 1.  can't seem to get workspaces 2-8 working:  ctrl-1, 9, and 0 work,
> but any others have no effect

has this gone wrong recently? works ok here but there is a horrible switch
in main.cpp (104) that you might have to change - a bunch of numbers that
seem to work with ctrl, I thought they might be different on another os,
but no one seemed to complain :)

> 2.  I need to reset the current working directory on osx, because atm
> it's looking for files where the binary is, which is fluxus.app/
> Contents/MacOS/fluxus...so, in order to access a file in a directory
> of the same level as fluxus.app, you have to (load "../../../../../
> examples/whatever.scm"), which is a bit of a pain ;-\

If I get time I'd like to get rid of the examples and make some proper
scripts which can also be used as tests in the future. The examples
directory is full of stuff which may or may not be up to date.

I might leave this till the next release though :)

cheers,

dave




More information about the Fluxus mailing list