info-inventor-dev
[Top] [All Lists]

RE: About SoVRMLOrientationInterpolator in TGS inventor

To: SMTP@xxxxxxx
Subject: RE: About SoVRMLOrientationInterpolator in TGS inventor
From: mmh@xxxxxxx (Mike Heck)
Date: Fri, 27 Jul 2001 11:02:12 -0700 (PDT)
Cc: "info-inventor-dev@xxxxxxxxxxx"@tgs.com
Sender: owner-info-inventor-dev@xxxxxxxxxxx
 > Hi, I am using TGS inventor to make key frame animation
 > using SoVRMLOrientationInterpolator.
 > But I don't know how to set multiple keyValues.
 > 
 > I know that  type of keyValue is a SoMFRotation which has the method as
 > follows.
 > 
 >      void setValues(int stat, int num, const SbRotation *newValues)
 > 
 > It must be work. But I failed.
 > 
 > What I would like to do is to translate VRML description as follows into
 > C++ description.
 > 
 > OrientationInterpolator{
 >     key [0 0 1]
 >     keyValue[ 0 1 0 0, 0 1 0 3.14 , 0 0 1 3.14 ]
 > }

As far as I know it works.  You didn't say exactly what problem you
are seeing or what code you are trying, but the most common problem
is doing static intialization of an array of complex objects.  In
this case it's particularly tricky because constructing an SbRotation
from four floats causes the floats to be interpreted as a quaternion
(rather than axis/angle).  I've found it easier/safer to use the
set1Value method instead, like this:

  const int numval = 3;
  static float axis[][3] = {{1,0,0},{0,1,0},{0,0,1}};
  static float angle[]  = {0, 3.14f, 3.14f};
  SoVRMLOrientationInterpolator *pNode = new SoVRMLOrientationInterpolator;
  for (int i = 0; i < numval; i++) {
    pNode->keyValue.set1Value( i, SbRotation(axis[i],angle[i]) );
  }

-Mike
 TGS Inc, http://www.tgs.com

<Prev in Thread] Current Thread [Next in Thread>