Re: pfChannel->setView and vectors

New Message Reply Date view Thread view Subject view Author view

Scott McMillan (scott++at++ht.com)
Wed, 21 May 1997 13:39:17 -0400 (EDT)


> Hi Performers,
>
> i have some trouble with setting the view point and the
> view direction.
> I have a vector which is my view point and another vector
> for my viewing direction. Lets call this vector for the direction vd.
>
> Is there any method to set the viewing direction with this vector vd
> instead of using euler angles hpr?
>
> If yes, how do i have to do this?

I think the following code is a start...it probably does weird things with
the roll though. Use the returned matrix to set the channel view matrix.

// Compute matrix defining a position of pos with +Y axis is pointing at 'at'
static void lookAt(pfVec3 &pos, pfVec3 &at, pfMatrix &mat)
{
   pfVec3 v;
   static pfVec3 yaxis(0.0f, 1.0f, 0.0f);
     
   // v is direction vector from dcs to 'at'
   v = at - pos;
   v.normalize();

   // Rotate y-axis onto v
   mat.makeVecRotVec(yaxis, v); // rotational part
   mat.setRow(3, pos);
}

-- 
  Scott McMillan  |    HT Medical, Inc.   | Developing medical VE's
   scott++at++ht.com   |   http://www.ht.com   | surgical simulations
 Ph: 301-984-3706 |6001 Montrose Rd., #902| and surgery simulation
Fax: 301-984-2104 |  Rockville, MD 20852  | creation tools.

======================================================================= List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/ Submissions: info-performer++at++sgi.com Admin. requests: info-performer-request++at++sgi.com


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:55:16 PDT

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