src/cdtGen.cpp
/*! \fn bool CDTGenerator::isTetInsideCavity(Delaunay::Cell_handle ch, LCCWithDartInfo& cavityLCC)
 *  \brief Determines whether given 3-cell is inside Cavity boundary.
 *  \param [in] ch Cell handle pointing to the query tetrahedron.
 *  \param [in] cavityLCC LCC representation of cavity.
 *  \return True if given tetrahedron is inside cavityLCC.
 */
\fn bool CDTGenerator::isTetInsideCavity(Delaunay::Cell_handle ch, LCCWithDartInfo& cavityLCC)
\brief Determines whether given 3-cell is inside Cavity boundary.
\param [in] ch Cell handle pointing to the query tetrahedron.
\param [in] cavityLCC LCC representation of cavity.
\return True if given tetrahedron is inside cavityLCC.
\ fn bool CDTGenerator :: isTetInsideCavity ( Delaunay :: Cell_handle ch LCCWithDartInfo& cavityLCC ) \ brief Determines whether given 3 - cell is inside Cavity boundary . \ param [ in ] ch Cell handle pointing to the query tetrahedron . \ param [ in ] cavityLCC LCC representation of cavity . \ return True if given tetrahedron is inside cavityLCC .
bool CDTGenerator::isTetInsideCavity(Delaunay::Cell_handle ch, LCCWithDartInfo& cavityLCC)
{
	CGALPoint circumcenter1 = circumcenter(ch->vertex(0)->point(), ch->vertex(1)->point(), ch->vertex(2)->point(), ch->vertex(3)->point());
	Random r1 = Random(), r2 = Random(), r3 = Random(); 
	CGALPoint randomEndpoint(r1.get_bits<15>(), r2.get_bits<15>(), r3.get_bits<15>()); 
	CGALRay randomRay = CGALRay(circumcenter1, randomEndpoint);
	size_t nIntersections = 0;
	list<CGALTriangle> cavityTriangles;
	CGALPoint p[3];
	int i;
	for (LCCWithDartInfo::One_dart_per_cell_range<2>::iterator fIter = cavityLCC.one_dart_per_cell<2>().begin(), fIterEnd = cavityLCC.one_dart_per_cell<2>().end(); fIter != fIterEnd; fIter++)	
	{
		i = 0;
		for (LCCWithDartInfo::One_dart_per_incident_cell_range<0, 2>::iterator pIter = cavityLCC.one_dart_per_incident_cell<0, 2>(fIter).begin(), pIterEnd = cavityLCC.one_dart_per_incident_cell<0, 2>(fIter).end(); pIter != pIterEnd; pIter++)
			p[i++] = cavityLCC.point(pIter);
		cavityTriangles.push_back(CGALTriangle(p[0], p[1], p[2]));
	}
	aabbTree tree(cavityTriangles.begin(), cavityTriangles.end());
	nIntersections = tree.number_of_intersected_primitives(randomRay);
	if (nIntersections != 0)
		cout << "No. of interesctions: " << nIntersections << endl;
	return (nIntersections % 2) ? false : true;
}
bool CDTGenerator :: isTetInsideCavity ( Delaunay :: Cell_handle ch , LCCWithDartInfo & cavityLCC ) { CGALPoint circumcenter1 = circumcenter ( ch -> vertex ( 0 ) -> point ( ) , ch -> vertex ( 1 ) -> point ( ) , ch -> vertex ( 2 ) -> point ( ) , ch -> vertex ( 3 ) -> point ( ) ) ; Random r1 = Random ( ) , r2 = Random ( ) , r3 = Random ( ) ; CGALPoint randomEndpoint ( r1 . get_bits < 15 > ( ) , r2 . get_bits < 15 > ( ) , r3 . get_bits < 15 > ( ) ) ; CGALRay randomRay = CGALRay ( circumcenter1 , randomEndpoint ) ; size_t nIntersections = 0 ; list < CGALTriangle > cavityTriangles ; CGALPoint p [ 3 ] ; int i ; for ( LCCWithDartInfo :: One_dart_per_cell_range < 2 > :: iterator fIter = cavityLCC . one_dart_per_cell < 2 > ( ) . begin ( ) , fIterEnd = cavityLCC . one_dart_per_cell < 2 > ( ) . end ( ) ; fIter != fIterEnd ; fIter ++ ) { i = 0 ; for ( LCCWithDartInfo :: One_dart_per_incident_cell_range < 0 , 2 > :: iterator pIter = cavityLCC . one_dart_per_incident_cell < 0 , 2 > ( fIter ) . begin ( ) , pIterEnd = cavityLCC . one_dart_per_incident_cell < 0 , 2 > ( fIter ) . end ( ) ; pIter != pIterEnd ; pIter ++ ) p [ i ++ ] = cavityLCC . point ( pIter ) ; cavityTriangles . push_back ( CGALTriangle ( p [ 0 ] , p [ 1 ] , p [ 2 ] ) ) ; } aabbTree tree ( cavityTriangles . begin ( ) , cavityTriangles . end ( ) ) ; nIntersections = tree . number_of_intersected_primitives ( randomRay ) ; if ( nIntersections != 0 ) cout << " " << nIntersections << endl ; return ( nIntersections % 2 ) ? false : true ; }
\fn bool CDTGenerator::isTetInsideCavity(Delaunay::Cell_handle ch, LCCWithDartInfo& cavityLCC)
  \brief Determines whether given 3-cell is inside Cavity boundary.
\ fn bool CDTGenerator :: isTetInsideCavity ( Delaunay :: Cell_handle ch LCCWithDartInfo& cavityLCC ) \ brief Determines whether given 3 - cell is inside Cavity boundary .
//	cout << "We are here!@!" << endl; // generate a random ray from circumcenter // system time serves as seed. // find intersection with each face of cavity // if number of intersections are even then tetrahedron is outside // else, tetrahedron is outside. // construct AABB tree of cavity: // check number of intersections  //	cout << "Random endpoint is: " << randomEndpoint << endl;