Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Currently i am trying to load in data that looks like this....

 

     points {
       (-12.201 -15.781 49.622) (-12.201 -15.781 76.876) (-12.201 12.3 49.622) 
       (-12.201 12.3 76.876) (15.054 -15.781 49.622) (15.054 -15.781 76.876) 
       (15.054 12.3 49.622) (15.054 12.3 76.876) (-8.3853 -13.774 87.493) 
       (-8.3853 4.0987 91.257) (11.239 4.0987 91.257) (11.239 -13.774 87.493) 
       (-2.2526 -10.082 96.412) (-2.2526 -3.3801 97.822) 
       (5.1064 -3.3801 97.822) (5.1064 -10.082 96.412) (-9.6457 12.3 52.176) 
       (12.499 12.3 52.176) (12.499 12.3 74.324) (-9.6457 12.3 74.324) 
       (-9.6457 11.531 78.227) (12.499 11.531 78.227) (9.3989 4.8674 89.912) 
       (-6.5455 4.8674 89.912) (-6.5455 3.3975 91.873) (9.3989 3.3975 91.873) 
       (4.4165 -2.6789 97.207) (-1.5627 -2.6789 97.207) (-9.6457 9.6626 52.176)
     }

 

 

what i am using to load it looks like this.....

 

for(int i = 0; i < 100; i++)
{
	fgets(oneline,255,filein);
	
	if (!(strstr(oneline,"points {") == NULL))
		break;	
}

int current = 0;
for(i=0;i<5000;i++)
{
	fgets(oneline,255,filein);	//readstr(filein,oneline);
	if (!(strstr(oneline,"      }") == NULL))
		break;
	sscanf(oneline, "        (%f %f %f) (%f %f %f) (%f %f %f) \n", &vtemp[i].x, &vtemp[i].y, &vtemp[i].z, &vtemp[i+1].x, &vtemp[i+1].y, &vtemp[i+1].z, &vtemp[i+1].x, &vtemp[i+1].y, &vtemp[i+1].z);
	current += 3;

}

 

There are 2 problems with this, first it doesnt work rigth at all, and second every once in awhile in the input file there are only 2 sets of points instead of 3. any help would be apreciated.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...