瀏覽代碼

templates

Former-commit-id: 5ebb0e08a32a845623df723b3eaadf7166ceeda9
Alec Jacobson 8 年之前
父節點
當前提交
30fabdc2cb
共有 2 個文件被更改,包括 26 次插入0 次删除
  1. 20 0
      include/igl/matlab_format.cpp
  2. 6 0
      include/igl/matlab_format.h

+ 20 - 0
include/igl/matlab_format.cpp

@@ -91,6 +91,26 @@ IGL_INLINE Eigen::IOFormat igl::matlab_format()
     "\n];");
     "\n];");
 }
 }
 
 
+IGL_INLINE const std::string igl::matlab_format(
+ const double v,
+ const std::string name)
+{
+  using namespace std;
+  string prefix = "";
+  if(!name.empty())
+  {
+    prefix = name + " = ";
+  }
+  return STR(prefix<<v<<";");
+}
+
+IGL_INLINE const std::string igl::matlab_format(
+    const float v,
+    const std::string name)
+{
+  return matlab_format(double(v),name);
+}
+
 #ifdef IGL_STATIC_LIBRARY
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instantiation
 // Explicit template instantiation
 // generated by autoexplicit.sh
 // generated by autoexplicit.sh

+ 6 - 0
include/igl/matlab_format.h

@@ -62,6 +62,12 @@ namespace igl
   IGL_INLINE const std::string matlab_format(
   IGL_INLINE const std::string matlab_format(
     const Eigen::SparseMatrix<DerivedS> & S,
     const Eigen::SparseMatrix<DerivedS> & S,
     const std::string name = "");
     const std::string name = "");
+  IGL_INLINE const std::string matlab_format(
+    const double v,
+    const std::string name = "");
+  IGL_INLINE const std::string matlab_format(
+    const float v,
+    const std::string name = "");
   // Return just IOFormat 
   // Return just IOFormat 
   //
   //
   // Example:
   // Example: