while(index < strlen(objDescription)){
theFirstHasMinus = false;
theSecondHasMinus = false;
theThirdHasMinus = false;
if(objDescription[index] == 'v' && objDescription[index-1] == '\n' && objDescription[index+1] == ' '){
//X coord
if(objDescription[index+2] == '-'){
coordIntNumber[CoordIndex][0] = atoi(&objDescription[index+2]);
coordDecimalNumber[CoordIndex][0] = atoi(&objDescription[index+5]);
fe_out<<coordIntNumber[CoordIndex][0]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][0]<<endl;
theFirstHasMinus = true;
}else{
coordIntNumber[CoordIndex][0] = atoi(&objDescription[index+2]);
coordDecimalNumber[CoordIndex][0]= atoi(&objDescription[index+4]);
fe_out<<coordIntNumber[CoordIndex][0]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][0]<<endl;
theFirstHasMinus = false;
}
//Y coord
if(!theFirstHasMinus){
if(objDescription[index+11] == '-'){
coordIntNumber[CoordIndex][1] = atoi(&objDescription[index+11]);
coordDecimalNumber[CoordIndex][1]= atoi(&objDescription[index+14]);
fe_out<<coordIntNumber[CoordIndex][1]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][1]<<endl;
theSecondHasMinus = true;
}else{
coordIntNumber[CoordIndex][1] = atoi(&objDescription[index+11]);
coordDecimalNumber[CoordIndex][1] = atoi(&objDescription[index+13]);
fe_out<<coordIntNumber[CoordIndex][1]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][1]<<endl;
theSecondHasMinus = false;
}
}else{
if(objDescription[index+12] == '-'){
coordIntNumber[CoordIndex][1] = atoi(&objDescription[index+12]);
coordDecimalNumber[CoordIndex][1]= atoi(&objDescription[index+15]);
fe_out<<coordIntNumber[CoordIndex][1]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][1]<<endl;
theSecondHasMinus = true;
}else{
coordIntNumber[CoordIndex][1] = atoi(&objDescription[index+12]);
coordDecimalNumber[CoordIndex][1] = atoi(&objDescription[index+14]);
fe_out<<coordIntNumber[CoordIndex][1]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][1]<<endl;
theSecondHasMinus = false;
}
}
//Z coord
if(theFirstHasMinus == false && theSecondHasMinus == false){
if(objDescription[index+20] == '-'){
coordIntNumber[CoordIndex][2] = atoi(&objDescription[index+20]);
coordDecimalNumber[CoordIndex][2] = atoi(&objDescription[index+23]);
fe_out<<coordIntNumber[CoordIndex][2]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][2]<<endl;
}else{
coordIntNumber[CoordIndex][2] = atoi(&objDescription[index+20]);
coordDecimalNumber[CoordIndex][2]= atoi(&objDescription[index+22]);
fe_out<<coordIntNumber[CoordIndex][2]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][2]<<endl;
}
}else if((theFirstHasMinus == true && theSecondHasMinus == false) || (theFirstHasMinus == false && theSecondHasMinus == true)){
if(objDescription[index+21] == '-'){
coordIntNumber[CoordIndex][2] = atoi(&objDescription[index+21]);
coordDecimalNumber[CoordIndex][2] = atoi(&objDescription[index+24]);
fe_out<<coordIntNumber[CoordIndex][2]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][2]<<endl;
}else{
coordIntNumber[CoordIndex][2] = atoi(&objDescription[index+21]);
coordDecimalNumber[CoordIndex][2]= atoi(&objDescription[index+23]);
fe_out<<coordIntNumber[CoordIndex][2]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][2]<<endl;
}
}else if(theFirstHasMinus == true && theSecondHasMinus == true){
if(objDescription[index+22] == '-'){
coordIntNumber[CoordIndex][2] = atoi(&objDescription[index+22]);
coordDecimalNumber[CoordIndex][2] = atoi(&objDescription[index+25]);
fe_out<<coordIntNumber[CoordIndex][2]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][2]<<endl;
}else{
coordIntNumber[CoordIndex][2] = atoi(&objDescription[index+22]);
coordDecimalNumber[CoordIndex][2]= atoi(&objDescription[index+24]);
fe_out<<coordIntNumber[CoordIndex][2]<<" ";
fe_out<<coordDecimalNumber[CoordIndex][2]<<endl;
}
}
fe_out<<endl;
//Assign coordinates to vertexCoord
cout<<"Coord "<<CoordIndex<<": ";
//X coord
if(coordIntNumber[CoordIndex][0] >= 0){
vertexCoord[CoordIndex][0] = coordIntNumber[CoordIndex][0]+(coordDecimalNumber[CoordIndex][0]/1000000);
}else{
vertexCoord[CoordIndex][0] = coordIntNumber[CoordIndex][0]-(coordDecimalNumber[CoordIndex][0]/1000000);
}
cout<<vertexCoord[CoordIndex][0]<<" ";
//Y coord
if(coordIntNumber[CoordIndex][1] >= 0){
vertexCoord[CoordIndex][1] = coordIntNumber[CoordIndex][1]+(coordDecimalNumber[CoordIndex][1]/1000000);
}else{
vertexCoord[CoordIndex][1] = coordIntNumber[CoordIndex][1]-(coordDecimalNumber[CoordIndex][1]/1000000);
}
cout<<vertexCoord[CoordIndex][1]<<" ";
//Z coord
if(coordIntNumber[CoordIndex][2] >= 0){
vertexCoord[CoordIndex][2] = coordIntNumber[CoordIndex][2]+(coordDecimalNumber[CoordIndex][2]/1000000);
}else{
vertexCoord[CoordIndex][2] = coordIntNumber[CoordIndex][2]-(coordDecimalNumber[CoordIndex][2]/1000000);
}
cout<<vertexCoord[CoordIndex][2]<<endl;
cout<<"Re-try:"<<endl;
cout<<" "<<vertexCoord[CoordIndex][0]
<<" "<<vertexCoord[CoordIndex][1]
<<" "<<vertexCoord[CoordIndex][2]<<endl;
if(CoordIndex > 1){
cout<<"Now "<<CoordIndex<<" before: "<<CoordIndex-1<<endl;
cout<<"Reading values of precedent coord:"<<endl;
cout<<" "<<vertexCoord[CoordIndex-1][0]
<<" "<<vertexCoord[CoordIndex-1][1]
<<" "<<vertexCoord[CoordIndex-1][2]<<endl;
}
cout<<endl;
++CoordIndex;
}//End IF
index++;
}//End WHILE