matching primitive ID before and after pfBuilder

New Message Reply Date view Thread view Subject view Author view

Masaki Aono (aono++at++trl.ibm.co.jp)
Mon, 05 Sep 1994 15:16:34 +0900


Is there a method of matching primitive ID before
and after using pfBuilder?

The following is a part of my code:

=================================================

        /* note: not every variable is declared here. */
        pfVec3 Coord[MAXVERTEX];
        ushort PrimitiveID[MAXTRIANGLES];
        pfuBuilder *builder;
        pfuTri tri;
        pfList *gsetList;

        builder = pfuNewBuilder();
        for (i=0;i<numVertex;i++){
                ReadVertex(&x,&y,&z);
                Coord[i][0] = x; Coord[i][1] = y; Coord[i][2] = z;
        }
        for (i=0;i<numTriangles;i++){
                PrimitiveID[i] = i;
                ReadTriangleVertexID(&v1,&v2,&v3);

                pfCopyVec3(tri.coords[0], Coord[v1]);
                pfCopyVec3(tri.coords[1], Coord[v2]);
                pfCopyVec3(tri.coords[2], Coord[v3]);
                pfuAddTri(builder, &tri);
        }
        gsetList = pfuMakeGSets(builder);
        numGSets = pfGetNum(gsetList);
        for (i=0;i<numGSets;i++){
                gset = (pfGSet *)pfGet(gsetList, i);
                pfGSetGState(gset, gstate);
                pfAddGSet(geode, gset);
        }
        pfuDelBuilder(builder);

        ....
        ....

        /* collision detection between a line segment and the face
        defined with the above triangles */

        isect = pfSegsIsectNode(geode, &segset, hits);
        if (isect){
                pfQueryHit(*hits[0], PFQHIT_PRIM, &primitive_id);

        /******************************************************/
        /* Here, I want to match primitive_id with the corresponding
           triangle ID in PrimitiveID[] */
        /******************************************************/
        }

Could anyone let me know how to match primitive_id and
the identical one in PrimitiveID[] ?
I suppose, in general, primitive_id != PrimitiveID[primitive_id].

Regards,
Masaki Aono
(aono++at++trl.ibm.co.jp)
         


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

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