如文件中有數據如下:
123.4 124.5
146.8 178.9
......
vector<Ethan::MATH::vector3f> FeaturePoint;//存入所讀的特徵點
int N=68;FeaturePoint.resize(N);
FILE *filename=fopen("mesh data\\1.jpg.pts","r");
if (filename==NULL)
{
printf("feature point read error!\n");
return;
}
char Buf[64];
int i1=0;
float x,y;
char *cx,*cy;
cx=cy=NULL;
while (i1<N)
{
fscanf(filename,"%f %f",&FeaturePoint[i1].x,&FeaturePoint[i1].y);//%f空格%f
FeaturePoint[i1].z=0;
i1++;
}
fclose(filename);