SegIsect

New Message Reply Date view Thread view Subject view Author view

john goetz (goetzjr++at++gravy5.cs.nps.navy.mil)
Mon, 24 Jan 94 17:24:29 -0800


I am having a problem with performing intersection testing with a pfPlane.

Here is the segment of code where I setup the pfPlane and the pfSeg for
intersection testing. When the program is executed I get a segmentation
violation when pfSegIsectPlane is called.

Can anyone please tell me what is wrong. I am running on a Iris 440/4D RE
with Performer 1.0.

Thank You

**************************************************************************

pfPlane *grnd_plane;

void main() {

    pfVec3 grnd_norm;
    pfVec3 grnd_pos;

    /* initialize Performer */
    pfInit();

    pfMultiprocess(PFMP_DEFAULT);
    pfConfig();

    grnd_plane = (pfPlane*)pfMalloc(sizeof(pfPlane), NULL);
    pfSetVec3(grnd_norm, 0.0f, 0.0f, 1.0f);
    pfSetVec3(grnd_pos, 0.0f, 0.0f, 0.0f);

    pfMakeNormPtPlane(grnd_plane, grnd_norm, grnd_pos);
    pfOffsetPlane(grnd_plane, 0.0f);

    while (TRUE) {

        pfSync();
        pfChanView(chan, view.xyz, view.hpr);
        pfFrame();

        ground_contact();

    } // end while(TRUE)
}// end main()
void ground_contact() {

  float *d;
  pfSeg *foot;

  foot = (pfSeg*)pfMalloc(sizeof(pfSeg), NULL);

  PFSET_VEC3(foot->pos, 0.0f, 0.0f, 10.0f);
  PFSET_VEC3(foot->dir, 0.0f, 0.0f, -1.0f);
  foot->length = 30.0f;

  if(pfSegIsectPlane(foot, grnd_plane, d) == PFIS_FALSE)
    printf("No ground intersection\n");
  else
    printf("ground intersect height = %.3f\n", *d);

}

**************************************************************************

John Goetz
goetzjr++at++cs.nps.navy.mil


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:09 PDT

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