src/cdtGen.cpp
/*! \fn void CDTGenerator::removeExteriorTetrahedrons()
 *  \brief Removes tetrahedrons from cdtMesh which are exterior wrt. input PLC.
 */
\fn void CDTGenerator::removeExteriorTetrahedrons()
\brief Removes tetrahedrons from cdtMesh which are exterior wrt. input PLC.
\ fn void CDTGenerator :: removeExteriorTetrahedrons () \ brief Removes tetrahedrons from cdtMesh which are exterior wrt . input PLC .
void CDTGenerator::removeExteriorTetrahedrons()
{
	cout << "Removing exterior tetrahedrons from output mesh..." << endl;
	vector<LCC::Dart_handle> exteriorCellsList;
	CGALPoint plcCentroid; 
	float x = 0.0, y = 0.0, z = 0.0;
	size_t nPoints = 0;
	for (LCC::One_dart_per_cell_range<0>::iterator pIter = plc.one_dart_per_cell<0>().begin(), pIterEnd = plc.one_dart_per_cell<0>().end(); pIter != pIterEnd; pIter++)
	{
		x += plc.point(pIter).x();
		y += plc.point(pIter).y();
		z += plc.point(pIter).z();
		nPoints++;
	}
	plcCentroid = CGALPoint(x / nPoints, y / nPoints, z / nPoints);
	for (LCC::One_dart_per_cell_range<3>::iterator cellIter = cdtMesh.one_dart_per_cell<3>().begin(), cellIterEnd = cdtMesh.one_dart_per_cell<3>().end(); cellIter != cellIterEnd; cellIter++)
	{
		if (isCellOutsidePLC(cellIter, plcCentroid))
			exteriorCellsList.push_back(cellIter);
	}
	size_t nCells = 0;
	for (LCC::One_dart_per_cell_range<3>::iterator cellIter = cdtMesh.one_dart_per_cell<3>().begin(), cellIterEnd = cdtMesh.one_dart_per_cell<3>().end(); cellIter != cellIterEnd; cellIter++)
		nCells++;
	for (vector<LCC::Dart_handle>::iterator cellsToBeRemovedIter = exteriorCellsList.begin(), cellsToBeRemovedIterEnd = exteriorCellsList.end(); cellsToBeRemovedIter != cellsToBeRemovedIterEnd; cellsToBeRemovedIter++)
		remove_cell<LCC, 3>(cdtMesh, *cellsToBeRemovedIter);			
	nCells = 0;
	for (LCC::One_dart_per_cell_range<3>::iterator cellIter = cdtMesh.one_dart_per_cell<3>().begin(), cellIterEnd = cdtMesh.one_dart_per_cell<3>().end(); cellIter != cellIterEnd; cellIter++)
		nCells++;
	writePLYOutput(NULL, cdtMesh, "../../data/outputMesh.ply");
	cout << "Exterior tetrahedrons removed successfully...output mesh saved in outputMesh.ply!!" << endl;
}
void CDTGenerator :: removeExteriorTetrahedrons ( ) { cout << " " << endl ; vector < LCC :: Dart_handle > exteriorCellsList ; CGALPoint plcCentroid ; float x = 0.0 , y = 0.0 , z = 0.0 ; size_t nPoints = 0 ; for ( LCC :: One_dart_per_cell_range < 0 > :: iterator pIter = plc . one_dart_per_cell < 0 > ( ) . begin ( ) , pIterEnd = plc . one_dart_per_cell < 0 > ( ) . end ( ) ; pIter != pIterEnd ; pIter ++ ) { x += plc . point ( pIter ) . x ( ) ; y += plc . point ( pIter ) . y ( ) ; z += plc . point ( pIter ) . z ( ) ; nPoints ++ ; } plcCentroid = CGALPoint ( x / nPoints , y / nPoints , z / nPoints ) ; for ( LCC :: One_dart_per_cell_range < 3 > :: iterator cellIter = cdtMesh . one_dart_per_cell < 3 > ( ) . begin ( ) , cellIterEnd = cdtMesh . one_dart_per_cell < 3 > ( ) . end ( ) ; cellIter != cellIterEnd ; cellIter ++ ) { if ( isCellOutsidePLC ( cellIter , plcCentroid ) ) exteriorCellsList . push_back ( cellIter ) ; } size_t nCells = 0 ; for ( LCC :: One_dart_per_cell_range < 3 > :: iterator cellIter = cdtMesh . one_dart_per_cell < 3 > ( ) . begin ( ) , cellIterEnd = cdtMesh . one_dart_per_cell < 3 > ( ) . end ( ) ; cellIter != cellIterEnd ; cellIter ++ ) nCells ++ ; for ( vector < LCC :: Dart_handle > :: iterator cellsToBeRemovedIter = exteriorCellsList . begin ( ) , cellsToBeRemovedIterEnd = exteriorCellsList . end ( ) ; cellsToBeRemovedIter != cellsToBeRemovedIterEnd ; cellsToBeRemovedIter ++ ) remove_cell < LCC , 3 > ( cdtMesh , * cellsToBeRemovedIter ) ; nCells = 0 ; for ( LCC :: One_dart_per_cell_range < 3 > :: iterator cellIter = cdtMesh . one_dart_per_cell < 3 > ( ) . begin ( ) , cellIterEnd = cdtMesh . one_dart_per_cell < 3 > ( ) . end ( ) ; cellIter != cellIterEnd ; cellIter ++ ) nCells ++ ; writePLYOutput ( NULL , cdtMesh , " " ) ; cout << " " << endl ; }
\fn void CDTGenerator::removeExteriorTetrahedrons()
  \brief Removes tetrahedrons from cdtMesh which are exterior wrt.
\ fn void CDTGenerator :: removeExteriorTetrahedrons () \ brief Removes tetrahedrons from cdtMesh which are exterior wrt .
// Ray-LCC intersection approach, if even number of intersections, then outside else inside.  // endpoint 2 for inside/outside test //// For each 3-cell //// Test if is it exterior cell //	cout << "Number of cells before removal: " << nCells << endl; //// remove cells marked as exterior //	cout << "Number of cells to be removed: " << exteriorCellsList.size() << endl; //	cout << "Number of cells after removal: " << nCells << endl; // write mesh to PLY file