Overloaded Intersection function to compute trimesh-plane intersection,it return the set of faces that are contained into intersected cells.

This commit is contained in:
Paolo Cignoni 2007-09-19 12:16:31 +00:00
parent 61b89756f4
commit 6cee7ca8cd
1 changed files with 38 additions and 0 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.11 2007/05/02 13:25:45 zifnab1974
only use typename when necessary
Revision 1.10 2007/04/10 22:46:57 pietroni Revision 1.10 2007/04/10 22:46:57 pietroni
- line 152 changed call intersection to IntersectionPlaneTriangle because changing in function's name - line 152 changed call intersection to IntersectionPlaneTriangle because changing in function's name
@ -175,6 +178,41 @@ bool Intersection( /*TriMeshType & m, */
return true; return true;
} }
/** \addtogroup complex */
/*@{*/
/**
Compute the intersection between a trimesh and a plane.
given a plane return the set of faces that are contained
into intersected cells.
*/
template < typename TriMeshType, class ScalarType, class IndexingType >
bool Intersection(Plane3<ScalarType> pl,
IndexingType *grid,
typename std::vector<typename TriMeshType::FaceType*> &v)
{
typedef typename TriMeshType::FaceContainer FaceContainer;
typedef IndexingType GridType;
typename TriMeshType::FaceIterator fi;
v.clear();
typename std::vector< typename GridType::Cell* > cells;
Intersect(*grid,pl,cells);
typename std::vector<typename GridType::Cell*>::iterator ic;
typename GridType::Cell fs,ls;
for(ic = cells.begin(); ic != cells.end();++ic)
{
grid->Grid(*ic,fs,ls);
typename GridType::Link * lk = fs;
while(lk != ls){
typename TriMeshType::FaceType & face = *(lk->Elem());
v.push_back(&face);
lk++;
}//end while
}//end for
return true;
}
/*****************************************************************/ /*****************************************************************/
/*INTERSECTION RAY - MESH */ /*INTERSECTION RAY - MESH */
/* */ /* */