src/cdtGen.cpp
/*! \fn void CDTGenerator::readPLCInput()
    \brief Reads PLC from input(only PLY supported currently) file.

    Reads vertex and face information and initializes corresponding linear cell complex _plc_.
*/
\fn void CDTGenerator::readPLCInput()
\brief Reads PLC from input(only PLY supported currently) file.

Reads vertex and face information and initializes corresponding linear cell complex _plc_.
\ fn void CDTGenerator :: readPLCInput () \ brief Reads PLC from input ( only PLY supported currently ) file . Reads vertex and face information and initializes corresponding linear cell complex _plc_ .
void CDTGenerator::readPLCInput()
{
	string fileName;
	cout << "\nPlease enter input filename:\t";
	cin >> fileName;
	p_ply inputPLY = ply_open(fileName.c_str(), NULL, 0, NULL);
	if (!inputPLY) exit(0);
        if (!ply_read_header(inputPLY)) exit(0);
	ply_set_read_cb(inputPLY, "vertex", "x", vertex_cb, NULL, 0);	
	ply_set_read_cb(inputPLY, "vertex", "y", vertex_cb, NULL, 0);
	ply_set_read_cb(inputPLY, "vertex", "z", vertex_cb, NULL, 1);
	ply_set_read_cb(inputPLY, "face", "vertex_indices", face_cb, NULL, 0); 
	dimensionId = 0;
	if (!ply_read(inputPLY))
	{
		cout << "Cannot read the PLY file :(";
		exit(0);
	}
	ply_close(inputPLY);
	size_t vertexIds[3];
	CGALPoint trianglePoints[3];
	for (size_t n = 0, m = plcFaceVector.size(); n < m; n++)
	{
		for (size_t k = 0; k < 3; k++)
			vertexIds[k] = plcFaceVector[n].pointIDs[k];
		for (size_t i = 0; i < 3; i++)
			trianglePoints[i] = CGALPoint(plcVertexVector[vertexIds[i]].x(), plcVertexVector[vertexIds[i]].y(), plcVertexVector[vertexIds[i]].z());
		plc.make_triangle(trianglePoints[0], trianglePoints[1], trianglePoints[2]);
	}
	sew2CellsFromEdge(plc);
}
void CDTGenerator :: readPLCInput ( ) { string fileName ; cout << " \n \t " ; cin >> fileName ; p_ply inputPLY = ply_open ( fileName . c_str ( ) , NULL , 0 , NULL ) ; if ( ! inputPLY ) exit ( 0 ) ; if ( ! ply_read_header ( inputPLY ) ) exit ( 0 ) ; ply_set_read_cb ( inputPLY , " " , " " , vertex_cb , NULL , 0 ) ; ply_set_read_cb ( inputPLY , " " , " " , vertex_cb , NULL , 0 ) ; ply_set_read_cb ( inputPLY , " " , " " , vertex_cb , NULL , 1 ) ; ply_set_read_cb ( inputPLY , " " , " " , face_cb , NULL , 0 ) ; dimensionId = 0 ; if ( ! ply_read ( inputPLY ) ) { cout << " " ; exit ( 0 ) ; } ply_close ( inputPLY ) ; size_t vertexIds [ 3 ] ; CGALPoint trianglePoints [ 3 ] ; for ( size_t n = 0 , m = plcFaceVector . size ( ) ; n < m ; n ++ ) { for ( size_t k = 0 ; k < 3 ; k ++ ) vertexIds [ k ] = plcFaceVector [ n ] . pointIDs [ k ] ; for ( size_t i = 0 ; i < 3 ; i ++ ) trianglePoints [ i ] = CGALPoint ( plcVertexVector [ vertexIds [ i ] ] . x ( ) , plcVertexVector [ vertexIds [ i ] ] . y ( ) , plcVertexVector [ vertexIds [ i ] ] . z ( ) ) ; plc . make_triangle ( trianglePoints [ 0 ] , trianglePoints [ 1 ] , trianglePoints [ 2 ] ) ; } sew2CellsFromEdge ( plc ) ; }
\fn void CDTGenerator::readPLCInput()
\brief Reads PLC from input(only PLY supported currently) file.
\ fn void CDTGenerator :: readPLCInput () \ brief Reads PLC from input ( only PLY supported currently ) file .
// read PLY file(assumed to contain the PLC) // Initialize PLC // sew facets sharing edge