From aa63261fae358d79ded4af4c048635740f229eb5 Mon Sep 17 00:00:00 2001 From: cignoni Date: Tue, 1 Jul 2014 09:46:46 +0000 Subject: [PATCH] Improved float/double when reading ascii formats (read in double and then convert to the needed type) --- wrap/io_trimesh/import_out.h | 4 ++-- wrap/io_trimesh/import_ptx.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wrap/io_trimesh/import_out.h b/wrap/io_trimesh/import_out.h index 7518fdb5..6aa3ccb7 100644 --- a/wrap/io_trimesh/import_out.h +++ b/wrap/io_trimesh/import_out.h @@ -76,7 +76,7 @@ static void readline(FILE *fp, char *line, int max=100){ static bool ReadHeader(FILE *fp,unsigned int &num_cams, unsigned int &num_points){ char line[100]; readline(fp, line); - if( (line[0]=='\0') ) return false; + if( line[0]=='\0' ) return false; line[18]='\0'; if(0!=strcmp("# Bundle file v0.3", line)) return false; readline(fp, line); @@ -168,7 +168,7 @@ static int Open( OpenMeshType &m, std::vector > & shots, fscanf(fp,"%d ",&n_corr); for(uint j = 0; j < n_corr; ++j){ - fscanf(fp,"%d %d %f %f ",&i_cam,&key_sift,&x,&y); + fscanf(fp,"%d %d %lf %lf ",&i_cam,&key_sift,&x,&y); Correspondence corr(i_cam,key_sift,x,y); ch[i].push_back(corr); } diff --git a/wrap/io_trimesh/import_ptx.h b/wrap/io_trimesh/import_ptx.h index 8c7c70a2..46de0e6b 100644 --- a/wrap/io_trimesh/import_ptx.h +++ b/wrap/io_trimesh/import_ptx.h @@ -272,9 +272,9 @@ public: // read the stream if(hascolor) - fscanf(fp,"%f %f %f %f %f %f %f", &xx, &yy, &zz, &rf, &rr, &gg, &bb); + fscanf(fp,"%lf %lf %lf %f %f %f %f", &xx, &yy, &zz, &rf, &rr, &gg, &bb); else - fscanf(fp,"%f %f %f %f", &xx, &yy, &zz, &rf); + fscanf(fp,"%lf %lf %lf %f", &xx, &yy, &zz, &rf); // add the point (*vi).P()[0]=xx;