pfuAddArc problems

New Message Reply Date view Thread view Subject view Author view

Carsten Scharfe (dragon++at++hni.uni-paderborn.de)
Thu, 15 May 1997 12:37:39 +0200 (MDT)


Hi performers,

i'd like to turn the viewpoint with pfuPath und pfuAddArc.

But it seems to be the way doing it is somehow wrong.
The screen gets black, when pfuFollowPath is first called.
This turning action is only a part in between two paths
(with pfuAddPath). When this action has ended. The following
path is correct, but without the needed rotation.
Here's my code sample of what i've tried:

  move_path(1.0f, pos, begin_position);
  // function call for moving from pos to begin_position
  // this is correct

  rotate_path(2.0f,Position, 0.0f, (begin_position.xyz-pos.xyz), (end_position.xyz-begin_position.xyz));
  // rotate in2 seconds at center Position with radius 0.0 about the angle between the two vectors
  // (begin_position.xyz-pos.xyz) and (end_position.xyz-begin_position.xyz)

  move_path(5.0f, begin_position, end_position);
  // as above

Here is the code of rotate_path:

void rotate_path(float time, pfCoord center, float radius,pfVec3 vec_a, pfVec3 vec_b) {

  pfCoord where;
  pfuPath *p;
  float i;
  pfVec3 vec_c;
  pfVec2 angles;
                                       
  vec_c = vec_a;

  angles[0] = center.hpr[0];
  // starting angle is the current heading

  angles[1] = (acosf((vec_a.dot(vec_b))/(vec_c.length() * vec_b.length())) / M_PI) * 180;
  // calculating the angle between vec_a and vec_b

  p=pfuNewPath();
  pfuAddArc(p, center.xyz, radius, angles);

  where=center;

  for(i=0.0;i<=time*pfGetFrameRate();i+=1.0) {
    pfuFollowPath(p,1.0/pfGetFrameRate(),where.xyz,where.hpr);
    // here ist should turn

    where.hpr.set(pos.hpr[0],-15.0f,0);
    // just a correction of pitch and roll, just to be safe

    md->setPosition(where) //setting actual position including setting of viewpoint
    pfFrame();
  }
}

Thanks for any help in advance.

Carsten Scharfe

=======================================================================
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:14 PDT

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