From: Braun, Tom (UNKNOWN) (tom.braun++at++lmco.com)
Date: 02/15/2000 06:06:10
Has anyone had a problem with the return vector values from a isector test?
I have set up a isector segment to look straight down in order to perform
terrain following. Over most all of my terrain the Terrain Height that is
returned to me is correct. However, over some parts of the terrain, the
height of the terrain that gets reported back to me is 10 to 50 feet below
the actual terrain height. This usually occurs in areas where many (more
than 7) polygon faces meet at a single vertex. Every polygon of my
database has been flagged at "terrain".
Here is a snippet of how I perform my intersect:
double PerformerDisplayWindow::GetTerrainHeight (double x, double y)
{
pfSegSet segset;
long isect;
pfHit **hits[10];
double z= 10000.0f;
double TerrainHeight = 0.0f;
segset.activeMask = 0x1;
segset.isectMask = 0xFFFF;
segset.discFunc = NULL;
segset.bound = NULL;
segset.mode = PFTRAV_IS_PRIM|PFTRAV_IS_NORM|PFTRAV_IS_CULL_BACK;
segset.segs[0].dir.set(0.0f, 0.0f, -1.0f);
segset.segs[0].length = 50000.0f;
segset.segs[0].pos.set(x,y,z);
isect = Shared->model->isect(&segset,hits);
if(isect){
pfVec3 pnt;
(*hits[0])->query(PFQHIT_POINT, pnt.vec);
TerrainHeight = pnt[2];
}
else {
cout << "Warning: No terrain found at this location. TerrainHeight is
being set to zero."<<endl;
TerrainHeight = 0;
}
return(TerrainHeight);
}
This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 06:09:01 PST