Masaki Aono (aono++at++trl.ibm.co.jp)
Mon, 05 Sep 1994 15:16:34 +0900
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)
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:50:32 PDT