[fluxus] pdata and particles

nik gaffney nik at fo.am
Wed Nov 23 09:18:38 PST 2005


the script below shows an example of using the pdata from one object to
'rebuild' something similar from a different primitive
     ( .. .which could be extended to do some simple mesh morphing,
    but getting the interpolation right could be a bit tricky ))

with this particular script, im using build-particles to create a particle
system and was wondering if there would be a reasonable way of handling the
points as separate entites wrt the physics engine? . , ie. way to swap
between a single active-sphere and many point based(?) active-boxes without
blowing up ode?


;;; a simple example of swaping coordinates between objects

(define blob (build-nurbs-sphere 22 22))
(scale #(2 2 2))
(define bzzz (build-particles 1121))

(define (sworph from to)
  (grab from)
  (morp (pdata-size) from to)
  (ungrab))

(define (morp n from to)
  (grab from)
  (let ((pfrom (pdata-get "p" n)))
    (ungrab)
    (grab to)
    (pdata-set "p" n (vmul pfrom 1))
    (ungrab))
  (if (< n 0)
      0
      (morp (- n 1) from to)))

;; swap/copy/morph pdata from one object to another. ..
(sworph blob bzzz)

;; a copy without an orginal is still a copy
(destroy blob)





More information about the Fluxus mailing list