Re: problem with pfMatrix

New Message Reply Date view Thread view Subject view Author view

Angus Dorbie (dorbie++at++sgi.com)
Tue, 01 Jun 1999 12:42:08 -0700


Your code is working correctly. The child values shouldn't change. The
transformation is relative to the parent. The cumulative effects of the
transformation are applied in the modelview matrix (but that includes
the viewing xform too).

To get the combined matrix of parent and child you'd need to read them
both and multiply those matrices together in the right order.

In your case, to position the channel at the eye, you need to multiply
the left and right eyes with the head matrix yourself. Performer does
not expose this, it DOES draw the right thing.

Cheers,Angus.

Torbjörn Håkansson wrote:
>
> Hi all pf Users
>
> I have a problem with pfMatrix, I wonder why the Matrix's value don't change when I rotate or translate the parent pfDCS, the parent pfDCS is moved by input data from a sensor in a Flock of Birds, the child in my model shall represent two eyes, I thought that performer did the matrix multiplication automatically
>
> Thanks in advance !
>
> -------------------------------------------------------------------------
> Code example !!
>
> pfDCS *Head; // attached to Flock of Bird Sensor
> pfDCS *L_Eye;
> pfDCS *R_Eye;
>
> pfCoord CamSens;
> pfCoord HandSens;
> pfMatrix L_EyeMat ;
> pfMatrix R_EyeMat ;
>
> L_Eye = new pfDCS;
> R_Eye = new pfDCS;
> Head = new pfDCS;
>
> Head->addChild(L_Eye);
> Head->addChild(R_Eye);
>
>
> L_Eye->setTrans(-0.50f,0.0f,0.0f);
> R_Eye->setTrans(0.50f,0.0f,0.0f);
>
> float alfa = 0.0f
>
>
> while(exitFlag)
> {
> alfa++;
>
> getSensorData(); // my code to fetch FOB sensor data
>
> Head->setRot(0.50f*alfa,0.0f,0.0f);
>
> L_Eye->getMat ( L_EyeMat ); // why does this Matrix dont change value ?
> R_Eye->getMat ( R_EyeMat ); // why does this Matrix dont change value ?
>
> chan0->setViewMat( L_EyeMat );
> chan1->setViewMat( R_EyeMat );
>
> pfFrame();
>
> }
>
> ********************************************************************
> Torbjörn Håkansson
>
> URL: http://www.hbg.lth.se/~m96tha
> Mail : torbjorn.hakansson++at++telia.com
> Phone: +46-(0)40-320595
> ICQ: 281022
> ********************************************************************
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com

-- 
"Microsoft's system was like a forest that hadn't had a controlled
 burn in decades, just waiting for one person with a match to turn
 it into a disaster. Melissa was Microsoft's fault. They left their
 system wide open to this sort of abuse, they knew it could happen
 and did nothing." -- Bruce Perens

For advanced 3D graphics Performer + OpenGL based examples and tutors: http://www.dorbie.com/


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Tue Jun 01 1999 - 12:42:11 PDT

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