Re: optimization of movable parts

New Message Reply Date view Thread view Subject view Author view

Jim Helman (jimh++at++surreal)
Thu, 03 Nov 94 14:07:57 -0800


> msg.articulatedParts[i].parameterValue1 - .05 &&

One minor thing here, the lack of an 'f' as in .05f causes
parameterValue1 to be promoted unnecessarily to double precision.
ALWAYS use an 'f' in your single precision FP constants.

As for the basic question of doing offset rotations, we're thinking of
adding a rotation center to DCSes for the next release.

For now, the most efficient way to generate the matrix is to use paper
and pencil to work out just what you need. The Euler*Trans is trivial
and certainly doesn't require a full matrix multiply even in the
general case.

Euler(h,p,r):

        cr*ch - sr*sp*sh cr*sh + sr*sp*ch -sr*cp 0
        -cp*sh cp*ch sp 0
        sr*ch + cr*sp*sh sr*sh - cr*sp*ch cr*cp 0
        0 0 0 1

Euler(h,p,r)*Trans(x,y,z)

        cr*ch - sr*sp*sh cr*sh + sr*sp*ch -sr*cp 0
        -cp*sh cp*ch sp 0
        sr*ch + cr*sp*sh sr*sh - cr*sp*ch cr*cp 0
        x y z 1

Your special case:

Pitch(p)*Trans(x,y,z)

        1 0 0 0
            0 cp sp 0
        0 -sp cp 0
        x y z 1

Trans(-x,-y,-z)*Pitch(p)*Trans(x,y,z)

        1 0 0 0
            0 cp sp 0
        0 -sp cp 0
        0 y-y*cp+z*sp z-y*sp-z*cp 1

         
Hopefully, I got the signs right ;-).

rgds,

-jim helman

jimh++at++surreal.asd.sgi.com
415/390-1151


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:38 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.