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

gabor papp gabor.lists at mndl.hu
Tue Jan 26 00:08:43 PST 2010


hi Rob,

> some starting pics: http://www.flickr.com/photos/superrobber/4305067091/
looks really nice. congrats.

> 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 ?
i believe you can get the direction vector like this:

(define (global-dir p)
     (vtransform-rot (vector 0 1 0)
         (with-primitive p
             (get-global-transform))))

; to draw it
(let ([dir (global-dir p)])
     (with-primitive (build-ribbon 2)
         (hint-unlit)
         (hint-wire)
         (pdata-set! "p" 0 (vector 0 0 0))
         (pdata-set! "p" 1 (vmul dir 5))))

but i'm not sure that this would be very useful in your case, because 
this is just a direction vector and not a rotation vector. if you want 
the rotation angles, you can try (matrix->euler). but since you want to 
interpolate between rotation matrices, you might need quaternions.

best,
gabor



More information about the Fluxus mailing list