Update eigen to v5.0.1 and libigl to v2.6.0. (#11311)

* Update eigen from v3.3.7 to v5.0.1.

This updates eigen from v3.3.7 released on  December 11, 2018-12-11 to v5.0.1
released on 2025-11-11. There have be a large number of bug-fixes,
optimizations, and improvements between these releases. See the details at;

https://gitlab.com/libeigen/eigen/-/releases

It retains the previous custom minimal `CMakeLists.txt`, and adds a
README-OrcaSlicer.md that explains what version and parts of the upstream
eigen release have been included, and where the full release can be found.

* Update libigl from v2.0.0 (or older) to v2.6.0.

This updates libigl from what was probably v2.0.0 released on 2018-10-16 to
v2.6.0 released on 2025-05-15. It's possible the old version was even older
than that but there is no version indicators in the code and I ran out of
patience identifying missing changes and only went back as far as v2.0.0.

There have been a large number of bug-fixes, optimizations, and improvements
between these versions. See the following for details;

https://github.com/libigl/libigl/releases

I retained the minimal custom `CMakeLists.txt`, added `README.md` from the
libigl distribution which identifies the version, and added a
README-OrcaSlicer.md that details the version and parts that have been
included.

* Update libslic3r for libigl v2.6.0 changes.

This updates libslic3r for all changes moving to eigen v5.0.1 and libigl
v2.6.0. Despite the large number of updates to both dependencies, no changes
were required for the eigen update, and only one change was required for the
libigl update.

For libigl, `igl::Hit` was changed to a template taking the Scalar type to
use. Previously it was hard-coded to `float`, so to minimize possible impact
I've updated all places it is used from `igl::Hit` to `igl::Hit<float>`.

* Add compiler option `-DNOMINMAX` for libigl with MSVC.

MSVC by default defines `min(()` and `max()` macros that break
`std::numeric_limits<>::max()`. The upstream cmake that we don't include
adds `-DNOMINMAX` for the libigl module when compiling with MSVC, so we need
to add the same thing here.

* Fix src/libslic3r/TriangleMeshDeal.cpp for the unmodified upstream libigl.

This fixes `TriangleMeshDeal.cpp` to work with the unmodified upstream
libigl v2.6.0. loop.{h,cpp} implementation.

This file and feature was added in PR "BBS Port: Mesh Subdivision" (#12150)
which included changes to `loop.{h,cpp}` in the old version of libigl. This PR
avoids modifying the included dependencies, and uses the updated upstream
versions of those files without any modifications, which requires fixing
TriangleMeshDeal.cpp to work with them.

In particular, the modifications made to `loop.{h,cpp}` included changing the
return type from void to bool, adding additional validation checking of the
input meshes, and returning false if they failed validation. These added
checks looked unnecessary and would only have caught problems if the input
mesh was very corrupt.

To make `TriangleMeshDeal.cpp` work without this built-in checking
functionality, I removed checking/handling of any `false` return value.

There was also a hell of a lot of redundant copying and casting back and forth
between float and double, so I cleaned that up. The input and output meshs use
floats for the vertexes, and there would be no accuracy benefits from casting
to and from doubles for the simple weighted average operations done by
igl::loop(). So this just uses `Eigen:Map` to use the original input mesh
vertex data directly without requiring any copy or casting.

* Move eigen from included `deps_src` to externaly fetched `deps`.

This copys what PrusaSlicer did and moved it from an included dependency under
`deps_src` to an externaly fetched dependency under `deps`. This requires
updating some `CMakeList.txt` configs and removing the old and obsolete
`cmake/modules/FindEigen3.cmake`. The details of when this was done in
PrusaSlicer and the followup fixes are at;

* 21116995d7
* https://github.com/prusa3d/PrusaSlicer/issues/13608
* https://github.com/prusa3d/PrusaSlicer/pull/13609
* e3c277b9ee

For some reason I don't fully understand this also required fixing
`src/slic3r/GUI/GUI_App.cpp` by adding `#include <boost/nowide/cstdio.hpp>` to
fix an `error: ‘remove’ is not a member of ‘boost::nowide'`. The main thing I
don't understand is how it worked before. Note that this include is in the
PrusaSlicer version of this file, but it also significantly deviates from what
is currently in OrcaSlicer in many other ways.

* Whups... I missed adding the deps/Eigen/Eigen.cmake file...

* Tidy some whitespace indenting in CMakeLists.txt.

* Ugh... tabs indenting needing fixes.

* Change the include order of deps/Eigen.

It turns out that although Boost includes some references to Eigen, Eigen also
includes some references to Boost for supporting some of it's additional
numeric types.

I don't think it matters much since we are not using these features, but I
think technically its more correct to say Eigen depends on Boost than the
other way around, so I've re-ordered them.

* Add source for Eigen 5.0.1 download to flatpak yml config.

* Add explicit `DEPENDS dep_Boost to deps/Eigen.

I missed this before. This ensures we don't rely on include orders to make
sure Boost is installed before we configure Eigen.

* Add `DEPENDS dep_Boost dep_GMP dep_MPFR` to deps/Eigen.

It turns out Eigen can also use GMP and MPFR for multi-precision and
multi-precision-rounded numeric types if they are available.

Again, I don't think we are using these so it doesn't really matter, but it is
technically correct and ensures they are there if we ever do need them.

* Fix deps DEPENDENCY ordering for GMP, MPFR, Eigen, and CGAL.

I think this is finally correct. Apparently CGAL also optionally depends on
Eigen, so the correct dependency order from lowest to highest is GMP, MPFR, Eigen, and CGAL.

---------

Co-authored-by: Donovan Baarda <dbaarda@google.com>
Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
Donovan Baarda
2026-05-12 17:09:13 +10:00
committed by SoftFever
parent 797ee70b0b
commit 807520ca1d
1573 changed files with 63323 additions and 161343 deletions

View File

@@ -1,269 +0,0 @@
// This file is part of libigl, a simple c++ geometry processing library.
//
// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla Public License
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.
#ifndef IGL_XML_REANTTWEAKBAR_XML_SERIALIZATION_H
#define IGL_XML_REANTTWEAKBAR_XML_SERIALIZATION_H
#include "../igl_inline.h"
#include "serialize_xml.h"
#undef IGL_HEADER_ONLY
#include "../anttweakbar/ReAntTweakBar.h"
// Forward declarations
namespace igl
{
namespace anttweakbar
{
class ReTwBar;
}
};
namespace tinyxml2
{
class XMLDocument;
};
namespace igl
{
namespace xml
{
// namespace
// {
// IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char* file_name);
// IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc);
// IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char *file_name);
// IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc);
IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char* file_name)
{
const char * name_chars = TwGetBarName(bar->bar);
std::string name = std::string(name_chars) + "_AntTweakBar";
const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items();
for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++)
{
std::string val = bar->get_value_as_string(it->var,it->type);
//::igl::XMLSerializer::SaveObject(val,it->name,name,file_name,false);
::igl::serialize_xml(val,it->name,file_name,false,false);
}
char var[REANTTWEAKBAR_MAX_CB_VAR_SIZE];
// Print all CB variables
const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items();
for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++)
{
TwType type = it->type;
//TwSetVarCallback setCallback = it->setCallback;
TwGetVarCallback getCallback = it->getCallback;
void * clientData = it->clientData;
// I'm not sure how to do what I want to do. getCallback needs to be sure
// that it can write to var. So var needs to point to a valid and big
// enough chunk of memory
getCallback(var,clientData);
std::string val = bar->get_value_as_string(var,type);
//::igl::XMLSerializer::SaveObject(val,it->name,name,file_name,false);
::igl::serialize_xml(val,it->name,file_name,false,false);
}
return true;
}
/*IGL_INLINE bool save_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc)
{
std::vector<char**> buffer;
const char * name_chars = TwGetBarName(bar->bar);
std::string name = std::string(name_chars) + "_AntTweakBar";
::igl::XMLSerializer* s = new ::igl::XMLSerializer(name);
const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items();
for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++)
{
std::string val = bar->get_value_as_string(it->var,it->type);
char** cval = new char*; // create char* on heap
*cval = new char[val.size()+1];
buffer.push_back(cval);
strcpy(*cval,val.c_str());
s->Add(*cval,it->name);
}
char var[REANTTWEAKBAR_MAX_CB_VAR_SIZE];
// Print all CB variables
const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items();
for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++)
{
TwType type = it->type;
//TwSetVarCallback setCallback = it->setCallback;
TwGetVarCallback getCallback = it->getCallback;
void * clientData = it->clientData;
// I'm not sure how to do what I want to do. getCallback needs to be sure
// that it can write to var. So var needs to point to a valid and big
// enough chunk of memory
getCallback(var,clientData);
std::string val = bar->get_value_as_string(var,type);
char** cval = new char*; // create char* on heap
*cval = new char[val.size()+1];
buffer.push_back(cval);
strcpy(*cval,val.c_str());
s->Add(*cval,it->name);
}
s->SaveToXMLDoc(name,doc);
// delete pointer buffers
for(unsigned int i=0;i<buffer.size();i++)
{
delete[] *buffer[i];
delete buffer[i];
}
delete s;
return true;
}*/
IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, const char *file_name)
{
char type_str[REANTTWEAKBAR_MAX_WORD];
char value_str[REANTTWEAKBAR_MAX_WORD];
TwType type;
const char * name_chars = TwGetBarName(bar->bar);
std::string name = std::string(name_chars) + "_AntTweakBar";
const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items();
for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++)
{
char* val;
//::igl::XMLSerializer::LoadObject(val,it->name,name,file_name);
::igl::deserialize_xml(val,it->name,file_name);
sscanf(val,"%s %[^\n]",type_str,value_str);
if(!bar->type_from_string(type_str,type))
{
printf("ERROR: %s type not found... Skipping...\n",type_str);
continue;
}
bar->set_value_from_string(it->name.c_str(),type,value_str);
delete[] val;
}
const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items();
for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++)
{
char* val;
//::igl::XMLSerializer::LoadObject(val,it->name,name,file_name);
::igl::deserialize_xml(val,it->name,file_name);
sscanf(val,"%s %[^\n]",type_str,value_str);
if(!bar->type_from_string(type_str,type))
{
printf("ERROR: %s type not found... Skipping...\n",type_str);
continue;
}
bar->set_value_from_string(it->name.c_str(),type,value_str);
delete[] val;
}
return true;
}
/*IGL_INLINE bool load_ReAntTweakBar(::igl::anttweakbar::ReTwBar* bar, tinyxml2::XMLDocument* doc)
{
std::map<std::string,char*> variables;
std::map<std::string,char*> cbVariables;
const char * name_chars = TwGetBarName(bar->bar);
std::string name = std::string(name_chars) + "_AntTweakBar";
::igl::XMLSerializer* s = new ::igl::XMLSerializer(name);
std::map<std::string,char*>::iterator iter;
const std::vector< ::igl::anttweakbar::ReTwRWItem>& rw_items = bar->get_rw_items();
for(std::vector< ::igl::anttweakbar::ReTwRWItem>::const_iterator it = rw_items.begin(); it != rw_items.end(); it++)
{
variables[it->name] = NULL;
iter = variables.find(it->name);
s->Add(iter->second,iter->first);
}
// Add all CB variables
const std::vector< ::igl::anttweakbar::ReTwCBItem>& cb_items = bar->get_cb_items();
for(std::vector< ::igl::anttweakbar::ReTwCBItem>::const_iterator it = cb_items.begin(); it != cb_items.end(); it++)
{
cbVariables[it->name] = NULL;
iter = cbVariables.find(it->name);
s->Add(iter->second,iter->first);
}
s->LoadFromXMLDoc(doc);
// Set loaded values
char type_str[REANTTWEAKBAR_MAX_WORD];
char value_str[REANTTWEAKBAR_MAX_WORD];
TwType type;
for(iter = variables.begin(); iter != variables.end(); iter++)
{
if(iter->second == NULL)
{
printf("ERROR: '%s' entry not found... Skipping...\n",iter->first.c_str());
continue;
}
sscanf(iter->second,"%s %[^\n]",type_str,value_str);
if(!bar->type_from_string(type_str,type))
{
printf("ERROR: Type '%s' of '%s' not found... Skipping...\n",type_str,iter->first.c_str());
continue;
}
bar->set_value_from_string(iter->first.c_str(),type,value_str);
}
for(iter = cbVariables.begin(); iter != cbVariables.end(); iter++)
{
if(iter->second == NULL)
{
printf("ERROR: '%s' entry not found... Skipping...\n",iter->first.c_str());
continue;
}
sscanf(iter->second,"%s %[^\n]",type_str,value_str);
if(!bar->type_from_string(type_str,type))
{
printf("ERROR: Type '%s' of '%s' not found... Skipping...\n",type_str,iter->first.c_str());
continue;
}
bar->set_value_from_string(iter->first.c_str(),type,value_str);
}
// delete buffers
for(iter = variables.begin(); iter != variables.end(); iter++)
delete[] iter->second;
for(iter = cbVariables.begin(); iter != cbVariables.end(); iter++)
delete[] iter->second;
delete s;
return true;
}*/
// }
}
}
#endif

View File

@@ -183,7 +183,7 @@ namespace igl
initialized = false;
}
IGL_INLINE XMLSerializable::XMLSerializable(const XMLSerializable& obj)
IGL_INLINE XMLSerializable::XMLSerializable(const XMLSerializable& /*obj*/)
{
initialized = false;
objects.clear();

View File

@@ -7,7 +7,6 @@
//#ifndef IGL_SERIALIZATION_TEST_H
//#define IGL_SERIALIZATION_TEST_H
//#include <igl/Timer.h>
#include "serialize_xml.h"
#include "XMLSerializable.h"

View File

@@ -124,7 +124,7 @@ namespace igl
{
std::cerr << "File not found!" << std::endl;
doc->PrintError();
doc = NULL;
delete doc;
}
else
{
@@ -154,7 +154,6 @@ namespace igl
const tinyxml2::XMLElement* child = element->FirstChildElement(name.c_str());
if(child != NULL)
{
bool isBinary = false;
const tinyxml2::XMLAttribute* attr = child->FindAttribute("binary");
if(attr != NULL)
{
@@ -186,7 +185,7 @@ namespace igl
}
template <typename T>
IGL_INLINE typename std::enable_if<std::is_fundamental<T>::value>::type deserialize(T& obj,const tinyxml2::XMLDocument* doc,const tinyxml2::XMLElement* element,const std::string& name)
IGL_INLINE typename std::enable_if<std::is_fundamental<T>::value>::type deserialize(T& obj,const tinyxml2::XMLDocument* /*doc*/,const tinyxml2::XMLElement* element,const std::string& name)
{
const tinyxml2::XMLElement* child = element->FirstChildElement(name.c_str());
if(child != NULL)
@@ -207,7 +206,7 @@ namespace igl
child->SetAttribute("val",obj.c_str());
}
IGL_INLINE void deserialize(std::string& obj,const tinyxml2::XMLDocument* doc,const tinyxml2::XMLElement* element,const std::string& name)
IGL_INLINE void deserialize(std::string& obj,const tinyxml2::XMLDocument* /*doc*/,const tinyxml2::XMLElement* element,const std::string& name)
{
const tinyxml2::XMLElement* child = element->FirstChildElement(name.c_str());
if(child != NULL)
@@ -454,7 +453,7 @@ namespace igl
}
template<typename T,int R,int C,int P,int MR,int MC>
IGL_INLINE void deserialize(
const tinyxml2::XMLDocument* doc,
const tinyxml2::XMLDocument* /*doc*/,
const tinyxml2::XMLElement* element,
const std::string& name,
const std::function<void(const std::string &,T &)> & from_string,
@@ -564,7 +563,7 @@ namespace igl
}
template<typename T,int P,typename I>
IGL_INLINE void deserialize(Eigen::SparseMatrix<T,P,I>& obj,const tinyxml2::XMLDocument* doc,const tinyxml2::XMLElement* element,const std::string& name)
IGL_INLINE void deserialize(Eigen::SparseMatrix<T,P,I>& obj,const tinyxml2::XMLDocument* /*doc*/,const tinyxml2::XMLElement* element,const std::string& name)
{
const tinyxml2::XMLElement* child = element->FirstChildElement(name.c_str());
bool initialized = false;
@@ -589,7 +588,6 @@ namespace igl
mats << matTemp;
std::vector<Eigen::Triplet<T,I> > triplets;
int r=0;
std::string val;
// for each line
@@ -612,7 +610,6 @@ namespace igl
triplets.push_back(Eigen::Triplet<T,I>(row,col,value));
r++;
}
obj.setFromTriplets(triplets.begin(),triplets.end());

View File

@@ -38,22 +38,18 @@ namespace igl
namespace xml
{
struct XMLSerializableBase;
// serializes the given object either to a xml file or to the provided doc data
//
// Templates:
// T type of the object to serialize
// Inputs:
// obj object to serialize
// objectName unique object name,used for the identification
// filename name of the file containing the serialization
// binary set to true to serialize the object in binary format (faster for big data)
// overwrite set to true to overwrite an existing xml file
// element tinyxml2 virtual representation of the current xml node
// Outputs:
// doc contains current tinyxml2 virtual representation of the xml data
//
template <typename T>
IGL_INLINE void serialize_xml(const T& obj,const std::string& filename);
/// Serialize object to file
/// @tparam T type of the object to serialize
/// @param[in] obj object to serialize
/// @param[in] filename name of the file containing the serialization
/// Serialize object to file
///
/// @tparam T type of the object to serialize
/// @param[in] obj object to serialize
/// @param[in] objectName unique object name,used for the identification
/// @param[in] filename name of the file containing the serialization
/// @param[in] binary set to true to serialize the object in binary format (faster for big data)
/// @param[in] overwrite set to true to overwrite an existing xml file
template <typename T>
IGL_INLINE void serialize_xml(
const T& obj,
@@ -61,6 +57,13 @@ namespace igl
const std::string& filename,
bool binary = false,
bool overwrite = false);
/// \overload
template <typename T>
IGL_INLINE void serialize_xml(const T& obj,const std::string& filename);
/// \overload
///
/// @param[in,out] doc contains current tinyxml2 virtual representation of the xml data
/// @param[in,out] element tinyxml2 virtual representation of the current xml node
template <typename T>
IGL_INLINE void serialize_xml(
const T& obj,
@@ -69,29 +72,34 @@ namespace igl
tinyxml2::XMLElement* element,
bool binary = false);
// deserializes the given data from a xml file or doc data back to the provided object
//
// Templates:
// T type of the object to serialize
// Inputs:
//
// objectName unique object name,used for the identification
// filename name of the file containing the serialization
// binary set to true to serialize the object in binary format (faster for big data)
// overwrite set to true to overwrite an existing xml file
// doc contains current tinyxml2 virtual representation of the xml data
// element tinyxml2 virtual representation of the current xml node
// Outputs:
// obj object to load back serialization to
//
template <typename T>
IGL_INLINE void deserialize_xml(T& obj,const std::string& filename);
/// deserialize object to file
///
/// @tparam T type of the object to serialize
/// @param[in] obj object to serialize
/// @param[in] objectName unique object name,used for the identification
/// @param[in] filename name of the file containing the serialization
/// @param[in] binary set to true to serialize the object in binary format (faster for big data)
/// @param[in] overwrite set to true to overwrite an existing xml file
///
/// \fileinfo
template <typename T>
IGL_INLINE void deserialize_xml(T& obj,const std::string& objectName,const std::string& filename);
/// \overload
///
/// \fileinfo
template <typename T>
IGL_INLINE void deserialize_xml(T& obj,const std::string& filename);
/// Deserialize to xml doc
///
/// @param[in,out] doc contains current tinyxml2 virtual representation of the xml data
/// @param[in,out] element tinyxml2 virtual representation of the current xml node
///
/// \fileinfo
template <typename T>
IGL_INLINE void deserialize_xml(T& obj,const std::string& objectName,const tinyxml2::XMLDocument* doc,const tinyxml2::XMLElement* element);
// internal functions
/// @private
namespace serialization_xml
{
// fundamental types

View File

@@ -14,14 +14,13 @@
template <typename DerivedV, typename DerivedF>
IGL_INLINE bool igl::xml::writeDAE(
const std::string & filename,
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F)
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F)
{
using namespace std;
using namespace Eigen;
using namespace tinyxml2;
XMLDocument* doc = new XMLDocument();
tinyxml2::XMLDocument* doc = new tinyxml2::XMLDocument();
const auto & ele = [&doc](
const std::string tag,
@@ -30,11 +29,11 @@ IGL_INLINE bool igl::xml::writeDAE(
const std::map<std::string,std::string> attribs =
std::map<std::string,std::string>(),
const std::string text="",
const std::list<XMLElement *> children =
std::list<XMLElement *>()
)->XMLElement *
const std::list<tinyxml2::XMLElement *> children =
std::list<tinyxml2::XMLElement *>()
)->tinyxml2::XMLElement *
{
XMLElement * element = doc->NewElement(tag.c_str());
tinyxml2::XMLElement * element = doc->NewElement(tag.c_str());
for(const auto & key_value : attribs)
{
element->SetAttribute(key_value.first.c_str(),key_value.second.c_str());
@@ -126,9 +125,9 @@ IGL_INLINE bool igl::xml::writeDAE(
}));
// tinyxml2 seems **not** to print the <?xml ...?> header by default, but it
// also seems that that's OK
XMLError error = doc->SaveFile(filename.c_str());
tinyxml2::XMLError error = doc->SaveFile(filename.c_str());
bool ret = true;
if(error != XML_NO_ERROR)
if(error != tinyxml2::XML_SUCCESS)
{
doc->PrintError();
ret = false;
@@ -136,3 +135,9 @@ IGL_INLINE bool igl::xml::writeDAE(
delete doc;
return ret;
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template bool igl::xml::writeDAE<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
#endif

View File

@@ -14,21 +14,20 @@ namespace igl
{
namespace xml
{
// Write a mesh to a Collada .dae scene file. The resulting scene contains
// a single "geometry" suitable for solid operaions (boolean union,
// intersection, etc.) in SketchUp.
//
// Inputs:
// filename path to .dae file
// V #V by 3 list of vertex positions
// F #F by 3 list of face indices
// Returns true iff success
//
/// Write a mesh to a Collada .dae scene file. The resulting scene contains
/// a single "geometry" suitable for solid operaions (boolean union,
/// intersection, etc.) in SketchUp.
///
/// @param[in] filename path to .dae file
/// @param[in] V #V by 3 list of vertex positions
/// @param[in] F #F by 3 list of face indices
/// @return true iff success
///
template <typename DerivedV, typename DerivedF>
IGL_INLINE bool writeDAE(
const std::string & filename,
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F);
const Eigen::MatrixBase<DerivedV> & V,
const Eigen::MatrixBase<DerivedF> & F);
}
}

View File

@@ -13,9 +13,9 @@
template <typename DerivedV, typename DerivedF>
IGL_INLINE bool igl::xml::write_triangle_mesh(
const std::string str,
const Eigen::PlainObjectBase<DerivedV>& V,
const Eigen::PlainObjectBase<DerivedF>& F,
const bool ascii)
const Eigen::MatrixBase<DerivedV>& V,
const Eigen::MatrixBase<DerivedF>& F,
const FileEncoding fe)
{
using namespace std;
// dirname, basename, extension and filename
@@ -28,6 +28,12 @@ IGL_INLINE bool igl::xml::write_triangle_mesh(
return writeDAE(str,V,F);
}else
{
return igl::write_triangle_mesh(str,V,F,ascii);
return igl::write_triangle_mesh(str,V,F,fe);
}
}
#ifdef IGL_STATIC_LIBRARY
// Explicit template instantiation
// generated by autoexplicit.sh
template bool igl::xml::write_triangle_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::FileEncoding);
#endif

View File

@@ -8,6 +8,7 @@
#ifndef IGL_XML_WRITE_TRIANGLE_MESH_H
#define IGL_XML_WRITE_TRIANGLE_MESH_H
#include "../igl_inline.h"
#include "../FileEncoding.h"
#include <Eigen/Core>
#include <string>
@@ -16,24 +17,22 @@ namespace igl
{
namespace xml
{
// write mesh to a file with automatic detection of file format. supported:
// dae, or any of the formats supported by igl::write_triangle_mesh
//
// Templates:
// Scalar type for positions and vectors (will be read as double and cast
// to Scalar)
// Index type for indices (will be read as int and cast to Index)
// Inputs:
// str path to file
// V eigen double matrix #V by 3
// F eigen int matrix #F by 3
// Returns true iff success
/// write mesh to a file with automatic detection of file format. supported:
/// dae, or any of the formats supported by igl::write_triangle_mesh
///
/// @tparam Scalar type for positions and vectors (will be read as double and cast
/// to Scalar)
/// @tparam Index type for indices (will be read as int and cast to Index)
/// @param[in] str path to file
/// @param[in] V eigen double matrix #V by 3
/// @param[in] F eigen int matrix #F by 3
/// @return true iff success
template <typename DerivedV, typename DerivedF>
IGL_INLINE bool write_triangle_mesh(
const std::string str,
const Eigen::PlainObjectBase<DerivedV>& V,
const Eigen::PlainObjectBase<DerivedF>& F,
const bool ascii = true);
const Eigen::MatrixBase<DerivedV>& V,
const Eigen::MatrixBase<DerivedF>& F,
const FileEncoding fe = FileEncoding::Ascii);
}
}