소스 검색

Fixed bug in readoff that cast input to single precision float

Former-commit-id: dbe3c44c3d64210e4f7e55326269d78629f10b4f
Alec Jacobson (jalec 12 년 전
부모
커밋
47eca76c0f
1개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 7
      include/igl/readOFF.cpp

+ 7 - 7
include/igl/readOFF.cpp

@@ -51,9 +51,9 @@ IGL_INLINE bool igl::readOFF(
   // Read vertices
   for(int i = 0;i<number_of_vertices;)
   {
-    float x,y,z,nx,ny,nz;
-    if((has_normals && fscanf(off_file, "%g %g %g %g %g %g\n",&x,&y,&z,&nx,&ny,&nz)==6) || 
-       (!has_normals && fscanf(off_file, "%g %g %g\n",&x,&y,&z)==3))
+    double x,y,z,nx,ny,nz;
+    if((has_normals && fscanf(off_file, "%lg %lg %lg %lg %lg %lg\n",&x,&y,&z,&nx,&ny,&nz)==6) || 
+       (!has_normals && fscanf(off_file, "%lg %lg %lg\n",&x,&y,&z)==3))
     {
       std::vector<Scalar > vertex;
       vertex.resize(3);
@@ -158,10 +158,10 @@ IGL_INLINE bool igl::readOFF(
 
 template <typename DerivedV, typename DerivedF>
 IGL_INLINE bool igl::readOFF(
-                             const std::string str,
-                             Eigen::PlainObjectBase<DerivedV>& V,
-                             Eigen::PlainObjectBase<DerivedF>& F,
-                             Eigen::PlainObjectBase<DerivedV>& N)
+  const std::string str,
+  Eigen::PlainObjectBase<DerivedV>& V,
+  Eigen::PlainObjectBase<DerivedF>& F,
+  Eigen::PlainObjectBase<DerivedV>& N)
 {
   std::vector<std::vector<double> > vV;
   std::vector<std::vector<double> > vN;