Sfoglia il codice sorgente

fixed bug in write.h and writeOFF.h

Former-commit-id: 09be14ecb0e01018f310a9bd45c2a29d67e3bea7
dpanozzo 13 anni fa
parent
commit
58561af806
2 ha cambiato i file con 7 aggiunte e 2 eliminazioni
  1. 1 1
      write.h
  2. 6 1
      writeOFF.h

+ 1 - 1
write.h

@@ -15,7 +15,7 @@
 namespace igl 
 {
     // write mesh to an ascii file with automatic detection of file format. supported: obj, off)
-    inline void write(std::string str, Eigen::MatrixXd& V, Eigen::MatrixXi& F)
+    inline bool write(std::string str, Eigen::MatrixXd& V, Eigen::MatrixXi& F)
     {
         const char* p;
         for (p = str.c_str(); *p != '\0'; p++)

+ 6 - 1
writeOFF.h

@@ -12,12 +12,16 @@
 namespace igl 
 {
     // write mesh to an ascii off file
-    inline void writeOFF (std::string fname, Eigen::MatrixXd& V, Eigen::MatrixXi& F)
+    inline bool writeOFF (std::string fname, Eigen::MatrixXd& V, Eigen::MatrixXi& F)
     {
         FILE *fp = fopen (fname.c_str(), "w");
+      
         
         if (!fp)
+        {
             fprintf (stderr, "writeOFF(): could not open file %s", fname.c_str());
+          return false;
+        }
         
         fprintf (fp, "OFF\n%d %d 0\n",  (int) V.rows(), (int) F.rows());
         
@@ -28,6 +32,7 @@ namespace igl
             fprintf (fp, "3 %d %d %d\n", F(i,0), F(i,1), F(i,2));
         
         fclose (fp);
+        return true;
     }
 }