[Fluxus] how to get the local rotation of a primitive as a vector??

Rob Bothof rbothof at xs4all.nl
Mon Jan 25 20:44:04 PST 2010


Hello!!!

Hi fluxi, I've recently started on a Craig Reynolds style boids/flocking 
system.
some starting pics: http://www.flickr.com/photos/superrobber/4305067091/

so far so good, but now I'd like to give each of my birdy's there own 
coordinate system
and i've come up with a few functions to localise a point in global 
space to the birdy's own local space
could be helpfull, or maybe there's an easier of faster way to this?

(define (globalise prim)
;return position vector of prim
(vtransform (vector 0 0 0) (with-primitive prim (get-transform)))

(define (localise self other)
;returns the position vector of the other prim in local coordinate space 
of oneself
(vtransform (globalise other) (minverse (with-primitive self 
(get-transform)))))

I'd like to do the same with rotation, cause i'll need this to align the 
birdy's in the same direction
I'd like to come up with a direction vector of another birdy relative to 
the direction vector of a birdy

actually similar what the (concat) function does,
but without the translation and just get a vector, instead of 
transforming the primitive or drawingstate directly.

i've tried the (vtransform-rot) but with this function somehow i just 
can't get the rotation out of the (get-transform) matrix
the manual says it's kinda ment for use with normals ?

any thoughts or pointers are very appreciated!

greets, Rob



More information about the Fluxus mailing list