├── .gitignore ├── vcglib ├── eigenlib │ ├── Eigen │ │ ├── Eigen │ │ ├── src │ │ │ ├── Core │ │ │ │ ├── util │ │ │ │ │ ├── NonMPL2.h │ │ │ │ │ └── ReenableStupidWarnings.h │ │ │ │ ├── functors │ │ │ │ │ └── TernaryFunctors.h │ │ │ │ ├── DiagonalProduct.h │ │ │ │ ├── arch │ │ │ │ │ ├── AVX │ │ │ │ │ │ └── TypeCasting.h │ │ │ │ │ ├── Default │ │ │ │ │ │ ├── Settings.h │ │ │ │ │ │ └── ConjHelper.h │ │ │ │ │ ├── SSE │ │ │ │ │ │ └── TypeCasting.h │ │ │ │ │ └── CUDA │ │ │ │ │ │ └── MathFunctions.h │ │ │ │ ├── SelfCwiseBinaryOp.h │ │ │ │ └── Swap.h │ │ │ ├── misc │ │ │ │ ├── lapacke_mangling.h │ │ │ │ └── RealSvd2x2.h │ │ │ ├── SparseCore │ │ │ │ ├── SparseFuzzy.h │ │ │ │ ├── SparseRedux.h │ │ │ │ └── MappedSparseMatrix.h │ │ │ └── SparseLU │ │ │ │ └── SparseLU_Utils.h │ │ ├── Dense │ │ ├── CMakeLists.txt │ │ ├── StdList │ │ ├── StdDeque │ │ ├── StdVector │ │ ├── Householder │ │ ├── Sparse │ │ ├── Jacobi │ │ ├── QtAlignedMalloc │ │ ├── MetisSupport │ │ ├── PardisoSupport │ │ ├── SPQRSupport │ │ ├── SparseQR │ │ ├── Cholesky │ │ ├── QR │ │ ├── UmfPackSupport │ │ ├── SparseCholesky │ │ ├── LU │ │ ├── SVD │ │ ├── PaStiXSupport │ │ ├── SparseLU │ │ ├── Eigenvalues │ │ ├── CholmodSupport │ │ ├── IterativeLinearSolvers │ │ ├── Geometry │ │ ├── SuperLUSupport │ │ ├── SparseCore │ │ └── OrderingMethods │ ├── unsupported │ │ ├── Eigen │ │ │ ├── src │ │ │ │ ├── EulerAngles │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── NonLinearOptimization │ │ │ │ │ ├── r1mpyq.h │ │ │ │ │ ├── rwupdt.h │ │ │ │ │ ├── chkder.h │ │ │ │ │ ├── covar.h │ │ │ │ │ └── fdjac1.h │ │ │ │ ├── LevenbergMarquardt │ │ │ │ │ ├── CopyrightMINPACK.txt │ │ │ │ │ └── LMcovar.h │ │ │ │ ├── SpecialFunctions │ │ │ │ │ └── SpecialFunctionsHalf.h │ │ │ │ ├── MatrixFunctions │ │ │ │ │ └── StemFunction.h │ │ │ │ └── IterativeSolvers │ │ │ │ │ └── IncompleteLU.h │ │ │ ├── CXX11 │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── src │ │ │ │ │ ├── ThreadPool │ │ │ │ │ ├── ThreadYield.h │ │ │ │ │ ├── ThreadLocal.h │ │ │ │ │ ├── ThreadPoolInterface.h │ │ │ │ │ └── ThreadEnvironment.h │ │ │ │ │ └── Tensor │ │ │ │ │ ├── TensorGlobalFunctions.h │ │ │ │ │ ├── TensorMacros.h │ │ │ │ │ ├── TensorContractionBlocking.h │ │ │ │ │ ├── TensorSycl.h │ │ │ │ │ ├── TensorDeviceDefault.h │ │ │ │ │ ├── TensorDevice.h │ │ │ │ │ └── TensorIO.h │ │ │ ├── MoreVectorization │ │ │ ├── CMakeLists.txt │ │ │ ├── Splines │ │ │ ├── ArpackSupport │ │ │ ├── Skyline │ │ │ ├── KroneckerProduct │ │ │ ├── AutoDiff │ │ │ ├── LevenbergMarquardt │ │ │ ├── IterativeSolvers │ │ │ ├── SparseExtra │ │ │ └── NumericalDiff │ │ └── README.txt │ └── howto.txt ├── vcg │ ├── space │ │ └── colorspace.h │ ├── complex │ │ ├── algorithms │ │ │ ├── create │ │ │ │ └── readme.txt │ │ │ ├── tetra │ │ │ │ └── tetfuse_collapse.h │ │ │ └── update │ │ │ │ └── bounding.h │ │ └── all_types.h │ ├── simplex │ │ └── tetrahedron │ │ │ ├── tetrahedron.h │ │ │ └── topology.h │ └── math │ │ └── similarity2.h ├── wrap │ ├── gcache │ │ ├── docs │ │ │ ├── img │ │ │ │ ├── shadow.png │ │ │ │ ├── overflow.png │ │ │ │ └── architecture.png │ │ │ ├── css │ │ │ │ └── prettify.css │ │ │ └── js │ │ │ │ └── prettify.css │ │ └── provider.h │ ├── glw │ │ ├── glheaders.h │ │ ├── glw.h │ │ ├── type.h │ │ ├── config.h │ │ ├── objectdeleter.h │ │ ├── noncopyable.h │ │ └── common.h │ ├── gl │ │ ├── splatting_apss │ │ │ └── splatrenderer.qrc │ │ ├── gl_type_name.h │ │ ├── glu_tessellator_cap.h │ │ └── gl_object.h │ ├── qt │ │ ├── img_qt.h │ │ ├── col_qt_convert.h │ │ ├── anttweakbarMapper.h │ │ ├── outline2_rasterizer.h │ │ ├── to_string.h │ │ └── device_to_logical.h │ ├── nanoply │ │ ├── nanoply_demo │ │ │ └── nanoply_demo.pro │ │ ├── nanoply_vcg │ │ │ └── nanoply_vcg.pro │ │ └── docs │ │ │ └── index.dxy │ ├── system │ │ └── multithreading │ │ │ ├── base.h │ │ │ ├── atomic_int.h │ │ │ ├── scoped_read_lock.h │ │ │ ├── scoped_write_lock.h │ │ │ ├── mt.h │ │ │ ├── condition.h │ │ │ ├── rw_lock.h │ │ │ ├── util.h │ │ │ ├── mutex.h │ │ │ ├── scoped_mutex_lock.h │ │ │ ├── semaphore.h │ │ │ └── atomic_int_generic.h │ ├── igl │ │ └── sample │ │ │ └── trimesh_field_smoothing │ │ │ └── trimesh_field_smoothing.pro │ ├── openfbx │ │ ├── .gitignore │ │ └── README.md │ ├── io_trimesh │ │ ├── precision.h │ │ ├── additionalinfo.h │ │ └── how_to_write_an_io_filter.txt │ ├── math │ │ └── sparse_matrix.h │ └── dae │ │ └── xmldocumentmanaging.cpp ├── img │ ├── img.h │ ├── img_info.h │ └── img_base.h ├── .gitignore └── README.md ├── .npmrc ├── .npmignore ├── tests ├── fixture │ └── snowman.stl └── index.js ├── index.js ├── binding.gyp ├── README.md ├── package.json ├── .github └── workflows │ ├── ci.yml │ └── deploy.yml └── lib └── meshprop.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | strict-ssl = true 2 | engine-strict = true 3 | save-exact = true 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | !core 2 | .git 3 | .github 4 | .travis.yml 5 | build 6 | node_modules 7 | tests 8 | -------------------------------------------------------------------------------- /tests/fixture/snowman.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all3dp/meshprop/HEAD/tests/fixture/snowman.stl -------------------------------------------------------------------------------- /vcglib/vcg/space/colorspace.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all3dp/meshprop/HEAD/vcglib/vcg/space/colorspace.h -------------------------------------------------------------------------------- /vcglib/wrap/gcache/docs/img/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all3dp/meshprop/HEAD/vcglib/wrap/gcache/docs/img/shadow.png -------------------------------------------------------------------------------- /vcglib/wrap/gcache/docs/img/overflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all3dp/meshprop/HEAD/vcglib/wrap/gcache/docs/img/overflow.png -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /vcglib/wrap/gcache/docs/img/architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all3dp/meshprop/HEAD/vcglib/wrap/gcache/docs/img/architecture.png -------------------------------------------------------------------------------- /vcglib/vcg/complex/algorithms/create/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/all3dp/meshprop/HEAD/vcglib/vcg/complex/algorithms/create/readme.txt -------------------------------------------------------------------------------- /vcglib/wrap/glw/glheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_GLHEADERS_H 2 | #define GLW_GLHEADERS_H 3 | 4 | #include 5 | 6 | #endif // GLW_GLHEADERS_H 7 | -------------------------------------------------------------------------------- /vcglib/wrap/glw/glw.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_GLW_H 2 | #define GLW_GLW_H 3 | 4 | #include "./context.h" 5 | #include "./utility.h" 6 | 7 | #endif // GLW_GLW_H 8 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | import { createRequire } from 'node:module'; 2 | const require = createRequire(import.meta.url); 3 | 4 | export const meshprop = require('./build/Release/meshprop'); -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /vcglib/wrap/gl/splatting_apss/splatrenderer.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | shaders/Raycasting.glsl 4 | shaders/Finalization.glsl 5 | 6 | 7 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/EulerAngles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EulerAngles_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EulerAngles_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/EulerAngles COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /vcglib/wrap/qt/img_qt.h: -------------------------------------------------------------------------------- 1 | #ifndef IMG_QT_INCLUDES_H_ 2 | #define IMG_QT_INCLUDES_H_ 3 | 4 | // includes all img and all qt wrap headers 5 | 6 | #include "img/img.h" 7 | 8 | #include "wrap/qt/img_qt_convert.h" 9 | #include "wrap/qt/img_qt_io.h" 10 | 11 | #endif /*IMG_QT_INCLUDES_H_*/ 12 | -------------------------------------------------------------------------------- /vcglib/wrap/nanoply/nanoply_demo/nanoply_demo.pro: -------------------------------------------------------------------------------- 1 | DEPENDPATH += ../include 2 | INCLUDEPATH += ../include 3 | CONFIG += stl cmdline c++11 4 | CONFIG -= qt 5 | TEMPLATE = app 6 | SOURCES += main.cpp 7 | 8 | # Mac specific Config required to avoid to make application bundles 9 | CONFIG -= app_bundle 10 | -------------------------------------------------------------------------------- /vcglib/wrap/nanoply/nanoply_vcg/nanoply_vcg.pro: -------------------------------------------------------------------------------- 1 | INCLUDEPATH += ../../../ ../../../eigenlib 2 | CONFIG += console stl c++11 3 | CONFIG += qt 4 | TEMPLATE = app 5 | SOURCES += main.cpp 6 | QT += core 7 | 8 | # Mac specific Config required to avoid to make application bundles 9 | CONFIG -= app_bundle 10 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Eigen_CXX11_HEADERS Tensor TensorSymmetry ThreadPool) 2 | 3 | install(FILES 4 | ${Eigen_CXX11_HEADERS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/CXX11 COMPONENT Devel 6 | ) 7 | 8 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/CXX11 COMPONENT Devel FILES_MATCHING PATTERN "*.h") 9 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/base.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_BASE_H 2 | #define MT_BASE_H 3 | 4 | #include 5 | 6 | #define MT_PREVENT_COPY(CLASS_NAME) \ 7 | private: \ 8 | CLASS_NAME (const CLASS_NAME &); \ 9 | CLASS_NAME & operator = (const CLASS_NAME &); 10 | 11 | #define MT_ASSERT assert 12 | 13 | namespace mt 14 | { 15 | 16 | } 17 | 18 | #endif // MT_BASE_H 19 | -------------------------------------------------------------------------------- /vcglib/wrap/igl/sample/trimesh_field_smoothing/trimesh_field_smoothing.pro: -------------------------------------------------------------------------------- 1 | DEPENDPATH += . ../../.. 2 | INCLUDEPATH += . ../../.. ../../../eigenlib 3 | CONFIG += console c++11 4 | TEMPLATE = app 5 | # Mac specific Config required to avoid to make application bundles 6 | CONFIG -= app_bundle 7 | 8 | QMAKE_CXXFLAGS += -std=c++11 9 | TARGET = trimesh_field_smoothing 10 | SOURCES += trimesh_field_smoothing.cpp ../../../wrap/ply/plylib.cpp 11 | -------------------------------------------------------------------------------- /vcglib/wrap/glw/type.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_TYPE_H 2 | #define GLW_TYPE_H 3 | 4 | #include "./common.h" 5 | 6 | namespace glw 7 | { 8 | 9 | enum Type 10 | { 11 | InvalidType = 0, 12 | BufferType, 13 | RenderbufferType, 14 | VertexShaderType, 15 | GeometryShaderType, 16 | FragmentShaderType, 17 | ProgramType, 18 | Texture2DType, 19 | TextureCubeType, 20 | FramebufferType 21 | }; 22 | 23 | }; 24 | 25 | #endif // GLW_TYPE_H 26 | -------------------------------------------------------------------------------- /vcglib/img/img.h: -------------------------------------------------------------------------------- 1 | #ifndef IMG_INCLUDES_H_ 2 | #define IMG_INCLUDES_H_ 3 | /*! \file img.h 4 | \brief includes all img headers 5 | 6 | This header just includes every img module header. 7 | */ 8 | 9 | #include "img/img_base.h" 10 | #include "img_scalar.h" 11 | #include "img/img_image.h" 12 | #include "img_convert.h" 13 | #include "img_cs_base.h" 14 | #include "img_io.h" 15 | #include "img_info.h" 16 | #include "img_filter.h" 17 | 18 | #endif /*IMG_INCLUDES_H_*/ 19 | -------------------------------------------------------------------------------- /vcglib/wrap/openfbx/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | projects/tmp/* 30 | 31 | # Executables 32 | *.out 33 | *.app 34 | 35 | runtime/imgui.ini -------------------------------------------------------------------------------- /vcglib/wrap/glw/config.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_CONFIG_H 2 | #define GLW_CONFIG_H 3 | 4 | #ifndef GLW_ASSERT 5 | # define GLW_ASSERT assert 6 | #endif 7 | 8 | #ifndef GLW_IMPLEMENT_CUSTOM_UNIFORMS 9 | # define GLW_IMPLEMENT_CUSTOM_UNIFORMS 10 | #endif 11 | 12 | #ifndef GLW_PRINT_LOG_TO_STDERR 13 | # define GLW_PRINT_LOG_TO_STDERR 1 14 | #endif 15 | 16 | #ifndef GLW_ASSERT_UNIFORM_LOCATION 17 | # define GLW_ASSERT_UNIFORM_LOCATION 0 18 | #endif 19 | 20 | #endif // GLW_CONFIG_H 21 | -------------------------------------------------------------------------------- /vcglib/wrap/gcache/docs/css/prettify.css: -------------------------------------------------------------------------------- 1 | .str,.atv{color:#080} 2 | .kwd,.tag{color:#008} 3 | .com{color:#800} 4 | .typ,.atn,.dec{color:#606} 5 | .lit{color:#066} 6 | .pun{color:#660} 7 | .pln{color:#000} 8 | pre.prettyprint{padding:2px;border:1px solid #888} 9 | @media print{.str{color:#060} 10 | .kwd,.tag{color:#006;font-weight:bold} 11 | .com{color:#600;font-style:italic} 12 | .typ{font-weight:bold} 13 | .lit{color:#044} 14 | .pun{color:#440} 15 | .atn,.typ{color:#404} 16 | .atv{color:#060}} 17 | -------------------------------------------------------------------------------- /vcglib/wrap/gcache/docs/js/prettify.css: -------------------------------------------------------------------------------- 1 | .str,.atv{color:#080} 2 | .kwd,.tag{color:#008} 3 | .com{color:#800} 4 | .typ,.atn,.dec{color:#606} 5 | .lit{color:#066} 6 | .pun{color:#660} 7 | .pln{color:#000} 8 | pre.prettyprint{padding:2px;border:1px solid #888} 9 | @media print{.str{color:#060} 10 | .kwd,.tag{color:#006;font-weight:bold} 11 | .com{color:#600;font-style:italic} 12 | .typ{font-weight:bold} 13 | .lit{color:#044} 14 | .pun{color:#440} 15 | .atn,.typ{color:#404} 16 | .atv{color:#060}} 17 | -------------------------------------------------------------------------------- /vcglib/wrap/glw/objectdeleter.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_OBJECTDELETER_H 2 | #define GLW_OBJECTDELETER_H 3 | 4 | #include "./common.h" 5 | 6 | namespace glw 7 | { 8 | 9 | class Object; 10 | 11 | namespace detail 12 | { 13 | 14 | class ObjectDeleter 15 | { 16 | public: 17 | 18 | typedef void BaseType; 19 | typedef ObjectDeleter ThisType; 20 | 21 | inline void operator () (Object * object) const; 22 | }; 23 | 24 | }; 25 | 26 | }; 27 | 28 | #endif // GLW_OBJECTDELETER_H 29 | -------------------------------------------------------------------------------- /vcglib/vcg/complex/algorithms/tetra/tetfuse_collapse.h: -------------------------------------------------------------------------------- 1 | #ifndef VCG_TETFUSECOLLAPSE_H 2 | #define VCG_TETFUSECOLLAPSE_H 3 | 4 | namespace vcg { 5 | namespace tetra { 6 | 7 | template < class TetraMesh > 8 | class TetFuser { 9 | typedef typename TetraMesh::VertexType VertexType; 10 | typedef typename TetraMesh::TetraType TetraType; 11 | typedef typename TetraMesh::CoordType CoordType; 12 | typedef typename TetraMesh::ScalarType ScalarType; 13 | 14 | 15 | }; 16 | 17 | } 18 | } 19 | 20 | #endif -------------------------------------------------------------------------------- /vcglib/wrap/qt/col_qt_convert.h: -------------------------------------------------------------------------------- 1 | #ifndef COL_QT_CONVERT_H_ 2 | #define COL_QT_CONVERT_H_ 3 | 4 | #include 5 | #include "../../vcg/space/color4.h" 6 | 7 | namespace vcg 8 | { 9 | class ColorConverter 10 | { 11 | public: 12 | inline static vcg::Color4b ToColor4b(const QColor& col) 13 | { 14 | return vcg::Color4b(col.red(),col.green(),col.blue(),col.alpha()); 15 | } 16 | 17 | inline static QColor ToQColor(const vcg::Color4b& col) 18 | { 19 | return QColor(col[0],col[1],col[2],col[3]); 20 | } 21 | }; 22 | } 23 | 24 | #endif -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/misc/lapacke_mangling.h: -------------------------------------------------------------------------------- 1 | #ifndef LAPACK_HEADER_INCLUDED 2 | #define LAPACK_HEADER_INCLUDED 3 | 4 | #ifndef LAPACK_GLOBAL 5 | #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) 6 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 7 | #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) 8 | #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME 9 | #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) 10 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname 11 | #else 12 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 13 | #endif 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /vcglib/wrap/nanoply/docs/index.dxy: -------------------------------------------------------------------------------- 1 | 2 | /** \mainpage The NanoPLY Library 3 | The NanoPLY is a C++ header-only library to read and write PLY file. It allow to load and save polygonal meshes and point clouds. 4 | 5 | NanoPLY does not require compiling or installing, just an #include in your code. 6 | 7 | 8 | Examples 9 | ---------------- 10 | The following code shows how to open and save a Ply file using a custom definition of mesh. 11 | 12 | \include nanoply_demo/main.cpp 13 | 14 | 15 | The following code shows how to open and save a Ply file using a VCGLib mesh. 16 | 17 | \include nanoply_vcg/main.cpp 18 | 19 | 20 | */ 21 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/atomic_int.h: -------------------------------------------------------------------------------- 1 | #ifndef _ATOMIC_INT_H 2 | #define _ATOMIC_INT_H 3 | 4 | #ifdef QT_CORE_LIB 5 | #include 6 | namespace mt{ 7 | typedef QAtomicInt atomicInt; 8 | } 9 | 10 | #elif defined(__APPLE__) 11 | # include "atomic_int_apple.h" 12 | 13 | 14 | //generic implementation using mutexes 15 | #else 16 | # include "atomic_int_generic.h" 17 | #endif 18 | 19 | /* 20 | #elif defined(_WIN32) 21 | # include "atomic_int_win32.h" 22 | #endif 23 | 24 | #elif defined(__linux__) 25 | # include "atomic_int_linux.h" 26 | #endif 27 | */ 28 | /* 29 | __linux__ 30 | __unix__ 31 | __posix__ 32 | */ 33 | 34 | #endif // _ATOMIC_INT_H 35 | 36 | -------------------------------------------------------------------------------- /vcglib/wrap/qt/anttweakbarMapper.h: -------------------------------------------------------------------------------- 1 | #ifndef ANTTWEAKBARMAPPER_H 2 | #define ANTTWEAKBARMAPPER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | void TW_CALL CopyCDStringToClient(char **destPtr, const char *src); 9 | void TW_CALL CopyStdStringToClient(std::string& destClientString, const std::string& srcLibraryString); 10 | 11 | TwMouseButtonID Qt2TwMouseButtonId(QMouseEvent *e); 12 | int TwMousePressQt(QMouseEvent *e); 13 | int TwMouseReleaseQt(QMouseEvent *e); 14 | int TwMousePressQt(QWidget *qw, QMouseEvent *e); 15 | int TwMouseReleaseQt(QWidget *qw, QMouseEvent *e); 16 | int TwKeyPressQt(QKeyEvent *e); 17 | 18 | #endif // ANTTWEAKBARMAPPER_H 19 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/scoped_read_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_SCOPED_READ_LOCK_H 2 | #define MT_SCOPED_READ_LOCK_H 3 | 4 | #include "rw_lock.h" 5 | 6 | namespace mt 7 | { 8 | 9 | class scoped_read_lock 10 | { 11 | MT_PREVENT_COPY(scoped_read_lock) 12 | 13 | public: 14 | 15 | typedef scoped_read_lock this_type; 16 | typedef void base_type; 17 | 18 | scoped_read_lock(rw_lock & rwl) : rw(rwl) 19 | { 20 | this->rw.lock_read(); 21 | } 22 | 23 | ~scoped_read_lock(void) 24 | { 25 | this->rw.unlock_read(); 26 | } 27 | 28 | protected: 29 | 30 | rw_lock & rw; 31 | }; 32 | 33 | } 34 | 35 | #endif // MT_SCOPED_READ_LOCK_H 36 | -------------------------------------------------------------------------------- /vcglib/wrap/glw/noncopyable.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_NONCOPYABLE_H 2 | #define GLW_NONCOPYABLE_H 3 | 4 | #include "./common.h" 5 | 6 | namespace glw 7 | { 8 | 9 | namespace detail 10 | { 11 | 12 | class NonCopyable 13 | { 14 | public: 15 | 16 | typedef void BaseType; 17 | typedef NonCopyable ThisType; 18 | 19 | NonCopyable(void) 20 | { 21 | ; 22 | } 23 | 24 | private: 25 | 26 | NonCopyable(const ThisType & that) 27 | { 28 | (void)that; 29 | } 30 | 31 | ThisType & operator = (const ThisType & that) 32 | { 33 | (void)that; 34 | return (*this); 35 | } 36 | }; 37 | 38 | }; 39 | 40 | }; 41 | 42 | #endif // GLW_NONCOPYABLE_H 43 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/scoped_write_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_SCOPED_WRITE_LOCK_H 2 | #define MT_SCOPED_WRITE_LOCK_H 3 | 4 | #include "rw_lock.h" 5 | 6 | namespace mt 7 | { 8 | 9 | class scoped_write_lock 10 | { 11 | MT_PREVENT_COPY(scoped_write_lock) 12 | 13 | public: 14 | 15 | typedef scoped_write_lock this_type; 16 | typedef void base_type; 17 | 18 | scoped_write_lock(rw_lock & rwl) : rw(rwl) 19 | { 20 | this->rw.lock_write(); 21 | } 22 | 23 | ~scoped_write_lock(void) 24 | { 25 | this->rw.unlock_write(); 26 | } 27 | 28 | protected: 29 | 30 | rw_lock & rw; 31 | }; 32 | 33 | } 34 | 35 | #endif // MT_SCOPED_WRITE_LOCK_H 36 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/MoreVectorization: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at the mozilla.org home page 8 | 9 | #ifndef EIGEN_MOREVECTORIZATION_MODULE_H 10 | #define EIGEN_MOREVECTORIZATION_MODULE_H 11 | 12 | #include 13 | 14 | namespace Eigen { 15 | 16 | /** 17 | * \defgroup MoreVectorization More vectorization module 18 | */ 19 | 20 | } 21 | 22 | #include "src/MoreVectorization/MathFunctions.h" 23 | 24 | #endif // EIGEN_MOREVECTORIZATION_MODULE_H 25 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/functors/TernaryFunctors.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_TERNARY_FUNCTORS_H 11 | #define EIGEN_TERNARY_FUNCTORS_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | //---------- associative ternary functors ---------- 18 | 19 | 20 | 21 | } // end namespace internal 22 | 23 | } // end namespace Eigen 24 | 25 | #endif // EIGEN_TERNARY_FUNCTORS_H 26 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Eigen_HEADERS 2 | AdolcForward 3 | AlignedVector3 4 | ArpackSupport 5 | AutoDiff 6 | BVH 7 | EulerAngles 8 | FFT 9 | IterativeSolvers 10 | KroneckerProduct 11 | LevenbergMarquardt 12 | MatrixFunctions 13 | MoreVectorization 14 | MPRealSupport 15 | NonLinearOptimization 16 | NumericalDiff 17 | OpenGLSupport 18 | Polynomials 19 | Skyline 20 | SparseExtra 21 | SpecialFunctions 22 | Splines 23 | ) 24 | 25 | install(FILES 26 | ${Eigen_HEADERS} 27 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel 28 | ) 29 | 30 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") 31 | 32 | add_subdirectory(CXX11) 33 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(RegexUtils) 2 | test_escape_string_as_regex() 3 | 4 | file(GLOB Eigen_directory_files "*") 5 | 6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | foreach(f ${Eigen_directory_files}) 9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") 10 | list(APPEND Eigen_directory_files_to_install ${f}) 11 | endif() 12 | endforeach(f ${Eigen_directory_files}) 13 | 14 | install(FILES 15 | ${Eigen_directory_files_to_install} 16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel 17 | ) 18 | 19 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") 20 | -------------------------------------------------------------------------------- /vcglib/wrap/io_trimesh/precision.h: -------------------------------------------------------------------------------- 1 | #ifndef __VCGLIB_PRECISION 2 | #define __VCGLIB_PRECISION 3 | 4 | namespace vcg 5 | { 6 | namespace tri 7 | { 8 | namespace io 9 | { 10 | template 11 | struct Precision 12 | { 13 | static int digits() {return 0;} 14 | static const char* typeName() {return "";} 15 | }; 16 | 17 | template<> 18 | struct Precision 19 | { 20 | static int digits() {return 7;} 21 | static const char* typeName() {return "float";} 22 | 23 | }; 24 | 25 | template<> 26 | struct Precision 27 | { 28 | static int digits() {return 16;} 29 | static const char* typeName() {return "double";} 30 | }; 31 | } 32 | } 33 | } 34 | 35 | 36 | #endif -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/mt.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_MT_H 2 | #define MT_MT_H 3 | 4 | 5 | #ifdef QT_CORE_LIB 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace mt { 12 | typedef QThread thread; 13 | typedef QMutex mutex; 14 | typedef QMutexLocker mutexlocker; 15 | typedef QSemaphore semaphore; 16 | 17 | //cache.h, token.h 18 | //QAtomicInt 19 | 20 | }//namespace 21 | 22 | 23 | #else 24 | 25 | #include "base.h" 26 | #include "mutex.h" 27 | #include "rw_lock.h" 28 | #include "semaphore.h" 29 | #include "thread.h" 30 | #include "scoped_mutex_lock.h" 31 | #include "scoped_read_lock.h" 32 | #include "scoped_write_lock.h" 33 | 34 | namespace mt{ 35 | typedef scoped_mutex_lock mutexlocker; 36 | } 37 | #endif 38 | 39 | #endif // MT_MT_H 40 | -------------------------------------------------------------------------------- /binding.gyp: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { 4 | "target_name": "meshprop", 5 | "sources": [ "lib/meshprop.cpp", "vcglib/wrap/ply/plylib.cpp" ], 6 | "include_dirs": [ 7 | "./lib", 8 | "./vcglib", 9 | " 5 | //#include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | ///this class is used to draw polygons on an image could be vectorial or not 14 | class QtOutline2Rasterizer 15 | { 16 | public: 17 | static void rasterize(vcg::RasterizedOutline2 &poly, 18 | float scaleFactor, 19 | int rast_i, int rotationNum, int gutterWidth); 20 | 21 | static std::vector > rotateGridCWise(std::vector< std::vector >& inGrid); 22 | }; 23 | #endif // QTPOLYRASTERIZER_H 24 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 12 | 13 | // Try to come up with a portable way to yield 14 | #if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) 15 | #define EIGEN_THREAD_YIELD() sched_yield() 16 | #else 17 | #define EIGEN_THREAD_YIELD() std::this_thread::yield() 18 | #endif 19 | 20 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 21 | -------------------------------------------------------------------------------- /vcglib/wrap/qt/to_string.h: -------------------------------------------------------------------------------- 1 | #ifndef TOSTRING_H 2 | #define TOSTRING_H 3 | #include 4 | #include 5 | 6 | inline QString toString( const vcg::Point4f& p ){ 7 | QString s; 8 | s.sprintf("%f %f %f %f", p[0], p[1], p[2], p[3]); 9 | return s; 10 | } 11 | inline QString toString( const vcg::Point3f& p ){ 12 | QString s; 13 | s.sprintf("%f %f %f", p[0], p[1], p[2]); 14 | return s; 15 | } 16 | inline QString toString( const vcg::Point2f& p ){ 17 | QString s; 18 | s.sprintf("%f %f", p[0], p[1]); 19 | return s; 20 | } 21 | inline QString toString( const vcg::Point2i& p ){ 22 | QString s; 23 | s.sprintf("%d %d", p[0], p[1]); 24 | return s; 25 | } 26 | inline QString toString(vcg::Matrix44f& m){ 27 | QString mat; 28 | for(int i=0; i<3; i++){ 29 | mat.append( toString( m.GetRow4(i) ) ); 30 | mat.append("\n"); 31 | } 32 | return mat; 33 | } 34 | #endif // TOSTRING_H 35 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 12 | 13 | // Try to come up with a portable implementation of thread local variables 14 | #if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) 15 | #define EIGEN_THREAD_LOCAL static __thread 16 | #elif EIGEN_COMP_CLANG 17 | #define EIGEN_THREAD_LOCAL static __thread 18 | #else 19 | #define EIGEN_THREAD_LOCAL static thread_local 20 | #endif 21 | 22 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 23 | -------------------------------------------------------------------------------- /vcglib/wrap/glw/common.h: -------------------------------------------------------------------------------- 1 | #ifndef GLW_COMMON_H 2 | #define GLW_COMMON_H 3 | 4 | #include 5 | 6 | #include "./config.h" 7 | 8 | #define GLW_DONT_CARE (0xFFFFFFFF) 9 | #define GLW_CARE_OF(X) ((X) != GLW_DONT_CARE) 10 | 11 | #define GLW_CHECK_GL_ERROR GLW_ASSERT(glGetError() == GL_NO_ERROR) 12 | #define GLW_CHECK_GL_READ_FRAMEBUFFER_STATUS GLW_ASSERT(glCheckFramebufferStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) 13 | #define GLW_CHECK_GL_DRAW_FRAMEBUFFER_STATUS GLW_ASSERT(glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) 14 | #define GLW_CHECK_GL_READ_DRAW_FRAMEBUFFER_STATUS GLW_ASSERT(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) 15 | 16 | namespace glw 17 | { 18 | 19 | namespace detail 20 | { 21 | 22 | } 23 | 24 | }; 25 | 26 | #endif // GLW_COMMON_H 27 | -------------------------------------------------------------------------------- /vcglib/eigenlib/howto.txt: -------------------------------------------------------------------------------- 1 | Current Eigen Version 3.1.2 (05.11.2012) 2 | Current Eigen Version 3.2.1 (26.02.2014) updated on 14/05/2014 3 | Current Eigen Version 3.2.2 (04.08.2014) updated on 21/10/2014 4 | Current Eigen Version 3.2.5 (16.06.2015) updated on 24/09/2015 5 | Current Eigen Version 3.3.2 (18.01.2017) updated on 24/01/2017 6 | Current Eigen Version 3.3.9 (04.12.2020) updated on 15/06/2021 7 | 8 | To update the lib: 9 | - download Eigen 10 | - unzip it somewhere 11 | - delete (in the filesystem) the content of the folder eigenlib/Eigen - copy the folders 'Eigen' and 'unsupported' there 12 | - execute the two following shell commands in the folder 'Eigen' and 'unsupported' 13 | 14 | grep -RiIl 'http://mozilla.org/MPL/2.0/.' * | xargs sed -i 's/http:\/\/mozilla.org\/MPL\/2.0\/./the mozilla.org home page/g' 15 | grep -RiIl 'http' * | xargs sed -i 's/http/xxxp/g' 16 | 17 | - check the git status. 18 | - update this file 19 | - commit everything 20 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/condition.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_CONDITION_H 2 | #define MT_CONDITION_H 3 | 4 | #include "base.h" 5 | #include "mutex.h" 6 | 7 | #include 8 | 9 | namespace mt 10 | { 11 | 12 | class condition 13 | { 14 | MT_PREVENT_COPY(condition) 15 | 16 | public: 17 | 18 | typedef condition this_type; 19 | typedef void base_type; 20 | 21 | condition(void) 22 | { 23 | pthread_cond_init(&(this->c), 0); 24 | } 25 | 26 | ~condition(void) 27 | { 28 | pthread_cond_destroy(&(this->c)); 29 | } 30 | 31 | void signal(void) 32 | { 33 | pthread_cond_signal(&(this->c)); 34 | } 35 | 36 | void broadcast(void) 37 | { 38 | pthread_cond_broadcast(&(this->c)); 39 | } 40 | 41 | void wait(mutex & m) 42 | { 43 | pthread_cond_wait(&(this->c), &(m.m)); 44 | } 45 | 46 | private: 47 | 48 | pthread_cond_t c; 49 | }; 50 | 51 | } 52 | 53 | #endif // MT_CONDITION_H 54 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 31 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/Splines: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 20010-2011 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SPLINES_MODULE_H 11 | #define EIGEN_SPLINES_MODULE_H 12 | 13 | namespace Eigen 14 | { 15 | /** 16 | * \defgroup Splines_Module Spline and spline fitting module 17 | * 18 | * This module provides a simple multi-dimensional spline class while 19 | * offering most basic functionality to fit a spline to point sets. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | } 26 | 27 | #include "src/Splines/SplineFwd.h" 28 | #include "src/Splines/Spline.h" 29 | #include "src/Splines/SplineFitting.h" 30 | 31 | #endif // EIGEN_SPLINES_MODULE_H 32 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/rw_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_RW_LOCK_H 2 | #define MT_RW_LOCK_H 3 | 4 | #include "base.h" 5 | 6 | #include 7 | 8 | namespace mt 9 | { 10 | 11 | class rw_lock 12 | { 13 | MT_PREVENT_COPY(rw_lock) 14 | 15 | public: 16 | 17 | typedef rw_lock this_type; 18 | typedef void base_type; 19 | 20 | rw_lock(void) 21 | { 22 | pthread_rwlock_init(&(this->rw), 0); 23 | } 24 | 25 | ~rw_lock(void) 26 | { 27 | pthread_rwlock_destroy(&(this->rw)); 28 | } 29 | 30 | void lock_read(void) 31 | { 32 | pthread_rwlock_rdlock(&(this->rw)); 33 | } 34 | 35 | void unlock_read(void) 36 | { 37 | pthread_rwlock_unlock(&(this->rw)); 38 | } 39 | 40 | void lock_write(void) 41 | { 42 | pthread_rwlock_wrlock(&(this->rw)); 43 | } 44 | 45 | void unlock_write(void) 46 | { 47 | pthread_rwlock_unlock(&(this->rw)); 48 | } 49 | 50 | private: 51 | 52 | pthread_rwlock_t rw; 53 | }; 54 | 55 | } 56 | 57 | #endif // MT_RW_LOCK_H 58 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/util.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_UTIL_H 2 | #define MT_UTIL_H 3 | 4 | #if (defined(_MSC_VER)) 5 | #include 6 | #elif (defined(__MINGW32__)) 7 | #include 8 | #elif (defined(__linux__)) 9 | #include 10 | #else 11 | #include 12 | //#error "mt utils.h : unrecognized environment." 13 | #endif 14 | 15 | namespace mt 16 | { 17 | 18 | inline void sleep_ms(unsigned int msecs) 19 | { 20 | #if (defined(_MSC_VER)) 21 | Sleep(DWORD(msecs)); 22 | #elif (defined(__MINGW32__)) 23 | Sleep(DWORD(msecs)); 24 | #elif (defined(__linux__)) 25 | const unsigned int secs = ((unsigned int)(msecs / 1000)); 26 | const unsigned long usecs = ((unsigned long)((msecs % 1000) * 1000)); 27 | 28 | sleep(secs); 29 | usleep(usecs); 30 | #else 31 | const unsigned int secs = ((unsigned int)(msecs / 1000)); 32 | const unsigned long usecs = ((unsigned long)((msecs % 1000) * 1000)); 33 | 34 | sleep(secs); 35 | usleep(usecs); 36 | #endif 37 | } 38 | 39 | } 40 | 41 | #endif // MT_UTIL_H 42 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/ArpackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at the mozilla.org home page 8 | 9 | #ifndef EIGEN_ARPACKSUPPORT_MODULE_H 10 | #define EIGEN_ARPACKSUPPORT_MODULE_H 11 | 12 | #include 13 | 14 | /** \defgroup ArpackSupport_Module Arpack support module 15 | * 16 | * This module provides a wrapper to Arpack, a library for sparse eigenvalue decomposition. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include "src/Eigenvalues/ArpackSelfAdjointEigenSolver.h" 27 | 28 | #include 29 | 30 | #endif // EIGEN_ARPACKSUPPORT_MODULE_H 31 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Meshprop Release Workflow](https://github.com/all3dp/meshprop/actions/workflows/deploy.yml/badge.svg)](https://github.com/all3dp/meshprop/actions/workflows/deploy.yml) 2 | 3 | # Get 3D mesh properties 4 | 5 | This NPM-module will calculate the *volume*, *area*, and *boundingbox* of a 3d model. 6 | The algorithm is written in *C++*. And is using internaly the VCG library http://vcg.isti.cnr.it/vcglib/index.html 7 | 8 | ## Supported file formats 9 | Supported by VCG library: PLY, STL, OFF, OBJ, 3DS, COLLADA, PTX, V3D, PTS, APTS, XYZ, GTS, TRI, ASC, X3D, X3DV, VRML, ALN 10 | 11 | Works most reliable with STL and PLY, other formats might experience problems with parsing geometries. 12 | 13 | Usage 14 | ```javascript 15 | import { meshprop } from 'meshprop'; 16 | 17 | meshprop.parse('path-to-my-mesh.stl', function(err, props) { 18 | console.log(props); 19 | }); 20 | ``` 21 | 22 | Example Result 23 | ``` 24 | { 25 | "volume" : 97177.8, 26 | "area" : 15730.4, 27 | "bbox" : { 28 | "x" : 71.054, 29 | "y" : 49.728, 30 | "z" : 95.002 31 | } 32 | } 33 | ``` 34 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #ifndef EIGEN_MPL2_ONLY 29 | #include "SparseCholesky" 30 | #endif 31 | #include "SparseLU" 32 | #include "SparseQR" 33 | #include "IterativeLinearSolvers" 34 | 35 | #endif // EIGEN_SPARSE_MODULE_H 36 | 37 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | 34 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/Skyline: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at the mozilla.org home page 8 | 9 | #ifndef EIGEN_SKYLINE_MODULE_H 10 | #define EIGEN_SKYLINE_MODULE_H 11 | 12 | 13 | #include "Eigen/Core" 14 | 15 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * \defgroup Skyline_Module Skyline module 24 | * 25 | * 26 | * 27 | * 28 | */ 29 | 30 | #include "src/Skyline/SkylineUtil.h" 31 | #include "src/Skyline/SkylineMatrixBase.h" 32 | #include "src/Skyline/SkylineStorage.h" 33 | #include "src/Skyline/SkylineMatrix.h" 34 | #include "src/Skyline/SkylineInplaceLU.h" 35 | #include "src/Skyline/SkylineProduct.h" 36 | 37 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_SKYLINE_MODULE_H 40 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/DiagonalProduct.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2007-2009 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | #ifndef EIGEN_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/KroneckerProduct: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at the mozilla.org home page 8 | 9 | #ifndef EIGEN_KRONECKER_PRODUCT_MODULE_H 10 | #define EIGEN_KRONECKER_PRODUCT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 15 | 16 | #include "../../Eigen/src/SparseCore/SparseUtil.h" 17 | 18 | namespace Eigen { 19 | 20 | /** 21 | * \defgroup KroneckerProduct_Module KroneckerProduct module 22 | * 23 | * This module contains an experimental Kronecker product implementation. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | } // namespace Eigen 31 | 32 | #include "src/KroneckerProduct/KroneckerTensorProduct.h" 33 | 34 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H 37 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(std::size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, std::size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | std::memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (xxxp://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/mutex.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_MUTEX_H 2 | #define MT_MUTEX_H 3 | 4 | #include "base.h" 5 | 6 | #include 7 | 8 | namespace mt 9 | { 10 | 11 | class condition; 12 | 13 | class mutex 14 | { 15 | MT_PREVENT_COPY(mutex) 16 | 17 | public: 18 | 19 | typedef mutex this_type; 20 | typedef void base_type; 21 | 22 | mutex(void) 23 | { 24 | pthread_mutex_init(&(this->m), 0); 25 | } 26 | 27 | ~mutex(void) 28 | { 29 | pthread_mutex_destroy(&(this->m)); 30 | } 31 | 32 | void lock(void) 33 | { 34 | pthread_mutex_lock(&(this->m)); 35 | } 36 | 37 | void unlock(void) 38 | { 39 | pthread_mutex_unlock(&(this->m)); 40 | } 41 | bool tryLock(void) 42 | { 43 | int a = pthread_mutex_trylock(&(this->m)); 44 | return a == 0; 45 | } 46 | 47 | private: 48 | 49 | friend class condition; 50 | 51 | pthread_mutex_t m; 52 | }; 53 | 54 | } 55 | 56 | #endif // MT_MUTEX_H 57 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED_2 2 | // "DisableStupidWarnings.h" was included twice recursively: Do not reenable warnings yet! 3 | # undef EIGEN_WARNINGS_DISABLED_2 4 | 5 | #elif defined(EIGEN_WARNINGS_DISABLED) 6 | #undef EIGEN_WARNINGS_DISABLED 7 | 8 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 9 | #ifdef _MSC_VER 10 | #pragma warning( pop ) 11 | #elif defined __INTEL_COMPILER 12 | #pragma warning pop 13 | #elif defined __clang__ 14 | #pragma clang diagnostic pop 15 | #elif defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 16 | #pragma GCC diagnostic pop 17 | #endif 18 | 19 | #if defined __NVCC__ 20 | // Don't reenable the diagnostic messages, as it turns out these messages need 21 | // to be disabled at the point of the template instantiation (i.e the user code) 22 | // otherwise they'll be triggered by nvcc. 23 | // #pragma diag_default code_is_unreachable 24 | // #pragma diag_default initialization_not_reachable 25 | // #pragma diag_default 2651 26 | // #pragma diag_default 2653 27 | #endif 28 | 29 | #endif 30 | 31 | #endif // EIGEN_WARNINGS_DISABLED 32 | -------------------------------------------------------------------------------- /tests/index.js: -------------------------------------------------------------------------------- 1 | import { fileURLToPath } from 'node:url'; 2 | import { dirname } from 'node:path'; 3 | import assert from 'assert'; 4 | import { meshprop } from '../index.js'; 5 | 6 | const __filename = fileURLToPath(import.meta.url); 7 | const __dirname = dirname(__filename); 8 | 9 | describe("meshprop tests", function () { 10 | it("should get correct results for the fixture", function (done) { 11 | meshprop.parse(__dirname + "/fixture/snowman.stl", function (err, res) { 12 | assert.strictEqual(err, null); 13 | assert.deepStrictEqual(res, { 14 | "volume": 97177.8125, 15 | "area": 15730.4033203125, 16 | "bbox": { 17 | "x": 71.05400085449219, 18 | "y": 49.72800064086914, 19 | "z": 95.00199890136719 20 | } 21 | }); 22 | done(); 23 | }); 24 | }); 25 | 26 | it("should throw error for damaged file", function (done) { 27 | meshprop.parse("no-existing.stl", function (err, res) { 28 | assert.strictEqual(res, null); 29 | assert.strictEqual(err.message, "Can't import mesh"); 30 | done(); 31 | }); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/AutoDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_AUTODIFF_MODULE 11 | #define EIGEN_AUTODIFF_MODULE 12 | 13 | namespace Eigen { 14 | 15 | /** 16 | * \defgroup AutoDiff_Module Auto Diff module 17 | * 18 | * This module features forward automatic differentation via a simple 19 | * templated scalar type wrapper AutoDiffScalar. 20 | * 21 | * Warning : this should NOT be confused with numerical differentiation, which 22 | * is a different method and has its own module in Eigen : \ref NumericalDiff_Module. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | //@{ 29 | 30 | } 31 | 32 | #include "src/AutoDiff/AutoDiffScalar.h" 33 | // #include "src/AutoDiff/AutoDiffVector.h" 34 | #include "src/AutoDiff/AutoDiffJacobian.h" 35 | 36 | namespace Eigen { 37 | //@} 38 | } 39 | 40 | #endif // EIGEN_AUTODIFF_MODULE 41 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | // TODO : move this to GivensQR once there's such a thing in Eigen 6 | 7 | template 8 | void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector > &v_givens, const std::vector > &w_givens) 9 | { 10 | typedef DenseIndex Index; 11 | 12 | /* apply the first set of givens rotations to a. */ 13 | for (Index j = n-2; j>=0; --j) 14 | for (Index i = 0; i 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 12 | 13 | namespace Eigen { 14 | 15 | // This defines an interface that ThreadPoolDevice can take to use 16 | // custom thread pools underneath. 17 | class ThreadPoolInterface { 18 | public: 19 | virtual void Schedule(std::function fn) = 0; 20 | 21 | // Returns the number of threads in the pool. 22 | virtual int NumThreads() const = 0; 23 | 24 | // Returns a logical thread index between 0 and NumThreads() - 1 if called 25 | // from one of the threads in the pool. Returns -1 otherwise. 26 | virtual int CurrentThreadId() const = 0; 27 | 28 | virtual ~ThreadPoolInterface() {} 29 | }; 30 | 31 | } // namespace Eigen 32 | 33 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 34 | -------------------------------------------------------------------------------- /vcglib/wrap/math/sparse_matrix.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | 6 | ///this class define the interface to use sparse matrix 7 | ///you must extend this class and implement the code of each function in order 8 | ///to the system solver you're using. 9 | ///For details on implementation see system_interface_LDL.h as example 10 | template 11 | class SparseMatrix{ 12 | 13 | public: 14 | 15 | std::vector _Ap; 16 | std::vector _Ai; 17 | std::vector _Ax; 18 | 19 | typedef typename std::pair IndexType; 20 | 21 | int _dimension; 22 | 23 | public: 24 | 25 | ///initilaization of the system 26 | virtual void Initalize(int dimension) 27 | {_dimension=dimension;} 28 | 29 | ///create a sparse matrix given a set of entries as vector 30 | ///of pair of int 31 | virtual void CreateSparse(std::vector Entries) 32 | {} 33 | 34 | ///return the value of the matrix 35 | virtual ScalarType &A(int row,int col) 36 | {return (_Ax[0]);} 37 | 38 | ///return true if the represention of sparse matriz is symmetric 39 | virtual bool IsSymmetric() 40 | {return false;} 41 | 42 | virtual void Zero() 43 | {} 44 | 45 | ///return the dimension of the matrix 46 | virtual int Size(){return _dimension;} 47 | 48 | }; 49 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /vcglib/img/img_info.h: -------------------------------------------------------------------------------- 1 | #ifndef IMG_INFO_H_ 2 | #define IMG_INFO_H_ 3 | 4 | // functions that extrapolate information from read-only images 5 | 6 | namespace img { 7 | 8 | template 9 | inline ScalarType minValue(const Image &image) 10 | { 11 | assert(image.isValid()); 12 | if(Safe){ 13 | if(!image.isValid()) throw ImageException("Invalid image"); 14 | } 15 | ScalarType* array = image.dataValues(); 16 | int length =image.dataValuesSize(); 17 | 18 | ScalarType min = array[0]; 19 | for(int offset=0;offset array[offset]) 21 | min = array[offset]; 22 | return min; 23 | } 24 | 25 | template 26 | inline ScalarType maxValue(const Image &image) 27 | { 28 | assert(image.isValid()); 29 | if(Safe){ 30 | if(!image.isValid()) throw ImageException("Invalid image"); 31 | } 32 | ScalarType* array = image.dataValues(); 33 | int length =image.dataValuesSize(); 34 | 35 | ScalarType max = array[0]; 36 | for(int offset=0;offsetsuitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/LevenbergMarquardt: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_LEVENBERGMARQUARDT_MODULE 11 | #define EIGEN_LEVENBERGMARQUARDT_MODULE 12 | 13 | // #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | /** 23 | * \defgroup LevenbergMarquardt_Module Levenberg-Marquardt module 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | * 29 | * 30 | */ 31 | 32 | #include "Eigen/SparseCore" 33 | #ifndef EIGEN_PARSED_BY_DOXYGEN 34 | 35 | #include "src/LevenbergMarquardt/LMqrsolv.h" 36 | #include "src/LevenbergMarquardt/LMcovar.h" 37 | #include "src/LevenbergMarquardt/LMpar.h" 38 | 39 | #endif 40 | 41 | #include "src/LevenbergMarquardt/LevenbergMarquardt.h" 42 | #include "src/LevenbergMarquardt/LMonestep.h" 43 | 44 | 45 | #endif // EIGEN_LEVENBERGMARQUARDT_MODULE 46 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 12 | 13 | namespace Eigen { 14 | 15 | struct StlThreadEnvironment { 16 | struct Task { 17 | std::function f; 18 | }; 19 | 20 | // EnvThread constructor must start the thread, 21 | // destructor must join the thread. 22 | class EnvThread { 23 | public: 24 | EnvThread(std::function f) : thr_(std::move(f)) {} 25 | ~EnvThread() { thr_.join(); } 26 | 27 | private: 28 | std::thread thr_; 29 | }; 30 | 31 | EnvThread* CreateThread(std::function f) { return new EnvThread(std::move(f)); } 32 | Task CreateTask(std::function f) { return Task{std::move(f)}; } 33 | void ExecuteTask(const Task& t) { t.f(); } 34 | }; 35 | 36 | } // namespace Eigen 37 | 38 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 39 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_SPARSEQR_MODULE_H 9 | #define EIGEN_SPARSEQR_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup SparseQR_Module SparseQR module 16 | * \brief Provides QR decomposition for sparse matrices 17 | * 18 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 19 | * The columns of the input matrix should be reordered to limit the fill-in during the 20 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 21 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 22 | * of built-in and external ordering methods. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | * 28 | * 29 | */ 30 | 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseQR/SparseQR.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | #include "Jacobi" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** \defgroup Cholesky_Module Cholesky module 17 | * 18 | * 19 | * 20 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 21 | * Those decompositions are also accessible via the following methods: 22 | * - MatrixBase::llt() 23 | * - MatrixBase::ldlt() 24 | * - SelfAdjointView::llt() 25 | * - SelfAdjointView::ldlt() 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | */ 31 | 32 | #include "src/Cholesky/LLT.h" 33 | #include "src/Cholesky/LDLT.h" 34 | #ifdef EIGEN_USE_LAPACKE 35 | #ifdef EIGEN_USE_MKL 36 | #include "mkl_lapacke.h" 37 | #else 38 | #include "src/misc/lapacke.h" 39 | #endif 40 | #include "src/Cholesky/LLT_LAPACKE.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_CHOLESKY_MODULE_H 46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 47 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/arch/AVX/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_TYPE_CASTING_AVX_H 11 | #define EIGEN_TYPE_CASTING_AVX_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // For now we use SSE to handle integers, so we can't use AVX instructions to cast 18 | // from int to float 19 | template <> 20 | struct type_casting_traits { 21 | enum { 22 | VectorizedCast = 0, 23 | SrcCoeffRatio = 1, 24 | TgtCoeffRatio = 1 25 | }; 26 | }; 27 | 28 | template <> 29 | struct type_casting_traits { 30 | enum { 31 | VectorizedCast = 0, 32 | SrcCoeffRatio = 1, 33 | TgtCoeffRatio = 1 34 | }; 35 | }; 36 | 37 | 38 | 39 | template<> EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { 40 | return _mm256_cvtps_epi32(a); 41 | } 42 | 43 | template<> EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { 44 | return _mm256_cvtepi32_ps(a); 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_TYPE_CASTING_AVX_H 52 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | /** \cpp11 \returns an expression of the coefficient-wise betainc(\a x, \a a, \a b) to the given tensors. 16 | * 17 | * This function computes the regularized incomplete beta function (integral). 18 | * 19 | */ 20 | template 21 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const 22 | TensorCwiseTernaryOp, 23 | const ADerived, const BDerived, const XDerived> 24 | betainc(const ADerived& a, const BDerived& b, const XDerived& x) { 25 | return TensorCwiseTernaryOp< 26 | internal::scalar_betainc_op, const ADerived, 27 | const BDerived, const XDerived>( 28 | a, b, x, internal::scalar_betainc_op()); 29 | } 30 | 31 | } // end namespace Eigen 32 | 33 | #endif // EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 34 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/IterativeSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_ITERATIVE_SOLVERS_MODULE_H 11 | #define EIGEN_ITERATIVE_SOLVERS_MODULE_H 12 | 13 | #include 14 | 15 | /** 16 | * \defgroup IterativeSolvers_Module Iterative solvers module 17 | * This module aims to provide various iterative linear and non linear solver algorithms. 18 | * It currently provides: 19 | * - a constrained conjugate gradient 20 | * - a Householder GMRES implementation 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | //@{ 26 | 27 | #ifndef EIGEN_MPL2_ONLY 28 | #include "src/IterativeSolvers/IterationController.h" 29 | #include "src/IterativeSolvers/ConstrainedConjGrad.h" 30 | #endif 31 | 32 | #include "src/IterativeSolvers/IncompleteLU.h" 33 | #include "../../Eigen/Jacobi" 34 | #include "../../Eigen/Householder" 35 | #include "src/IterativeSolvers/GMRES.h" 36 | #include "src/IterativeSolvers/DGMRES.h" 37 | //#include "src/IterativeSolvers/SSORPreconditioner.h" 38 | #include "src/IterativeSolvers/MINRES.h" 39 | 40 | //@} 41 | 42 | #endif // EIGEN_ITERATIVE_SOLVERS_MODULE_H 43 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/QR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_QR_MODULE_H 9 | #define EIGEN_QR_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \defgroup QR_Module QR module 20 | * 21 | * 22 | * 23 | * This module provides various QR decompositions 24 | * This module also provides some MatrixBase methods, including: 25 | * - MatrixBase::householderQr() 26 | * - MatrixBase::colPivHouseholderQr() 27 | * - MatrixBase::fullPivHouseholderQr() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/QR/HouseholderQR.h" 35 | #include "src/QR/FullPivHouseholderQR.h" 36 | #include "src/QR/ColPivHouseholderQR.h" 37 | #include "src/QR/CompleteOrthogonalDecomposition.h" 38 | #ifdef EIGEN_USE_LAPACKE 39 | #ifdef EIGEN_USE_MKL 40 | #include "mkl_lapacke.h" 41 | #else 42 | #include "src/misc/lapacke.h" 43 | #endif 44 | #include "src/QR/HouseholderQR_LAPACKE.h" 45 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_QR_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 9 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup UmfPackSupport_Module UmfPackSupport module 21 | * 22 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 23 | * It provides the following factorization class: 24 | * - class UmfPackLU: a multifrontal sequential LU factorization. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 31 | * The dependencies depend on how umfpack has been compiled. 32 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/UmfPackSupport/UmfPackSupport.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 41 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2013 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 11 | #define EIGEN_SPARSECHOLESKY_MODULE_H 12 | 13 | #include "SparseCore" 14 | #include "OrderingMethods" 15 | 16 | #include "src/Core/util/DisableStupidWarnings.h" 17 | 18 | /** 19 | * \defgroup SparseCholesky_Module SparseCholesky module 20 | * 21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 22 | * Those decompositions are accessible via the following classes: 23 | * - SimplicialLLt, 24 | * - SimplicialLDLt 25 | * 26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #ifdef EIGEN_MPL2_ONLY 34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode 35 | #endif 36 | 37 | #include "src/SparseCholesky/SimplicialCholesky.h" 38 | 39 | #ifndef EIGEN_MPL2_ONLY 40 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 46 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/SparseExtra: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SPARSE_EXTRA_MODULE_H 11 | #define EIGEN_SPARSE_EXTRA_MODULE_H 12 | 13 | #include "../../Eigen/Sparse" 14 | 15 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef EIGEN_GOOGLEHASH_SUPPORT 26 | #include 27 | #endif 28 | 29 | /** 30 | * \defgroup SparseExtra_Module SparseExtra module 31 | * 32 | * This module contains some experimental features extending the sparse module. 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | */ 38 | 39 | 40 | #include "src/SparseExtra/DynamicSparseMatrix.h" 41 | #include "src/SparseExtra/BlockOfDynamicSparseMatrix.h" 42 | #include "src/SparseExtra/RandomSetter.h" 43 | 44 | #include "src/SparseExtra/MarketIO.h" 45 | 46 | #if !defined(_WIN32) 47 | #include 48 | #include "src/SparseExtra/MatrixMarketIterator.h" 49 | #endif 50 | 51 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 52 | 53 | #endif // EIGEN_SPARSE_EXTRA_MODULE_H 54 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H 12 | 13 | 14 | /** use this macro in sfinae selection in templated functions 15 | * 16 | * template::value , int >::type = 0 18 | * > 19 | * void foo(){} 20 | * 21 | * becomes => 22 | * 23 | * template::value ) 25 | * > 26 | * void foo(){} 27 | */ 28 | 29 | // SFINAE requires variadic templates 30 | #ifndef __CUDACC__ 31 | #if EIGEN_HAS_VARIADIC_TEMPLATES 32 | // SFINAE doesn't work for gcc <= 4.7 33 | #ifdef EIGEN_COMP_GNUC 34 | #if EIGEN_GNUC_AT_LEAST(4,8) 35 | #define EIGEN_HAS_SFINAE 36 | #endif 37 | #else 38 | #define EIGEN_HAS_SFINAE 39 | #endif 40 | #endif 41 | #endif 42 | 43 | #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \ 44 | typename internal::enable_if< ( __condition__ ) , int >::type = 0 45 | 46 | 47 | #if EIGEN_HAS_CONSTEXPR 48 | #define EIGEN_CONSTEXPR constexpr 49 | #else 50 | #define EIGEN_CONSTEXPR 51 | #endif 52 | 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void rwupdt( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const Matrix< Scalar, Dynamic, 1> &w, 9 | Matrix< Scalar, Dynamic, 1> &b, 10 | Scalar alpha) 11 | { 12 | typedef DenseIndex Index; 13 | 14 | const Index n = r.cols(); 15 | eigen_assert(r.rows()>=n); 16 | std::vector > givens(n); 17 | 18 | /* Local variables */ 19 | Scalar temp, rowj; 20 | 21 | /* Function Body */ 22 | for (Index j = 0; j < n; ++j) { 23 | rowj = w[j]; 24 | 25 | /* apply the previous transformations to */ 26 | /* r(i,j), i=0,1,...,j-1, and to w(j). */ 27 | for (Index i = 0; i < j; ++i) { 28 | temp = givens[i].c() * r(i,j) + givens[i].s() * rowj; 29 | rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj; 30 | r(i,j) = temp; 31 | } 32 | 33 | /* determine a givens rotation which eliminates w(j). */ 34 | givens[j].makeGivens(-r(j,j), rowj); 35 | 36 | if (rowj == 0.) 37 | continue; // givens[j] is identity 38 | 39 | /* apply the current transformation to r(j,j), b(j), and alpha. */ 40 | r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj; 41 | temp = givens[j].c() * b[j] + givens[j].s() * alpha; 42 | alpha = -givens[j].s() * b[j] + givens[j].c() * alpha; 43 | b[j] = temp; 44 | } 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/LU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_LU_MODULE_H 9 | #define EIGEN_LU_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup LU_Module LU module 16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 17 | * This module defines the following MatrixBase methods: 18 | * - MatrixBase::inverse() 19 | * - MatrixBase::determinant() 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/misc/Kernel.h" 27 | #include "src/misc/Image.h" 28 | #include "src/LU/FullPivLU.h" 29 | #include "src/LU/PartialPivLU.h" 30 | #ifdef EIGEN_USE_LAPACKE 31 | #ifdef EIGEN_USE_MKL 32 | #include "mkl_lapacke.h" 33 | #else 34 | #include "src/misc/lapacke.h" 35 | #endif 36 | #include "src/LU/PartialPivLU_LAPACKE.h" 37 | #endif 38 | #include "src/LU/Determinant.h" 39 | #include "src/LU/InverseImpl.h" 40 | 41 | // Use the SSE optimized version whenever possible. At the moment the 42 | // SSE version doesn't compile when AVX is enabled 43 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 44 | #include "src/LU/arch/Inverse_SSE.h" 45 | #endif 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_LU_MODULE_H 50 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 51 | -------------------------------------------------------------------------------- /vcglib/wrap/qt/device_to_logical.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_TO_LOGICAL_H 2 | #define DEVICE_TO_LOGICAL_H 3 | #include 4 | #include 5 | #include 6 | 7 | template < class ValueType> 8 | inline ValueType QTLogicalToDevice( QWidget *qw, const ValueType &value) 9 | { 10 | #if QT_VERSION >= 0x050000 11 | return value*qw->devicePixelRatio() ; 12 | #else 13 | Q_UNUSED(qw); 14 | return value; 15 | #endif 16 | } 17 | 18 | template < class ValueType> 19 | inline ValueType QTLogicalToDevice( QPainter *qp, const ValueType &value) 20 | { 21 | #if QT_VERSION >= 0x050000 22 | return value*qp->device()->devicePixelRatio() ; 23 | #else 24 | Q_UNUSED(qp); 25 | return value; 26 | #endif 27 | } 28 | 29 | template < class ValueType> 30 | inline ValueType QTDeviceToLogical( QWidget *qw, const ValueType &value) 31 | { 32 | #if QT_VERSION >= 0x050000 33 | return value/qw->devicePixelRatio() ; 34 | #else 35 | Q_UNUSED(qw); 36 | return value; 37 | #endif 38 | } 39 | 40 | template < class ValueType> 41 | inline ValueType QTDeviceToLogical( QPainter *qp, const ValueType &value) 42 | { 43 | #if QT_VERSION >= 0x050000 44 | return value/qp->device()->devicePixelRatio() ; 45 | #else 46 | Q_UNUSED(qp); 47 | return value; 48 | #endif 49 | } 50 | 51 | inline vcg::Point2f QTLogicalToOpenGL( QWidget *qw, const QPoint &p) 52 | { 53 | return vcg::Point2f(QTLogicalToDevice(qw,p.x()), QTLogicalToDevice(qw,qw->height()-p.y())); 54 | } 55 | 56 | 57 | inline int QTDeviceHeight(QWidget *qw) {return QTLogicalToDevice(qw,qw->height());} 58 | inline int QTDeviceWidth(QWidget *qw) {return QTLogicalToDevice(qw,qw->width());} 59 | #endif // DEVICE_TO_LOGICAL_H 60 | -------------------------------------------------------------------------------- /vcglib/wrap/openfbx/README.md: -------------------------------------------------------------------------------- 1 | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/nem0/LumixEngine?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 2 | [![License](http://img.shields.io/:license-mit-blue.svg)](http://doge.mit-license.org) 3 | 4 | # OpenFBX 5 | 6 | Lightweight open source FBX importer. Used in [Lumix Engine](https://github.com/nem0/lumixengine). It's not a full-featured importer, but it suits all my needs. It can load geometry (with uvs, normals, tangents, colors), skeletons, animations, materials and textures. 7 | 8 | Feel free to request new features. I will eventually try to add all missing fbx features. 9 | 10 | ## Use the library in your own project 11 | 12 | Note: It's recommended to be familiar with fbx format to use this library, you can read about it more [here](http://help.autodesk.com/view/FBX/2017/ENU/?guid=__files_GUID_F194000D_5AD4_49C1_86CC_5DAC2CE64E97_htm). 13 | 14 | 1. add files from src to your project 15 | 2. use 16 | 17 | See [demo](https://github.com/nem0/OpenFBX/blob/master/demo/main.cpp#L203) as an example how to use the library. 18 | See [Lumix Engine](https://github.com/nem0/LumixEngine/blob/master/src/renderer/editor/import_asset_dialog.cpp#L504) as more advanced use case. 19 | 20 | ## Compile demo project 21 | 22 | 1. download source code 23 | 2. execute [projects/genie_vs15.bat](https://github.com/nem0/OpenFBX/blob/master/projects/genie_vs15.bat) 24 | 3. open projects/tmp/vs2015/OpenFBX.sln in Visual Studio 2015 25 | 4. compile and run 26 | 27 | Demo is windows only. Library is multiplatform. 28 | 29 | ![ofbx](https://user-images.githubusercontent.com/153526/27876079-eea3c872-61b5-11e7-9fce-3a7c558fb0d2.png) 30 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "meshprop", 3 | "version": "6.2.0", 4 | "description": "Get 3D mesh properties", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "prepare": "npm ls", 9 | "install": "node-pre-gyp install --fallback-to-build", 10 | "build": "node-gyp configure && node-pre-gyp clean && node-pre-gyp build", 11 | "test": "mocha tests/*.js", 12 | "release": "node-pre-gyp package && node-pre-gyp testpackage && node-pre-gyp unpublish && node-pre-gyp publish" 13 | }, 14 | "author": "All3dp ", 15 | "contributors": [ 16 | "Alexander Friedl ", 17 | "Henry ", 18 | "David Farkas ", 19 | "Jonathan Häberle (https://github.com/dreampulse/)" 20 | ], 21 | "license": "MIT", 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/all3dp/meshprop" 25 | }, 26 | "keywords": [ 27 | "3d", 28 | "mesh", 29 | "stl" 30 | ], 31 | "dependencies": { 32 | "@mapbox/node-pre-gyp": "2.0.3", 33 | "node-addon-api": "8.5.0" 34 | }, 35 | "devDependencies": { 36 | "assert": "2.1.0", 37 | "aws-sdk": "2.1693.0", 38 | "mocha": "11.7.5" 39 | }, 40 | "bundledDependencies": [ 41 | "@mapbox/node-pre-gyp" 42 | ], 43 | "gypfile": true, 44 | "binary": { 45 | "module_name": "meshprop", 46 | "module_path": "./build/{configuration}/", 47 | "remote_path": "./{module_name}/v{version}/{configuration}/", 48 | "package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz", 49 | "host": "https://meshprop.s3-eu-west-1.amazonaws.com" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Meshprop CI Workflow 2 | 3 | on: 4 | push: 5 | branches-ignore: 6 | - master 7 | 8 | jobs: 9 | test-ubuntu: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node: ["18", "20", "22", "24"] 14 | 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Use Node.js 20 | uses: actions/setup-node@v4 21 | with: 22 | node-version: ${{ matrix.node }} 23 | 24 | - name: Cache NPM dependencies 25 | uses: actions/cache@v4 26 | with: 27 | path: ~/.npm 28 | key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} 29 | restore-keys: | 30 | ${{ runner.OS }}-npm-cache- 31 | 32 | - name: Install npm dependencies 33 | run: npm ci 34 | 35 | - name: Build 36 | run: npm run build 37 | 38 | - name: Tests 39 | run: npm test 40 | 41 | test-macos: 42 | runs-on: "macos-latest" 43 | strategy: 44 | matrix: 45 | node: ["18", "20", "22", "24"] 46 | 47 | steps: 48 | - name: Checkout 49 | uses: actions/checkout@v4 50 | 51 | - name: Use Node.js 52 | uses: actions/setup-node@v4 53 | with: 54 | node-version: ${{ matrix.node }} 55 | 56 | - name: Cache NPM dependencies 57 | uses: actions/cache@v4 58 | with: 59 | path: ~/.npm 60 | key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} 61 | restore-keys: | 62 | ${{ runner.OS }}-npm-cache- 63 | 64 | - name: Install npm dependencies 65 | run: npm ci 66 | 67 | - name: Build 68 | run: npm run build 69 | 70 | - name: Tests 71 | run: npm test 72 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/SVD: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_SVD_MODULE_H 9 | #define EIGEN_SVD_MODULE_H 10 | 11 | #include "QR" 12 | #include "Householder" 13 | #include "Jacobi" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup SVD_Module SVD module 18 | * 19 | * 20 | * 21 | * This module provides SVD decomposition for matrices (both real and complex). 22 | * Two decomposition algorithms are provided: 23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. 24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. 25 | * These decompositions are accessible via the respective classes and following MatrixBase methods: 26 | * - MatrixBase::jacobiSvd() 27 | * - MatrixBase::bdcSvd() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/misc/RealSvd2x2.h" 35 | #include "src/SVD/UpperBidiagonalization.h" 36 | #include "src/SVD/SVDBase.h" 37 | #include "src/SVD/JacobiSVD.h" 38 | #include "src/SVD/BDCSVD.h" 39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 40 | #ifdef EIGEN_USE_MKL 41 | #include "mkl_lapacke.h" 42 | #else 43 | #include "src/misc/lapacke.h" 44 | #endif 45 | #include "src/SVD/JacobiSVD_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SVD_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 9 | #define EIGEN_PASTIXSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | #ifdef complex 21 | #undef complex 22 | #endif 23 | 24 | /** \ingroup Support_modules 25 | * \defgroup PaStiXSupport_Module PaStiXSupport module 26 | * 27 | * This module provides an interface to the PaSTiX library. 28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 29 | * It provides the two following main factorization classes: 30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | * 38 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. 39 | * The dependencies depend on how PaSTiX has been compiled. 40 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 41 | * 42 | */ 43 | 44 | #include "src/PaStiXSupport/PaStiXSupport.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 49 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H 12 | 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | enum { 18 | ShardByRow = 0, 19 | ShardByCol = 1 20 | }; 21 | 22 | 23 | // Default Blocking Strategy 24 | template 25 | class TensorContractionBlocking { 26 | public: 27 | 28 | typedef typename LhsMapper::Scalar LhsScalar; 29 | typedef typename RhsMapper::Scalar RhsScalar; 30 | 31 | EIGEN_DEVICE_FUNC TensorContractionBlocking(Index k, Index m, Index n, Index num_threads = 1) : 32 | kc_(k), mc_(m), nc_(n) 33 | { 34 | if (ShardingType == ShardByCol) { 35 | computeProductBlockingSizes(kc_, mc_, nc_, num_threads); 36 | } 37 | else { 38 | computeProductBlockingSizes(kc_, nc_, mc_, num_threads); 39 | } 40 | } 41 | 42 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index kc() const { return kc_; } 43 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index mc() const { return mc_; } 44 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Index nc() const { return nc_; } 45 | 46 | private: 47 | Index kc_; 48 | Index mc_; 49 | Index nc_; 50 | }; 51 | 52 | 53 | } // end namespace internal 54 | } // end namespace Eigen 55 | 56 | #endif // EIGEN_CXX11_TENSOR_TENSOR_CONTRACTION_BLOCKING_H 57 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/scoped_mutex_lock.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_SCOPED_MUTEX_LOCK_H 2 | #define MT_SCOPED_MUTEX_LOCK_H 3 | 4 | #include "mutex.h" 5 | 6 | namespace mt 7 | { 8 | 9 | class scoped_mutex_lock 10 | { 11 | MT_PREVENT_COPY(scoped_mutex_lock) 12 | 13 | public: 14 | 15 | typedef scoped_mutex_lock this_type; 16 | typedef void base_type; 17 | 18 | scoped_mutex_lock(mutex & m) : mtx(m) 19 | { 20 | this->mtx.lock(); 21 | } 22 | 23 | ~scoped_mutex_lock(void) 24 | { 25 | this->mtx.unlock(); 26 | } 27 | 28 | //jnoguera 14-12-2011 29 | //method added to mime QMutexLocker 30 | scoped_mutex_lock(mutex * m) : mtx( *m ) 31 | { 32 | this->mtx.lock(); 33 | } 34 | 35 | 36 | protected: 37 | 38 | mutex & mtx; 39 | }; 40 | 41 | } 42 | 43 | #endif // MT_SCOPED_MUTEX_LOCK_H 44 | 45 | 46 | 47 | 48 | 49 | /* 50 | #ifndef MT_SCOPED_MUTEX_LOCK_H 51 | #define MT_SCOPED_MUTEX_LOCK_H 52 | 53 | #include "mutex.h" 54 | 55 | namespace mt 56 | { 57 | 58 | class scoped_mutex_lock 59 | { 60 | MT_PREVENT_COPY(scoped_mutex_lock) 61 | 62 | public: 63 | 64 | typedef scoped_mutex_lock this_type; 65 | typedef void base_type; 66 | 67 | scoped_mutex_lock(mutex & m) : mtx(m) 68 | { 69 | this->mtx.lock(); 70 | } 71 | 72 | ~scoped_mutex_lock(void) 73 | { 74 | this->mtx.unlock(); 75 | } 76 | 77 | protected: 78 | 79 | mutex & mtx; 80 | }; 81 | 82 | } 83 | 84 | #endif // MT_SCOPED_MUTEX_LOCK_H 85 | 86 | */ 87 | 88 | 89 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | // Ordering interface 24 | #include "OrderingMethods" 25 | 26 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 27 | 28 | #include "src/SparseLU/SparseLU_Structs.h" 29 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 30 | #include "src/SparseLU/SparseLUImpl.h" 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseLU/SparseLU_Memory.h" 33 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 34 | #include "src/SparseLU/SparseLU_relax_snode.h" 35 | #include "src/SparseLU/SparseLU_pivotL.h" 36 | #include "src/SparseLU/SparseLU_panel_dfs.h" 37 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 38 | #include "src/SparseLU/SparseLU_panel_bmod.h" 39 | #include "src/SparseLU/SparseLU_column_dfs.h" 40 | #include "src/SparseLU/SparseLU_column_bmod.h" 41 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 42 | #include "src/SparseLU/SparseLU_pruneL.h" 43 | #include "src/SparseLU/SparseLU_Utils.h" 44 | #include "src/SparseLU/SparseLU.h" 45 | 46 | #endif // EIGEN_SPARSELU_MODULE_H 47 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/SelfCwiseBinaryOp.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SELFCWISEBINARYOP_H 11 | #define EIGEN_SELFCWISEBINARYOP_H 12 | 13 | namespace Eigen { 14 | 15 | // TODO generalize the scalar type of 'other' 16 | 17 | template 18 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 19 | { 20 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 21 | return derived(); 22 | } 23 | 24 | template 25 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 26 | { 27 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 28 | return derived(); 29 | } 30 | 31 | template 32 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 33 | { 34 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 35 | return derived(); 36 | } 37 | 38 | template 39 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 40 | { 41 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 42 | return derived(); 43 | } 44 | 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SELFCWISEBINARYOP_H 48 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | internal::evaluator thisEval(derived()); 22 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 24 | res += iter.value(); 25 | return res; 26 | } 27 | 28 | template 29 | typename internal::traits >::Scalar 30 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | if(this->isCompressed()) 34 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 35 | else 36 | return Base::sum(); 37 | } 38 | 39 | template 40 | typename internal::traits >::Scalar 41 | SparseVector<_Scalar,_Options,_Index>::sum() const 42 | { 43 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 44 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SPARSEREDUX_H 50 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/semaphore.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_SEMAPHORE_H 2 | #define MT_SEMAPHORE_H 3 | 4 | #include "base.h" 5 | 6 | #include 7 | #include 8 | 9 | namespace mt 10 | { 11 | 12 | class semaphore 13 | { 14 | MT_PREVENT_COPY(semaphore) 15 | 16 | public: 17 | 18 | typedef semaphore this_type; 19 | typedef void base_type; 20 | 21 | semaphore(void) 22 | { 23 | sem_init(&(this->s), 0, 0); 24 | } 25 | 26 | semaphore(int value) 27 | { 28 | sem_init(&(this->s), 0, value); 29 | } 30 | 31 | ~semaphore(void) 32 | { 33 | sem_destroy(&(this->s)); 34 | } 35 | 36 | void post(void) 37 | { 38 | sem_post(&(this->s)); 39 | } 40 | 41 | /* 42 | void post(int n) 43 | { 44 | sem_post_multiple(&(this->s), n); 45 | } 46 | */ 47 | 48 | void wait(void) 49 | { 50 | sem_wait(&(this->s)); 51 | } 52 | 53 | bool trywait(void) 54 | { 55 | return (sem_trywait(&(this->s)) == 0); 56 | } 57 | 58 | //methods added for conforming to the QT implementation 59 | //jnoguera 14-12-2011 60 | 61 | void release(int n=1) 62 | { 63 | if(n != 1) 64 | std::cout << "Error, mt::semaphore.release() not supported\n"; 65 | sem_post(&(this->s)); 66 | } 67 | 68 | void acquire(int n=1) 69 | { 70 | if(n != 1) 71 | std::cout << "Error, mt::semaphore.tryAcquire() not supported\n"; 72 | sem_wait(&(this->s)); 73 | } 74 | 75 | bool tryAcquire(int n=1) 76 | { 77 | if(n != 1) 78 | std::cout << "Error, mt::semaphore.tryAcquire() not supported\n"; 79 | return (sem_trywait(&(this->s)) == 0); 80 | } 81 | 82 | int available() 83 | { 84 | int value; 85 | sem_getvalue( &(this->s), &value ); 86 | return value; 87 | } 88 | 89 | private: 90 | 91 | sem_t s; 92 | }; 93 | 94 | } 95 | 96 | #endif // MT_SEMAPHORE_H 97 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /vcglib/vcg/simplex/tetrahedron/tetrahedron.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2016 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | #ifndef __VCGLIB_TETRAHEDRON 24 | #define __VCGLIB_TETRAHEDRON 25 | #define TETRA_TYPE Tetrahedron 26 | // #include 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/misc/RealSvd2x2.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Benoit Jacob 5 | // Copyright (C) 2013-2016 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | #ifndef EIGEN_REALSVD2X2_H 12 | #define EIGEN_REALSVD2X2_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 20 | JacobiRotation *j_left, 21 | JacobiRotation *j_right) 22 | { 23 | using std::sqrt; 24 | using std::abs; 25 | Matrix m; 26 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 27 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 28 | JacobiRotation rot1; 29 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 30 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 31 | 32 | if(abs(d) < (std::numeric_limits::min)()) 33 | { 34 | rot1.s() = RealScalar(0); 35 | rot1.c() = RealScalar(1); 36 | } 37 | else 38 | { 39 | // If d!=0, then t/d cannot overflow because the magnitude of the 40 | // entries forming d are not too small compared to the ones forming t. 41 | RealScalar u = t / d; 42 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 43 | rot1.s() = RealScalar(1) / tmp; 44 | rot1.c() = u / tmp; 45 | } 46 | m.applyOnTheLeft(0,1,rot1); 47 | j_right->makeJacobi(m,0,1); 48 | *j_left = rot1 * j_right->transpose(); 49 | } 50 | 51 | } // end namespace internal 52 | 53 | } // end namespace Eigen 54 | 55 | #endif // EIGEN_REALSVD2X2_H 56 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/NumericalDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_NUMERICALDIFF_MODULE 11 | #define EIGEN_NUMERICALDIFF_MODULE 12 | 13 | #include 14 | 15 | namespace Eigen { 16 | 17 | /** 18 | * \defgroup NumericalDiff_Module Numerical differentiation module 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | * 24 | * See xxxp://en.wikipedia.org/wiki/Numerical_differentiation 25 | * 26 | * Warning : this should NOT be confused with automatic differentiation, which 27 | * is a different method and has its own module in Eigen : \ref 28 | * AutoDiff_Module. 29 | * 30 | * Currently only "Forward" and "Central" schemes are implemented. Those 31 | * are basic methods, and there exist some more elaborated way of 32 | * computing such approximates. They are implemented using both 33 | * proprietary and free software, and usually requires linking to an 34 | * external library. It is very easy for you to write a functor 35 | * using such software, and the purpose is quite orthogonal to what we 36 | * want to achieve with Eigen. 37 | * 38 | * This is why we will not provide wrappers for every great numerical 39 | * differentiation software that exist, but should rather stick with those 40 | * basic ones, that still are useful for testing. 41 | * 42 | * Also, the \ref NonLinearOptimization_Module needs this in order to 43 | * provide full features compatibility with the original (c)minpack 44 | * package. 45 | * 46 | */ 47 | } 48 | 49 | //@{ 50 | 51 | #include "src/NumericalDiff/NumericalDiff.h" 52 | 53 | //@} 54 | 55 | 56 | #endif // EIGEN_NUMERICALDIFF_MODULE 57 | -------------------------------------------------------------------------------- /vcglib/.gitignore: -------------------------------------------------------------------------------- 1 | # Rules to ignore all files without extension (binaries on unix) 2 | # these rules must be above all the other rules 3 | * 4 | !/**/ 5 | !*.* 6 | 7 | # QTCreator user prefs 8 | *.user 9 | 10 | # Directories to ignore 11 | debug/ 12 | release/ 13 | *-debug/ 14 | *-release/ 15 | /docs/Doxygen/html/ 16 | 17 | # Intermediate Files 18 | *.bc 19 | 20 | # osx rubbish 21 | .DS_Store 22 | 23 | # Visual Studio Project files 24 | *.vcxproj 25 | *.vcxproj.filters 26 | *.suo 27 | *.ply 28 | wrap/nanoply/nanoply_vcg/nanoply_vcg.sln 29 | *.db 30 | wrap/nanoply/nanoply_vcg/nanoply_vcg.VC.VC.opendb 31 | wrap/nanoply/nanoply_vcg/.vs/nanoply_vcg/v15/ipch/AutoPCH/NANOPLY_VCG-1b6b1a83/MAIN-5f62d91f/MAIN.ipch 32 | *.sln 33 | 34 | ##Standard cmake gitignore## 35 | CMakeLists.txt.user 36 | CMakeCache.txt 37 | CMakeFiles 38 | CMakeScripts 39 | Testing 40 | Makefile 41 | cmake_install.cmake 42 | install_manifest.txt 43 | compile_commands.json 44 | CTestTestfile.cmake 45 | _deps 46 | 47 | ##standard Qt and C++ gitignore## 48 | # C++ objects and libs 49 | *.slo 50 | *.lo 51 | *.o 52 | *.a 53 | *.la 54 | *.lai 55 | *.so 56 | *.so.* 57 | *.dll 58 | *.dylib 59 | *.lib 60 | *.exe 61 | *.obj 62 | *.res 63 | 64 | # Qt-es 65 | object_script.*.Release 66 | object_script.*.Debug 67 | *_plugin_import.cpp 68 | /.qmake.cache 69 | /.qmake.stash 70 | .qmake.stash 71 | *.pro.user 72 | *.pro.user.* 73 | *.qbs.user 74 | *.qbs.user.* 75 | *.moc 76 | moc_*.cpp 77 | mocs_*.cpp 78 | moc_*.h 79 | qrc_*.cpp 80 | ui_*.h 81 | *.qmlc 82 | *.jsc 83 | Makefile* 84 | *build-* 85 | *.qm 86 | *.prl 87 | 88 | # Qt unit tests 89 | target_wrapper.* 90 | 91 | # QtCreator 92 | *.autosave 93 | 94 | # QtCreator Qml 95 | *.qmlproject.user 96 | *.qmlproject.user.* 97 | 98 | # QtCreator CMake 99 | CMakeLists.txt.user* 100 | 101 | # QtCreator 4.8< compilation database 102 | compile_commands.json 103 | 104 | # QtCreator local machine specific files for imported projects 105 | *creator.user* 106 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_EIGENVALUES_MODULE_H 9 | #define EIGEN_EIGENVALUES_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | #include "LU" 17 | #include "Geometry" 18 | 19 | #include "src/Core/util/DisableStupidWarnings.h" 20 | 21 | /** \defgroup Eigenvalues_Module Eigenvalues module 22 | * 23 | * 24 | * 25 | * This module mainly provides various eigenvalue solvers. 26 | * This module also provides some MatrixBase methods, including: 27 | * - MatrixBase::eigenvalues(), 28 | * - MatrixBase::operatorNorm() 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/Eigenvalues/Tridiagonalization.h" 37 | #include "src/Eigenvalues/RealSchur.h" 38 | #include "src/Eigenvalues/EigenSolver.h" 39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 41 | #include "src/Eigenvalues/HessenbergDecomposition.h" 42 | #include "src/Eigenvalues/ComplexSchur.h" 43 | #include "src/Eigenvalues/ComplexEigenSolver.h" 44 | #include "src/Eigenvalues/RealQZ.h" 45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 47 | #ifdef EIGEN_USE_LAPACKE 48 | #ifdef EIGEN_USE_MKL 49 | #include "mkl_lapacke.h" 50 | #else 51 | #include "src/misc/lapacke.h" 52 | #endif 53 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 54 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 55 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_EIGENVALUES_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains contributions from various users. 2 | They are provided "as is", without any support. Nevertheless, 3 | most of them are subject to be included in Eigen in the future. 4 | 5 | In order to use an unsupported module you have to do either: 6 | 7 | - add the path_to_eigen/unsupported directory to your include path and do: 8 | #include 9 | 10 | - or directly do: 11 | #include 12 | 13 | 14 | If you are interested in contributing to one of them, or have other stuff 15 | you would like to share, feel free to contact us: 16 | xxxp://eigen.tuxfamily.org/index.php?title=Main_Page#Mailing_list 17 | 18 | Any kind of contributions are much appreciated, even very preliminary ones. 19 | However, it: 20 | - must rely on Eigen, 21 | - must be highly related to math, 22 | - should have some general purpose in the sense that it could 23 | potentially become an offical Eigen module (or be merged into another one). 24 | 25 | In doubt feel free to contact us. For instance, if your addons is very too specific 26 | but it shows an interesting way of using Eigen, then it could be a nice demo. 27 | 28 | 29 | This directory is organized as follow: 30 | 31 | unsupported/Eigen/ModuleHeader1 32 | unsupported/Eigen/ModuleHeader2 33 | unsupported/Eigen/... 34 | unsupported/Eigen/src/Module1/SourceFile1.h 35 | unsupported/Eigen/src/Module1/SourceFile2.h 36 | unsupported/Eigen/src/Module1/... 37 | unsupported/Eigen/src/Module2/SourceFile1.h 38 | unsupported/Eigen/src/Module2/SourceFile2.h 39 | unsupported/Eigen/src/Module2/... 40 | unsupported/Eigen/src/... 41 | unsupported/doc/snippets/.cpp <- code snippets for the doc 42 | unsupported/doc/examples/.cpp <- examples for the doc 43 | unsupported/doc/TutorialModule1.dox 44 | unsupported/doc/TutorialModule2.dox 45 | unsupported/doc/... 46 | unsupported/test/.cpp <- unit test files 47 | 48 | The documentation is generated at the same time than the main Eigen documentation. 49 | The .html files are generated in: build_dir/doc/html/unsupported/ 50 | 51 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup CholmodSupport_Module CholmodSupport module 21 | * 22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 23 | * It provides the two following main factorization classes: 24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 26 | * 27 | * For the sake of completeness, this module also propose the two following classes: 28 | * - class CholmodSimplicialLLT 29 | * - class CholmodSimplicialLDLT 30 | * Note that these classes does not bring any particular advantage compared to the built-in 31 | * SimplicialLLT and SimplicialLDLT factorization classes. 32 | * 33 | * \code 34 | * #include 35 | * \endcode 36 | * 37 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 38 | * The dependencies depend on how cholmod has been compiled. 39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 40 | * 41 | */ 42 | 43 | #include "src/CholmodSupport/CholmodSupport.h" 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 48 | 49 | -------------------------------------------------------------------------------- /vcglib/vcg/complex/all_types.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2016 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | #ifndef VCG_ALL_TYPES_H 24 | #define VCG_ALL_TYPES_H 25 | 26 | namespace vcg{ 27 | 28 | struct AllTypes{ 29 | struct AVertexType {}; 30 | struct AEdgeType {}; 31 | struct AFaceType {}; 32 | struct AHEdgeType {}; 33 | struct ATetraType {}; 34 | }; 35 | 36 | 37 | } 38 | 39 | #endif // USED_TYPES_H 40 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/arch/Default/ConjHelper.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Eigen, a lightweight C++ template library 3 | // for linear algebra. 4 | // 5 | // Copyright (C) 2017 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at the mozilla.org home page 10 | 11 | #ifndef EIGEN_ARCH_CONJ_HELPER_H 12 | #define EIGEN_ARCH_CONJ_HELPER_H 13 | 14 | #define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL) \ 15 | template<> struct conj_helper { \ 16 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const \ 17 | { return padd(c, pmul(x,y)); } \ 18 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_REAL& x, const PACKET_CPLX& y) const \ 19 | { return PACKET_CPLX(Eigen::internal::pmul(x, y.v)); } \ 20 | }; \ 21 | \ 22 | template<> struct conj_helper { \ 23 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const \ 24 | { return padd(c, pmul(x,y)); } \ 25 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const \ 26 | { return PACKET_CPLX(Eigen::internal::pmul(x.v, y)); } \ 27 | }; 28 | 29 | #endif // EIGEN_ARCH_CONJ_HELPER_H 30 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/arch/SSE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_TYPE_CASTING_SSE_H 11 | #define EIGEN_TYPE_CASTING_SSE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | #ifndef EIGEN_VECTORIZE_AVX 18 | template <> 19 | struct type_casting_traits { 20 | enum { 21 | VectorizedCast = 1, 22 | SrcCoeffRatio = 1, 23 | TgtCoeffRatio = 1 24 | }; 25 | }; 26 | 27 | template <> 28 | struct type_casting_traits { 29 | enum { 30 | VectorizedCast = 1, 31 | SrcCoeffRatio = 1, 32 | TgtCoeffRatio = 1 33 | }; 34 | }; 35 | 36 | template <> 37 | struct type_casting_traits { 38 | enum { 39 | VectorizedCast = 1, 40 | SrcCoeffRatio = 2, 41 | TgtCoeffRatio = 1 42 | }; 43 | }; 44 | 45 | template <> 46 | struct type_casting_traits { 47 | enum { 48 | VectorizedCast = 1, 49 | SrcCoeffRatio = 1, 50 | TgtCoeffRatio = 2 51 | }; 52 | }; 53 | #endif 54 | 55 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 56 | return _mm_cvttps_epi32(a); 57 | } 58 | 59 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 60 | return _mm_cvtepi32_ps(a); 61 | } 62 | 63 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet2d& a, const Packet2d& b) { 64 | return _mm_shuffle_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b), (1 << 2) | (1 << 6)); 65 | } 66 | 67 | template<> EIGEN_STRONG_INLINE Packet2d pcast(const Packet4f& a) { 68 | // Simply discard the second half of the input 69 | return _mm_cvtps_pd(a); 70 | } 71 | 72 | 73 | } // end namespace internal 74 | 75 | } // end namespace Eigen 76 | 77 | #endif // EIGEN_TYPE_CASTING_SSE_H 78 | -------------------------------------------------------------------------------- /vcglib/wrap/io_trimesh/additionalinfo.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * MeshLab o o * 3 | * An extendible mesh processor o o * 4 | * _ O _ * 5 | * Copyright(C) 2005, 2009 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | 24 | #ifndef __VCGLIB_ADDITIONAL_INFO 25 | #define __VCGLIB_ADDITIONAL_INFO 26 | 27 | class AdditionalInfo 28 | { 29 | protected: 30 | AdditionalInfo() 31 | { 32 | } 33 | public: 34 | unsigned int numvert; 35 | unsigned int numface; 36 | int mask; 37 | 38 | virtual ~AdditionalInfo() 39 | { 40 | } 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/NonLinearOptimization/chkder.h: -------------------------------------------------------------------------------- 1 | #define chkder_log10e 0.43429448190325182765 2 | #define chkder_factor 100. 3 | 4 | namespace Eigen { 5 | 6 | namespace internal { 7 | 8 | template 9 | void chkder( 10 | const Matrix< Scalar, Dynamic, 1 > &x, 11 | const Matrix< Scalar, Dynamic, 1 > &fvec, 12 | const Matrix< Scalar, Dynamic, Dynamic > &fjac, 13 | Matrix< Scalar, Dynamic, 1 > &xp, 14 | const Matrix< Scalar, Dynamic, 1 > &fvecp, 15 | int mode, 16 | Matrix< Scalar, Dynamic, 1 > &err 17 | ) 18 | { 19 | using std::sqrt; 20 | using std::abs; 21 | using std::log; 22 | 23 | typedef DenseIndex Index; 24 | 25 | const Scalar eps = sqrt(NumTraits::epsilon()); 26 | const Scalar epsf = chkder_factor * NumTraits::epsilon(); 27 | const Scalar epslog = chkder_log10e * log(eps); 28 | Scalar temp; 29 | 30 | const Index m = fvec.size(), n = x.size(); 31 | 32 | if (mode != 2) { 33 | /* mode = 1. */ 34 | xp.resize(n); 35 | for (Index j = 0; j < n; ++j) { 36 | temp = eps * abs(x[j]); 37 | if (temp == 0.) 38 | temp = eps; 39 | xp[j] = x[j] + temp; 40 | } 41 | } 42 | else { 43 | /* mode = 2. */ 44 | err.setZero(m); 45 | for (Index j = 0; j < n; ++j) { 46 | temp = abs(x[j]); 47 | if (temp == 0.) 48 | temp = 1.; 49 | err += temp * fjac.col(j); 50 | } 51 | for (Index i = 0; i < m; ++i) { 52 | temp = 1.; 53 | if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i])) 54 | temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i])); 55 | err[i] = 1.; 56 | if (temp > NumTraits::epsilon() && temp < eps) 57 | err[i] = (chkder_log10e * log(temp) - epslog) / epslog; 58 | if (temp >= eps) 59 | err[i] = 0.; 60 | } 61 | } 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | -------------------------------------------------------------------------------- /vcglib/wrap/io_trimesh/how_to_write_an_io_filter.txt: -------------------------------------------------------------------------------- 1 | ---- How to write an IMPORT filter ---- 2 | 3 | For writing an import filter for a XXX 3D mesh file type you must: 4 | 5 | create a class templated on the mesh type and named: 6 | 7 | vcg::tri::io::ImporterXXX 8 | 9 | The class must have at least the following methods 10 | 11 | static int Open(MESH_TYPE &mesh, const char *filename, CallBackPos *cb=0) 12 | static int Open(MESH_TYPE &mesh, const char *filename, int & loadmask, CallBackPos *cb =0) 13 | static const char *ErrorMsg(int error) 14 | 15 | where loadmask is an writeonly bitmask that, after the successful 16 | loading, will contain what kind of data have been found inside the 17 | loaded file (per vert color, tex coords etc). 18 | 19 | Please note that you can NOT use loadmask to selectively loading attribute from files. 20 | Note also that the returned mask should always match with the capability mask of your mesh, 21 | so if your mesh has no texture coords, that bit will be always zero even if the original file 22 | has texture coords. 23 | 24 | To know the original content of a given file use the LoadMask function. 25 | 26 | The last function is used to translate the numerical error code in a more meaningful message. 27 | 28 | The callback function should be used to back communicate the loading status in a 1..100 range. 29 | It should be called approximatively no more than some hundreds of time, 30 | so do not call it for every loaded face. Typical callback line 31 | in a j-based loop during vertex loading: 32 | 33 | if(cb && (j%1000)==0) cb(j*50/vertex_number,"Vertex Loading"); 34 | 35 | 36 | ---- How to write an EXPORT filter ---- 37 | 38 | create a class templated on the mesh type and named: 39 | 40 | vcg::tri::io::ExporterDOH 41 | 42 | The class must have at least the following methods 43 | 44 | static int Save(MESH_TYPE &mesh, const char *filename, CallBackPos *cb=0) 45 | static int Save(MESH_TYPE &mesh, const char *filename, int & savemask, CallBackPos *cb =0) 46 | static const char *ErrorMsg(int error) 47 | static int GetExportMaskCapability() 48 | 49 | function return 0 in case of success and a code in any other case... 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /vcglib/img/img_base.h: -------------------------------------------------------------------------------- 1 | #ifndef IMG_BASE_H_ 2 | #define IMG_BASE_H_ 3 | /*! \file img_base.h 4 | \brief basic definitions for the img module 5 | 6 | This header contains the basic module definitions. 7 | */ 8 | 9 | /// base of the static assertion mechanism 10 | template struct NON_TRUE_EXPR_CompileTimeError; 11 | /// partial instantiation for the static assertion mechanism 12 | template<> struct NON_TRUE_EXPR_CompileTimeError {}; 13 | 14 | /// the static assertion mechanism 15 | #define STATIC_ASSERT(exp) (NON_TRUE_EXPR_CompileTimeError< (exp) >()) 16 | 17 | /// base of the static typecheck mechanism 18 | template struct NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError; 19 | /// partial instantiation for the static typecheck mechanism 20 | template<> struct NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError {}; 21 | /// partial instantiation for the static typecheck mechanism 22 | template<> struct NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError {}; 23 | 24 | /// the static typecheck mechanism 25 | #define STATIC_FLOAT_OR_DOUBLE_TYPECHECK(type) (NON_FLOAT_OR_DOUBLE_TYPE_CompileTimeError< type >()) 26 | 27 | /// define NULL pointer value 28 | #ifndef NULL 29 | #ifdef __cplusplus 30 | #define NULL 0 31 | #else 32 | #define NULL ((void *)0) 33 | #endif 34 | #endif 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | /*! \brief the img module namespace 42 | 43 | this is the main image module namespace. 44 | */ 45 | namespace img { 46 | 47 | /*! \brief the basic exception class 48 | 49 | this is the basic image exception class, it simply carries an error string to the console. 50 | */ 51 | class ImageException: public std::exception 52 | { 53 | public: 54 | /// the error string 55 | const char *message; 56 | /// default constructor 57 | ImageException():exception(),message("no message"){} 58 | /*! \brief message carrying constructor 59 | 60 | \param arg_message the error string 61 | */ 62 | ImageException(const char *arg_message):exception(),message(arg_message){} 63 | /// the destructor 64 | virtual ~ImageException () throw (){} 65 | }; 66 | 67 | } //end namespace img 68 | 69 | #endif /*IMG_BASE_H_*/ 70 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | name: Meshprop Release Workflow 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | release-ubuntu: 10 | runs-on: ubuntu-latest 11 | strategy: 12 | matrix: 13 | node: ["18", "20", "22", "24"] 14 | 15 | steps: 16 | - name: Checkout 17 | uses: actions/checkout@v4 18 | 19 | - name: Use Node.js 20 | uses: actions/setup-node@v4 21 | with: 22 | node-version: ${{ matrix.node }} 23 | 24 | - name: Cache NPM dependencies 25 | uses: actions/cache@v4 26 | with: 27 | path: ~/.npm 28 | key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} 29 | restore-keys: | 30 | ${{ runner.OS }}-npm-cache- 31 | 32 | - name: Install npm dependencies 33 | run: npm ci 34 | 35 | - name: Build 36 | run: npm run build 37 | 38 | - name: Tests 39 | run: npm test 40 | 41 | - name: Release 42 | run: npm run release 43 | env: 44 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 45 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 46 | 47 | release-macos: 48 | runs-on: macos-latest 49 | strategy: 50 | matrix: 51 | node: ["18", "20", "22", "24"] 52 | 53 | steps: 54 | - name: Checkout 55 | uses: actions/checkout@v4 56 | 57 | - name: Use Node.js 58 | uses: actions/setup-node@v4 59 | with: 60 | node-version: ${{ matrix.node }} 61 | 62 | - name: Cache NPM dependencies 63 | uses: actions/cache@v4 64 | with: 65 | path: ~/.npm 66 | key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }} 67 | restore-keys: | 68 | ${{ runner.OS }}-npm-cache- 69 | 70 | - name: Install npm dependencies 71 | run: npm ci 72 | 73 | - name: Build 74 | run: npm run build 75 | 76 | - name: Tests 77 | run: npm test 78 | 79 | - name: Release 80 | run: npm run release 81 | env: 82 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 83 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 84 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/NonLinearOptimization/covar.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void covar( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const VectorXi &ipvt, 9 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 10 | { 11 | using std::abs; 12 | typedef DenseIndex Index; 13 | 14 | /* Local variables */ 15 | Index i, j, k, l, ii, jj; 16 | bool sing; 17 | Scalar temp; 18 | 19 | /* Function Body */ 20 | const Index n = r.cols(); 21 | const Scalar tolr = tol * abs(r(0,0)); 22 | Matrix< Scalar, Dynamic, 1 > wa(n); 23 | eigen_assert(ipvt.size()==n); 24 | 25 | /* form the inverse of r in the full upper triangle of r. */ 26 | l = -1; 27 | for (k = 0; k < n; ++k) 28 | if (abs(r(k,k)) > tolr) { 29 | r(k,k) = 1. / r(k,k); 30 | for (j = 0; j <= k-1; ++j) { 31 | temp = r(k,k) * r(j,k); 32 | r(j,k) = 0.; 33 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 34 | } 35 | l = k; 36 | } 37 | 38 | /* form the full upper triangle of the inverse of (r transpose)*r */ 39 | /* in the full upper triangle of r. */ 40 | for (k = 0; k <= l; ++k) { 41 | for (j = 0; j <= k-1; ++j) 42 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 43 | r.col(k).head(k+1) *= r(k,k); 44 | } 45 | 46 | /* form the full lower triangle of the covariance matrix */ 47 | /* in the strict lower triangle of r and in wa. */ 48 | for (j = 0; j < n; ++j) { 49 | jj = ipvt[j]; 50 | sing = j > l; 51 | for (i = 0; i <= j; ++i) { 52 | if (sing) 53 | r(i,j) = 0.; 54 | ii = ipvt[i]; 55 | if (ii > jj) 56 | r(ii,jj) = r(i,j); 57 | if (ii < jj) 58 | r(jj,ii) = r(i,j); 59 | } 60 | wa[jj] = r(j,j); 61 | } 62 | 63 | /* symmetrize the covariance matrix in r. */ 64 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 65 | r.diagonal() = wa; 66 | } 67 | 68 | } // end namespace internal 69 | 70 | } // end namespace Eigen 71 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** 17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 18 | * 19 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 20 | * Those solvers are accessible via the following classes: 21 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 22 | * - LeastSquaresConjugateGradient for rectangular least-square problems, 23 | * - BiCGSTAB for general square matrices. 24 | * 25 | * These iterative solvers are associated with some preconditioners: 26 | * - IdentityPreconditioner - not really useful 27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. 28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding 29 | * 30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 49 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_GEOMETRY_MODULE_H 9 | #define EIGEN_GEOMETRY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "SVD" 14 | #include "LU" 15 | #include 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \defgroup Geometry_Module Geometry module 20 | * 21 | * This module provides support for: 22 | * - fixed-size homogeneous transformations 23 | * - translation, scaling, 2D and 3D rotations 24 | * - \link Quaternion quaternions \endlink 25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) 26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) 27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink 28 | * - \link AlignedBox axis aligned bounding boxes \endlink 29 | * - \link umeyama least-square transformation fitting \endlink 30 | * 31 | * \code 32 | * #include 33 | * \endcode 34 | */ 35 | 36 | #include "src/Geometry/OrthoMethods.h" 37 | #include "src/Geometry/EulerAngles.h" 38 | 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | // Use the SSE optimized version whenever possible. At the moment the 53 | // SSE version doesn't compile when AVX is enabled 54 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 55 | #include "src/Geometry/arch/Geometry_SSE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_GEOMETRY_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | 63 | -------------------------------------------------------------------------------- /vcglib/wrap/gl/gl_type_name.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2016 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | 24 | #ifndef __VCG_GL_TYPE_NAME 25 | #define __VCG_GL_TYPE_NAME 26 | 27 | namespace vcg 28 | { 29 | template 30 | class GL_TYPE_NM 31 | {public: 32 | static GLenum SCALAR() { assert(0); return 0;} 33 | }; 34 | template <> class GL_TYPE_NM 35 | { public: 36 | typedef GLfloat ScalarType; 37 | static GLenum SCALAR() { return GL_FLOAT; } 38 | }; 39 | template <> class GL_TYPE_NM 40 | {public: 41 | typedef GLdouble ScalarType; 42 | static GLenum SCALAR() { return GL_DOUBLE; } 43 | }; 44 | } 45 | 46 | #endif -------------------------------------------------------------------------------- /vcglib/README.md: -------------------------------------------------------------------------------- 1 | The **_Visualization and Computer Graphics Library_** (VCGlib for short) is an open source, portable, and templated library written in C++, with no external dependencies, for manipulation, processing, cleaning, and simplifying triangle meshes. 2 | 3 | ![BuildExamplesLinux](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesLinux/badge.svg) 4 | ![BuildExamplesMacOS](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesMacOS/badge.svg) 5 | ![BuildExamplesWindows](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesWindows/badge.svg) 6 | 7 | The library, composed by more than 100k lines of code, is released under the GPL license, and it is the base of most of the software tools of the [Visual Computing Lab](http://vcg.isti.cnr.it) of the Italian National Research Council Institute - ISTI, like [MeshLab](http://www.meshlab.net/), [Metro](http://vcg.isti.cnr.it/vcglib/metro.html) and many others. 8 | 9 | The VCG library is tailored to mostly manage triangular meshes: The library is fairly large and offers many state-of-the-art capabilities for processing meshes, such as: 10 | 11 | - high quality quadric-error edge-collapse based simplfication 12 | - efficient spatial query structures (uniform grids, hashed grids, kdtree, etc) 13 | - advanced smoothing and fairing algorithms 14 | - computation of curvature 15 | - optimization of texture coordinates 16 | - Hausdorff distance computation 17 | - geodesic paths 18 | - mesh repairing capabilities 19 | - isosurface extraction and advancing front meshing algorithms 20 | - Poisson Disk sampling and other tools to sample point distributions over meshes 21 | - subdivision surfaces 22 | 23 | ## Notable Applications 24 | 25 | A number of applications have been developed using the VCGlib: 26 | 27 | - MeshLab: the renowed open source mesh processing software 28 | - Metro, the tool for measuring differences between meshes 29 | - The first high quality out-of-core mesh simplifier that was used by the Stanford Digital Michelangelo project to process their huge 3D scanned models. 30 | 31 | ## Contacts 32 | 33 | For any info about licensing (portions of) the library please contact us: 34 | Paolo Cignoni (p.cignoni@isti.cnr.it) 35 | Visual Computing Lab of the Italian National Research Council - ISTI 36 | 37 | In case of bugs please report them [here](https://github.com/cnr-isti-vclab/vcglib/issues). 38 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | StorageIndex nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt: -------------------------------------------------------------------------------- 1 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 2 | 3 | Redistribution and use in source and binary forms, with or 4 | without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | 3. The end-user documentation included with the 17 | redistribution, if any, must include the following 18 | acknowledgment: 19 | 20 | "This product includes software developed by the 21 | University of Chicago, as Operator of Argonne National 22 | Laboratory. 23 | 24 | Alternately, this acknowledgment may appear in the software 25 | itself, if and wherever such third-party acknowledgments 26 | normally appear. 27 | 28 | 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" 29 | WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE 30 | UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 31 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES 33 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE 34 | OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY 35 | OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR 36 | USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF 37 | THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) 38 | DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 39 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL 40 | BE CORRECTED. 41 | 42 | 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT 43 | HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 44 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, 45 | INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF 46 | ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF 47 | PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER 48 | SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT 49 | (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, 50 | EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE 51 | POSSIBILITY OF SUCH LOSS OR DAMAGES. 52 | 53 | -------------------------------------------------------------------------------- /vcglib/vcg/simplex/tetrahedron/topology.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2016 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | 24 | #ifndef _VCG_TETRA_TOPOLOGY 25 | #define _VCG_TETRA_TOPOLOGY 26 | 27 | #include 28 | 29 | namespace vcg { 30 | namespace tetrahedron { 31 | /** \addtogroup tetrahedron */ 32 | /*@{*/ 33 | 34 | /** Return a boolean that indicate if the j-th face of the tetra is a border. 35 | @param j Index of the face 36 | @return true if j is an face of border, false otherwise 37 | */ 38 | template 39 | inline bool IsTTBorder(TetraType const & t, const int j ) 40 | { 41 | if(TetraType::HasTTAdjacency()) 42 | return t.cTTp(j)==&t; 43 | assert(0); 44 | return true; 45 | } 46 | 47 | } 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /lib/meshprop.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | class MyEdge; 11 | class MyFace; 12 | class MyVertex; 13 | struct MyUsedTypes : public vcg::UsedTypes::AsVertexType, 14 | vcg::Use ::AsEdgeType, 15 | vcg::Use ::AsFaceType>{}; 16 | 17 | class MyVertex : public vcg::Vertex{}; 18 | class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::Normal3f, vcg::face::VertexRef, vcg::face::BitFlags > {}; 19 | class MyEdge : public vcg::Edge{}; 20 | class MyMesh : public vcg::tri::TriMesh< std::vector, std::vector , std::vector > {}; 21 | 22 | void Parse(const Napi::CallbackInfo& info) { 23 | Napi::Env env = info.Env(); 24 | Napi::HandleScope scope(env); 25 | Napi::Function cb = info[1].As(); 26 | 27 | if (info.Length() < 2) { 28 | Napi::TypeError::New(env, "Wrong number of arguments").ThrowAsJavaScriptException(); 29 | return; 30 | } 31 | 32 | MyMesh mesh; 33 | 34 | Napi::String path = info[0].As(); 35 | 36 | if (vcg::tri::io::Importer::Open(mesh, path.Utf8Value().c_str()) != 0) { 37 | Napi::Error err = Napi::Error::New(env, "Can't import mesh"); 38 | cb.Call(env.Global(), { err.Value(), env.Null() }); 39 | return; 40 | } 41 | 42 | vcg::tri::Inertia Ib(mesh); 43 | 44 | Napi::Object obj = Napi::Object::New(env); 45 | 46 | obj.Set("volume", Ib.Mass()); 47 | obj.Set("area", vcg::tri::Stat::ComputeMeshArea(mesh)); 48 | 49 | vcg::tri::UpdateBounding::Box(mesh); 50 | 51 | Napi::Object bbox = Napi::Object::New(env); 52 | bbox.Set("x", mesh.bbox.DimX()); 53 | bbox.Set("y", mesh.bbox.DimY()); 54 | bbox.Set("z", mesh.bbox.DimZ()); 55 | 56 | obj.Set("bbox", bbox); 57 | 58 | cb.Call(env.Global(), { env.Null(), obj }); 59 | return; 60 | } 61 | 62 | Napi::Object Init(Napi::Env env, Napi::Object exports) { 63 | exports.Set("parse", Napi::Function::New(env, Parse)); 64 | return exports; 65 | } 66 | 67 | NODE_API_MODULE(meshprop, Init); 68 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_SPECIALFUNCTIONS_HALF_H 9 | #define EIGEN_SPECIALFUNCTIONS_HALF_H 10 | 11 | namespace Eigen { 12 | namespace numext { 13 | 14 | #if EIGEN_HAS_C99_MATH 15 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) { 16 | return Eigen::half(Eigen::numext::lgamma(static_cast(a))); 17 | } 18 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half digamma(const Eigen::half& a) { 19 | return Eigen::half(Eigen::numext::digamma(static_cast(a))); 20 | } 21 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half zeta(const Eigen::half& x, const Eigen::half& q) { 22 | return Eigen::half(Eigen::numext::zeta(static_cast(x), static_cast(q))); 23 | } 24 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half polygamma(const Eigen::half& n, const Eigen::half& x) { 25 | return Eigen::half(Eigen::numext::polygamma(static_cast(n), static_cast(x))); 26 | } 27 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erf(const Eigen::half& a) { 28 | return Eigen::half(Eigen::numext::erf(static_cast(a))); 29 | } 30 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erfc(const Eigen::half& a) { 31 | return Eigen::half(Eigen::numext::erfc(static_cast(a))); 32 | } 33 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma(const Eigen::half& a, const Eigen::half& x) { 34 | return Eigen::half(Eigen::numext::igamma(static_cast(a), static_cast(x))); 35 | } 36 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igammac(const Eigen::half& a, const Eigen::half& x) { 37 | return Eigen::half(Eigen::numext::igammac(static_cast(a), static_cast(x))); 38 | } 39 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half betainc(const Eigen::half& a, const Eigen::half& b, const Eigen::half& x) { 40 | return Eigen::half(Eigen::numext::betainc(static_cast(a), static_cast(b), static_cast(x))); 41 | } 42 | #endif 43 | 44 | } // end namespace numext 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SPECIALFUNCTIONS_HALF_H 48 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/SparseCore/MappedSparseMatrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_MAPPED_SPARSEMATRIX_H 11 | #define EIGEN_MAPPED_SPARSEMATRIX_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated Use Map > 16 | * \class MappedSparseMatrix 17 | * 18 | * \brief Sparse matrix 19 | * 20 | * \param _Scalar the scalar type, i.e. the type of the coefficients 21 | * 22 | * See xxxp://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. 23 | * 24 | */ 25 | namespace internal { 26 | template 27 | struct traits > : traits > 28 | {}; 29 | } // end namespace internal 30 | 31 | template 32 | class MappedSparseMatrix 33 | : public Map > 34 | { 35 | typedef Map > Base; 36 | 37 | public: 38 | 39 | typedef typename Base::StorageIndex StorageIndex; 40 | typedef typename Base::Scalar Scalar; 41 | 42 | inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) 43 | : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) 44 | {} 45 | 46 | /** Empty destructor */ 47 | inline ~MappedSparseMatrix() {} 48 | }; 49 | 50 | namespace internal { 51 | 52 | template 53 | struct evaluator > 54 | : evaluator > > 55 | { 56 | typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType; 57 | typedef evaluator > Base; 58 | 59 | evaluator() : Base() {} 60 | explicit evaluator(const XprType &mat) : Base(mat) {} 61 | }; 62 | 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_MAPPED_SPARSEMATRIX_H 68 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 9 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #ifdef EMPTY 16 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 17 | #endif 18 | 19 | typedef int int_t; 20 | #include 21 | #include 22 | #include 23 | 24 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 25 | // so we remove it in favor of a SUPERLU_EMPTY token. 26 | // If EMPTY was already defined then we don't undef it. 27 | 28 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 29 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 30 | #elif defined(EMPTY) 31 | # undef EMPTY 32 | #endif 33 | 34 | #define SUPERLU_EMPTY (-1) 35 | 36 | namespace Eigen { struct SluMatrix; } 37 | 38 | /** \ingroup Support_modules 39 | * \defgroup SuperLUSupport_Module SuperLUSupport module 40 | * 41 | * This module provides an interface to the SuperLU library. 42 | * It provides the following factorization class: 43 | * - class SuperLU: a supernodal sequential LU factorization. 44 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 45 | * 46 | * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. 47 | * 48 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 49 | * 50 | * \code 51 | * #include 52 | * \endcode 53 | * 54 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 55 | * The dependencies depend on how superlu has been compiled. 56 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 57 | * 58 | */ 59 | 60 | #include "src/SuperLUSupport/SuperLUSupport.h" 61 | 62 | #include "src/Core/util/ReenableStupidWarnings.h" 63 | 64 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 65 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_SPARSECORE_MODULE_H 9 | #define EIGEN_SPARSECORE_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /** 22 | * \defgroup SparseCore_Module SparseCore module 23 | * 24 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 25 | * and operations. 26 | * 27 | * See the \ref TutorialSparse "Sparse tutorial" 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | * 33 | * This module depends on: Core. 34 | */ 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/SparseAssign.h" 39 | #include "src/SparseCore/CompressedStorage.h" 40 | #include "src/SparseCore/AmbiVector.h" 41 | #include "src/SparseCore/SparseCompressedBase.h" 42 | #include "src/SparseCore/SparseMatrix.h" 43 | #include "src/SparseCore/SparseMap.h" 44 | #include "src/SparseCore/MappedSparseMatrix.h" 45 | #include "src/SparseCore/SparseVector.h" 46 | #include "src/SparseCore/SparseRef.h" 47 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 48 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 49 | #include "src/SparseCore/SparseTranspose.h" 50 | #include "src/SparseCore/SparseBlock.h" 51 | #include "src/SparseCore/SparseDot.h" 52 | #include "src/SparseCore/SparseRedux.h" 53 | #include "src/SparseCore/SparseView.h" 54 | #include "src/SparseCore/SparseDiagonalProduct.h" 55 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 56 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 57 | #include "src/SparseCore/SparseProduct.h" 58 | #include "src/SparseCore/SparseDenseProduct.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/SparseTriangularView.h" 61 | #include "src/SparseCore/TriangularSolver.h" 62 | #include "src/SparseCore/SparsePermutation.h" 63 | #include "src/SparseCore/SparseFuzzy.h" 64 | #include "src/SparseCore/SparseSolverBase.h" 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSECORE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | DenseIndex fdjac1( 7 | const FunctorType &Functor, 8 | Matrix< Scalar, Dynamic, 1 > &x, 9 | Matrix< Scalar, Dynamic, 1 > &fvec, 10 | Matrix< Scalar, Dynamic, Dynamic > &fjac, 11 | DenseIndex ml, DenseIndex mu, 12 | Scalar epsfcn) 13 | { 14 | using std::sqrt; 15 | using std::abs; 16 | 17 | typedef DenseIndex Index; 18 | 19 | /* Local variables */ 20 | Scalar h; 21 | Index j, k; 22 | Scalar eps, temp; 23 | Index msum; 24 | int iflag; 25 | Index start, length; 26 | 27 | /* Function Body */ 28 | const Scalar epsmch = NumTraits::epsilon(); 29 | const Index n = x.size(); 30 | eigen_assert(fvec.size()==n); 31 | Matrix< Scalar, Dynamic, 1 > wa1(n); 32 | Matrix< Scalar, Dynamic, 1 > wa2(n); 33 | 34 | eps = sqrt((std::max)(epsfcn,epsmch)); 35 | msum = ml + mu + 1; 36 | if (msum >= n) { 37 | /* computation of dense approximate jacobian. */ 38 | for (j = 0; j < n; ++j) { 39 | temp = x[j]; 40 | h = eps * abs(temp); 41 | if (h == 0.) 42 | h = eps; 43 | x[j] = temp + h; 44 | iflag = Functor(x, wa1); 45 | if (iflag < 0) 46 | return iflag; 47 | x[j] = temp; 48 | fjac.col(j) = (wa1-fvec)/h; 49 | } 50 | 51 | }else { 52 | /* computation of banded approximate jacobian. */ 53 | for (k = 0; k < msum; ++k) { 54 | for (j = k; (msum<0) ? (j>n): (jn): (j(0,j-mu); 69 | length = (std::min)(n-1, j+ml) - start + 1; 70 | fjac.col(j).segment(start, length) = ( wa1.segment(start, length)-fvec.segment(start, length))/h; 71 | } 72 | } 73 | } 74 | return 0; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | -------------------------------------------------------------------------------- /vcglib/wrap/gcache/provider.h: -------------------------------------------------------------------------------- 1 | #ifndef GCACHE_PROVIDER_H 2 | #define GCACHE_PROVIDER_H 3 | 4 | #include 5 | #include "dheap.h" 6 | #include "door.h" 7 | 8 | #include "token.h" 9 | 10 | /* this cache system enforce the rule that the items in a cache are always in all the cache below */ 11 | /* two mechanism to remove tokens from the cache: 12 | 1) set token count to something low 13 | 2) set maximum number of tokens in the provider 14 | */ 15 | 16 | /** Base class for Cache and last cache in the GCache system. 17 | You should never interact with this class. 18 | */ 19 | 20 | namespace vcg { 21 | 22 | template 23 | class Provider: public mt::thread { 24 | public: 25 | ///holds the resources in this cache but not in the cache above 26 | PtrDHeap heap; 27 | ///tokens above this number will be scheduled for deletion 28 | int max_tokens; 29 | ///signals we need to rebuild heap. 30 | bool heap_dirty; 31 | ///lock this before manipulating heap. 32 | mt::mutex heap_lock; 33 | ///signals (to next cache!) priorities have changed or something is available 34 | QDoor check_queue; 35 | 36 | Provider(): max_tokens(-1), heap_dirty(false) {} 37 | virtual ~Provider() {} 38 | 39 | /// [should be protected, do not use] called in controller thread! 40 | void pushPriorities() { 41 | mt::mutexlocker locker(&heap_lock); 42 | for(int i = 0; i < heap.size(); i++) 43 | heap[i].pushPriority(); 44 | 45 | heap_dirty = true; 46 | check_queue.open(); 47 | } 48 | /// assumes heap lock is locked, runs in cache thread [should be protected, do not use] 49 | void rebuild() { 50 | if(!this->heap_dirty) return; 51 | 52 | this->heap.rebuild(); 53 | this->heap_dirty = false; 54 | 55 | //remove OUTSIDE tokens from bottom of heap 56 | if(max_tokens != -1) { 57 | while(this->heap.size() > max_tokens) { 58 | Token &t = this->heap.min(); 59 | t.count = Token::OUTSIDE; 60 | this->heap.popMin(); 61 | } 62 | } 63 | } 64 | 65 | ///ensure no locked item are to be removed [should be protected, do not use] 66 | template void flush(FUNCTOR functor) { 67 | int count = 0; 68 | mt::mutexlocker locker(&(this->heap_lock)); 69 | for(int k = 0; k < this->heap.size(); k++) { 70 | Token *token = &this->heap[k]; 71 | if(functor(token)) { //drop it 72 | token->count = Token::OUTSIDE; 73 | } else 74 | this->heap.at(count++) = token; 75 | } 76 | this->heap.resize(count); 77 | this->heap_dirty = true; 78 | } 79 | }; 80 | 81 | } //namespace 82 | #endif 83 | -------------------------------------------------------------------------------- /vcglib/wrap/gl/glu_tessellator_cap.h: -------------------------------------------------------------------------------- 1 | #ifndef GLU_TESSELLATOR_CAP_H 2 | #define GLU_TESSELLATOR_CAP_H 3 | #include "glu_tesselator.h" 4 | #include 5 | #include 6 | #include 7 | 8 | namespace vcg { 9 | namespace tri { 10 | 11 | 12 | // This function take a mesh with one or more boundary stored as edges, and fill another mesh with a triangulation of that boundaries. 13 | // it assumes that boundary are planar and exploits glutessellator for the triangulaiton 14 | template 15 | void CapEdgeMesh(MeshType &em, MeshType &cm, bool revertFlag=false) 16 | { 17 | typedef typename MeshType::EdgeType EdgeType; 18 | typedef typename MeshType::CoordType CoordType; 19 | std::vector< std::vector > outlines; 20 | std::vector outline; 21 | UpdateFlags::EdgeClearV(em); 22 | UpdateTopology::EdgeEdge(em); 23 | int nv=0; 24 | for(size_t i=0;i startE(&em.edge[i],0); 29 | edge::Pos curE=startE; 30 | do 31 | { 32 | curE.E()->SetV(); 33 | outline.push_back(curE.V()->P()); 34 | curE.NextE(); 35 | nv++; 36 | } 37 | while(curE != startE); 38 | if(revertFlag) std::reverse(outline.begin(),outline.end()); 39 | outlines.push_back(outline); 40 | outline.clear(); 41 | } 42 | } 43 | if (nv<2) return; 44 | // printf("Found %i outlines for a total of %i vertices",outlines.size(),nv); 45 | 46 | typename MeshType::VertexIterator vi=vcg::tri::Allocator::AddVertices(cm,nv); 47 | for (size_t i=0;iP()=outlines[i][j]; 51 | } 52 | 53 | std::vector indices; 54 | glu_tesselator::tesselate(outlines, indices); 55 | std::vector points; 56 | glu_tesselator::unroll(outlines, points); 57 | //typename MeshType::FaceIterator fi=tri::Allocator::AddFaces(cm,nv-2); 58 | typename MeshType::FaceIterator fi=tri::Allocator::AddFaces(cm,indices.size()/3); 59 | for (size_t i=0; iV(0)=&cm.vert[ indices[i+0] ]; 62 | (*&fi)->V(1)=&cm.vert[ indices[i+1] ]; 63 | (*&fi)->V(2)=&cm.vert[ indices[i+2] ]; 64 | } 65 | Clean::RemoveDuplicateVertex(cm); 66 | UpdateBounding::Box(cm); 67 | } 68 | 69 | } // end namespace tri 70 | } // end namespace vcg 71 | 72 | #endif // GLU_TESSELLATOR_CAP_H 73 | -------------------------------------------------------------------------------- /vcglib/wrap/system/multithreading/atomic_int_generic.h: -------------------------------------------------------------------------------- 1 | #ifndef _ATOMIC_INT_GENERIC_H 2 | 3 | #define _ATOMIC_INT_GENERIC_H 4 | 5 | #include "mt.h" 6 | 7 | namespace mt{ 8 | 9 | class atomicInt 10 | { 11 | public: 12 | atomicInt() 13 | { 14 | _q_value = 0; 15 | } 16 | 17 | atomicInt( int value ) 18 | { 19 | _q_value = value; 20 | } 21 | 22 | // atomic API 23 | 24 | /** 25 | Reads the current _q_value of this QAtomicInt and then adds valueToAdd 26 | to the current _q_value, returning the original _q_value. 27 | */ 28 | inline int fetchAndAddAcquire( int valueToAdd ) 29 | { 30 | mutexlocker lock(&m); 31 | int originalValue = _q_value; 32 | _q_value += valueToAdd; 33 | return originalValue; 34 | } 35 | 36 | /** 37 | Atomically increments the _q_value of this atomicInt. 38 | Returns true if the new _q_value is non-zero, false otherwise.*/ 39 | inline bool ref() 40 | { 41 | mutexlocker lock(&m); 42 | return ++_q_value != 0; 43 | } 44 | 45 | /* 46 | Atomically decrements the _q_value of this QAtomicInt. 47 | Returns true if the new _q_value is non-zero, false otherwise.*/ 48 | inline bool deref() 49 | { 50 | mutexlocker lock(&m); 51 | return --_q_value != 0; 52 | } 53 | 54 | /* 55 | If the current _q_value of this QAtomicInt is the expectedValue, 56 | the test-and-set functions assign the newValue to this QAtomicInt 57 | and return true. If the values are not the same, this function 58 | does nothing and returns false. 59 | */ 60 | inline bool testAndSetOrdered(int expectedValue, int newValue) 61 | { 62 | mutexlocker lock(&m); 63 | if (_q_value == expectedValue) { 64 | _q_value = newValue; 65 | return true; 66 | } 67 | return false; 68 | } 69 | 70 | // Non-atomic API 71 | inline bool operator==(int value) const 72 | { 73 | return _q_value == value; 74 | } 75 | 76 | inline bool operator!=(int value) const 77 | { 78 | return _q_value != value; 79 | } 80 | 81 | inline bool operator!() const 82 | { 83 | return _q_value == 0; 84 | } 85 | 86 | inline operator int() const 87 | { 88 | return _q_value; 89 | } 90 | 91 | inline atomicInt &operator=(int value) 92 | { 93 | _q_value = value; 94 | return *this; 95 | } 96 | 97 | inline bool operator>(int value) const 98 | { 99 | return _q_value > value; 100 | } 101 | 102 | inline bool operator<(int value) const 103 | { 104 | return _q_value < value; 105 | } 106 | 107 | private: 108 | volatile int _q_value; 109 | mutex m; 110 | }; 111 | 112 | }//namespace 113 | 114 | #endif 115 | 116 | -------------------------------------------------------------------------------- /vcglib/vcg/math/similarity2.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2016 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | #ifndef __VCG_SIMILARITY2_H 24 | #define __VCG_SIMILARITY2_H 25 | namespace vcg 26 | { 27 | 28 | /* 29 | This class codify a similarity transformation in 2D 30 | 31 | The applied transformation is exactly the same of the Similarity class 32 | Tra(Sca(Rot(P))) 33 | */ 34 | 35 | template 36 | class Similarity2 37 | { 38 | public: 39 | Similarity2():rotRad(0),tra(0,0),sca(1) {} 40 | 41 | SCALAR_TYPE rotRad; 42 | Point2 tra; 43 | SCALAR_TYPE sca; 44 | }; 45 | 46 | template 47 | Point2 operator*(const Similarity2 &m, const Point2 &p) { 48 | Point2 r = p; 49 | // Apply Rotation to point 50 | r.Rotate(m.rotRad); 51 | r *= m.sca; 52 | r += m.tra; 53 | return r; 54 | } 55 | 56 | typedef Similarity2 Similarity2f; 57 | typedef Similarity2 Similarity2d; 58 | 59 | } // end namespace vcg 60 | #endif // __VCG_SIMILARITY2_H 61 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/MatrixFunctions/StemFunction.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010, 2013 Jitse Niesen 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_STEM_FUNCTION 11 | #define EIGEN_STEM_FUNCTION 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \brief The exponential function (and its derivatives). */ 18 | template 19 | Scalar stem_function_exp(Scalar x, int) 20 | { 21 | using std::exp; 22 | return exp(x); 23 | } 24 | 25 | /** \brief Cosine (and its derivatives). */ 26 | template 27 | Scalar stem_function_cos(Scalar x, int n) 28 | { 29 | using std::cos; 30 | using std::sin; 31 | Scalar res; 32 | 33 | switch (n % 4) { 34 | case 0: 35 | res = std::cos(x); 36 | break; 37 | case 1: 38 | res = -std::sin(x); 39 | break; 40 | case 2: 41 | res = -std::cos(x); 42 | break; 43 | case 3: 44 | res = std::sin(x); 45 | break; 46 | } 47 | return res; 48 | } 49 | 50 | /** \brief Sine (and its derivatives). */ 51 | template 52 | Scalar stem_function_sin(Scalar x, int n) 53 | { 54 | using std::cos; 55 | using std::sin; 56 | Scalar res; 57 | 58 | switch (n % 4) { 59 | case 0: 60 | res = std::sin(x); 61 | break; 62 | case 1: 63 | res = std::cos(x); 64 | break; 65 | case 2: 66 | res = -std::sin(x); 67 | break; 68 | case 3: 69 | res = -std::cos(x); 70 | break; 71 | } 72 | return res; 73 | } 74 | 75 | /** \brief Hyperbolic cosine (and its derivatives). */ 76 | template 77 | Scalar stem_function_cosh(Scalar x, int n) 78 | { 79 | using std::cosh; 80 | using std::sinh; 81 | Scalar res; 82 | 83 | switch (n % 2) { 84 | case 0: 85 | res = std::cosh(x); 86 | break; 87 | case 1: 88 | res = std::sinh(x); 89 | break; 90 | } 91 | return res; 92 | } 93 | 94 | /** \brief Hyperbolic sine (and its derivatives). */ 95 | template 96 | Scalar stem_function_sinh(Scalar x, int n) 97 | { 98 | using std::cosh; 99 | using std::sinh; 100 | Scalar res; 101 | 102 | switch (n % 2) { 103 | case 0: 104 | res = std::sinh(x); 105 | break; 106 | case 1: 107 | res = std::cosh(x); 108 | break; 109 | } 110 | return res; 111 | } 112 | 113 | } // end namespace internal 114 | 115 | } // end namespace Eigen 116 | 117 | #endif // EIGEN_STEM_FUNCTION 118 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at the mozilla.org home page 7 | 8 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 9 | #define EIGEN_ORDERINGMETHODS_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** 16 | * \defgroup OrderingMethods_Module OrderingMethods module 17 | * 18 | * This module is currently for internal use only 19 | * 20 | * It defines various built-in and external ordering methods for sparse matrices. 21 | * They are typically used to reduce the number of elements during 22 | * the sparse matrix decomposition (LLT, LU, QR). 23 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 24 | * those ordering methods and applied to the columns of the matrix. 25 | * Using for instance the sparse Cholesky decomposition, it is expected that 26 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 27 | * 28 | * 29 | * Usage : 30 | * \code 31 | * #include 32 | * \endcode 33 | * 34 | * A simple usage is as a template parameter in the sparse decomposition classes : 35 | * 36 | * \code 37 | * SparseLU > solver; 38 | * \endcode 39 | * 40 | * \code 41 | * SparseQR > solver; 42 | * \endcode 43 | * 44 | * It is possible as well to call directly a particular ordering method for your own purpose, 45 | * \code 46 | * AMDOrdering ordering; 47 | * PermutationMatrix perm; 48 | * SparseMatrix A; 49 | * //Fill the matrix ... 50 | * 51 | * ordering(A, perm); // Call AMD 52 | * \endcode 53 | * 54 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 55 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 56 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 57 | * If your matrix is already symmetric (at leat in structure), you can avoid that 58 | * by calling the method with a SelfAdjointView type. 59 | * 60 | * \code 61 | * // Call the ordering on the pattern of the lower triangular matrix A 62 | * ordering(A.selfadjointView(), perm); 63 | * \endcode 64 | */ 65 | 66 | #ifndef EIGEN_MPL2_ONLY 67 | #include "src/OrderingMethods/Amd.h" 68 | #endif 69 | 70 | #include "src/OrderingMethods/Ordering.h" 71 | #include "src/Core/util/ReenableStupidWarnings.h" 72 | 73 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 74 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/arch/CUDA/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_MATH_FUNCTIONS_CUDA_H 11 | #define EIGEN_MATH_FUNCTIONS_CUDA_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Make sure this is only available when targeting a GPU: we don't want to 18 | // introduce conflicts between these packet_traits definitions and the ones 19 | // we'll use on the host side (SSE, AVX, ...) 20 | #if defined(__CUDACC__) && defined(EIGEN_USE_GPU) 21 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 22 | float4 plog(const float4& a) 23 | { 24 | return make_float4(logf(a.x), logf(a.y), logf(a.z), logf(a.w)); 25 | } 26 | 27 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 28 | double2 plog(const double2& a) 29 | { 30 | using ::log; 31 | return make_double2(log(a.x), log(a.y)); 32 | } 33 | 34 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 35 | float4 plog1p(const float4& a) 36 | { 37 | return make_float4(log1pf(a.x), log1pf(a.y), log1pf(a.z), log1pf(a.w)); 38 | } 39 | 40 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 41 | double2 plog1p(const double2& a) 42 | { 43 | return make_double2(log1p(a.x), log1p(a.y)); 44 | } 45 | 46 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 47 | float4 pexp(const float4& a) 48 | { 49 | return make_float4(expf(a.x), expf(a.y), expf(a.z), expf(a.w)); 50 | } 51 | 52 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 53 | double2 pexp(const double2& a) 54 | { 55 | using ::exp; 56 | return make_double2(exp(a.x), exp(a.y)); 57 | } 58 | 59 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 60 | float4 psqrt(const float4& a) 61 | { 62 | return make_float4(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z), sqrtf(a.w)); 63 | } 64 | 65 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 66 | double2 psqrt(const double2& a) 67 | { 68 | using ::sqrt; 69 | return make_double2(sqrt(a.x), sqrt(a.y)); 70 | } 71 | 72 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 73 | float4 prsqrt(const float4& a) 74 | { 75 | return make_float4(rsqrtf(a.x), rsqrtf(a.y), rsqrtf(a.z), rsqrtf(a.w)); 76 | } 77 | 78 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 79 | double2 prsqrt(const double2& a) 80 | { 81 | return make_double2(rsqrt(a.x), rsqrt(a.y)); 82 | } 83 | 84 | 85 | #endif 86 | 87 | } // end namespace internal 88 | 89 | } // end namespace Eigen 90 | 91 | #endif // EIGEN_MATH_FUNCTIONS_CUDA_H 92 | -------------------------------------------------------------------------------- /vcglib/wrap/dae/xmldocumentmanaging.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2008 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | #include 24 | #include 25 | 26 | XMLNode::XMLNode(XMLTag* tag) 27 | :_tag(tag) 28 | { 29 | } 30 | 31 | XMLNode::~XMLNode() 32 | { 33 | delete _tag; 34 | } 35 | 36 | XMLLeafNode::XMLLeafNode(XMLLeafTag* leaftag) 37 | :XMLNode(leaftag) 38 | { 39 | } 40 | 41 | XMLLeafNode::~XMLLeafNode() 42 | { 43 | 44 | } 45 | 46 | 47 | void XMLLeafNode::applyProcedure(XMLVisitor& v) 48 | { 49 | v(*this); 50 | } 51 | 52 | XMLInteriorNode::XMLInteriorNode(XMLTag* tag) 53 | :XMLNode(tag) 54 | { 55 | } 56 | 57 | XMLNode* XMLInteriorNode::son(int ii) 58 | { 59 | assert((ii > 0) && (ii < _sons.size())); 60 | return _sons[ii]; 61 | } 62 | 63 | QVector< XMLNode* > XMLInteriorNode::sons() 64 | { 65 | return _sons; 66 | } 67 | 68 | XMLInteriorNode::~XMLInteriorNode() 69 | { 70 | for(QVector< XMLNode* >::iterator it = _sons.begin();it != _sons.end();++it) 71 | delete (*it); 72 | } 73 | 74 | void XMLInteriorNode::applyProcedure(XMLVisitor& v) 75 | { 76 | v(*this); 77 | } 78 | -------------------------------------------------------------------------------- /vcglib/vcg/complex/algorithms/update/bounding.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * VCGLib o o * 3 | * Visual and Computer Graphics Library o o * 4 | * _ O _ * 5 | * Copyright(C) 2004-2016 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | #ifndef __VCG_TRI_UPDATE_BOUNDING 24 | #define __VCG_TRI_UPDATE_BOUNDING 25 | 26 | namespace vcg { 27 | namespace tri { 28 | 29 | /// \ingroup trimesh 30 | /// \headerfile bounding.h vcg/complex/algorithms/update/bounding.h 31 | /// \brief This class is used to compute or update the bounding box of a mesh.. 32 | 33 | template 34 | class UpdateBounding 35 | { 36 | 37 | public: 38 | typedef ComputeMeshType MeshType; 39 | typedef typename MeshType::VertexType VertexType; 40 | typedef typename MeshType::VertexPointer VertexPointer; 41 | typedef typename MeshType::VertexIterator VertexIterator; 42 | 43 | /// \brief Calculates the bounding box of the given mesh m 44 | 45 | static void Box(ComputeMeshType &m) 46 | { 47 | m.bbox.SetNull(); 48 | for(VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi) 49 | if( !(*vi).IsD() ) m.bbox.Add((*vi).cP()); 50 | } 51 | 52 | 53 | }; // end class 54 | 55 | } // End namespace 56 | } // End namespace 57 | 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorSycl.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Mehdi Goli Codeplay Software Ltd. 5 | // Ralph Potter Codeplay Software Ltd. 6 | // Luke Iwanski Codeplay Software Ltd. 7 | // Contact: eigen@codeplay.com 8 | // 9 | // This Source Code Form is subject to the terms of the Mozilla 10 | // Public License v. 2.0. If a copy of the MPL was not distributed 11 | // with this file, You can obtain one at the mozilla.org home page 12 | 13 | // General include header of SYCL target for Tensor Module 14 | #ifndef UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_H 15 | #define UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_H 16 | 17 | #ifdef EIGEN_USE_SYCL 18 | 19 | // global pointer to set different attribute state for a class 20 | template 21 | struct MakeGlobalPointer { 22 | typedef typename cl::sycl::global_ptr::pointer_t Type; 23 | }; 24 | 25 | // global pointer to set different attribute state for a class 26 | template 27 | struct MakeLocalPointer { 28 | typedef typename cl::sycl::local_ptr::pointer_t Type; 29 | }; 30 | 31 | 32 | namespace Eigen { 33 | namespace TensorSycl { 34 | namespace internal { 35 | 36 | /// This struct is used for special expression nodes with no operations (for example assign and selectOP). 37 | struct NoOP; 38 | 39 | template struct GetType{ 40 | typedef const T Type; 41 | }; 42 | template struct GetType{ 43 | typedef T Type; 44 | }; 45 | 46 | } 47 | } 48 | } 49 | 50 | // tuple construction 51 | #include "TensorSyclTuple.h" 52 | 53 | // counting number of leaf at compile time 54 | #include "TensorSyclLeafCount.h" 55 | 56 | // The index PlaceHolder takes the actual expression and replaces the actual 57 | // data on it with the place holder. It uses the same pre-order expression tree 58 | // traverse as the leaf count in order to give the right access number to each 59 | // node in the expression 60 | #include "TensorSyclPlaceHolderExpr.h" 61 | 62 | // creation of an accessor tuple from a tuple of SYCL buffers 63 | #include "TensorSyclExtractAccessor.h" 64 | 65 | // this is used to change the address space type in tensor map for GPU 66 | #include "TensorSyclConvertToDeviceExpression.h" 67 | 68 | // this is used to extract the functors 69 | #include "TensorSyclExtractFunctors.h" 70 | 71 | // this is used to create tensormap on the device 72 | // this is used to construct the expression on the device 73 | #include "TensorSyclExprConstructor.h" 74 | 75 | /// this is used for extracting tensor reduction 76 | #include "TensorReductionSycl.h" 77 | 78 | // kernel execution using fusion 79 | #include "TensorSyclRun.h" 80 | 81 | #endif // end of EIGEN_USE_SYCL 82 | #endif // UNSUPPORTED_EIGEN_CXX11_SRC_TENSOR_TENSORSYCL_H 83 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This code initially comes from MINPACK whose original authors are: 5 | // Copyright Jorge More - Argonne National Laboratory 6 | // Copyright Burt Garbow - Argonne National Laboratory 7 | // Copyright Ken Hillstrom - Argonne National Laboratory 8 | // 9 | // This Source Code Form is subject to the terms of the Minpack license 10 | // (a BSD-like license) described in the campaigned CopyrightMINPACK.txt file. 11 | 12 | #ifndef EIGEN_LMCOVAR_H 13 | #define EIGEN_LMCOVAR_H 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | template 20 | void covar( 21 | Matrix< Scalar, Dynamic, Dynamic > &r, 22 | const VectorXi& ipvt, 23 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 24 | { 25 | using std::abs; 26 | /* Local variables */ 27 | Index i, j, k, l, ii, jj; 28 | bool sing; 29 | Scalar temp; 30 | 31 | /* Function Body */ 32 | const Index n = r.cols(); 33 | const Scalar tolr = tol * abs(r(0,0)); 34 | Matrix< Scalar, Dynamic, 1 > wa(n); 35 | eigen_assert(ipvt.size()==n); 36 | 37 | /* form the inverse of r in the full upper triangle of r. */ 38 | l = -1; 39 | for (k = 0; k < n; ++k) 40 | if (abs(r(k,k)) > tolr) { 41 | r(k,k) = 1. / r(k,k); 42 | for (j = 0; j <= k-1; ++j) { 43 | temp = r(k,k) * r(j,k); 44 | r(j,k) = 0.; 45 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 46 | } 47 | l = k; 48 | } 49 | 50 | /* form the full upper triangle of the inverse of (r transpose)*r */ 51 | /* in the full upper triangle of r. */ 52 | for (k = 0; k <= l; ++k) { 53 | for (j = 0; j <= k-1; ++j) 54 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 55 | r.col(k).head(k+1) *= r(k,k); 56 | } 57 | 58 | /* form the full lower triangle of the covariance matrix */ 59 | /* in the strict lower triangle of r and in wa. */ 60 | for (j = 0; j < n; ++j) { 61 | jj = ipvt[j]; 62 | sing = j > l; 63 | for (i = 0; i <= j; ++i) { 64 | if (sing) 65 | r(i,j) = 0.; 66 | ii = ipvt[i]; 67 | if (ii > jj) 68 | r(ii,jj) = r(i,j); 69 | if (ii < jj) 70 | r(jj,ii) = r(i,j); 71 | } 72 | wa[jj] = r(j,j); 73 | } 74 | 75 | /* symmetrize the covariance matrix in r. */ 76 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 77 | r.diagonal() = wa; 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_LMCOVAR_H 85 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_DEFAULT_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_DEFAULT_H 12 | 13 | 14 | namespace Eigen { 15 | 16 | // Default device for the machine (typically a single cpu core) 17 | struct DefaultDevice { 18 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void* allocate(size_t num_bytes) const { 19 | return internal::aligned_malloc(num_bytes); 20 | } 21 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void deallocate(void* buffer) const { 22 | internal::aligned_free(buffer); 23 | } 24 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void memcpy(void* dst, const void* src, size_t n) const { 25 | ::memcpy(dst, src, n); 26 | } 27 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void memcpyHostToDevice(void* dst, const void* src, size_t n) const { 28 | memcpy(dst, src, n); 29 | } 30 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void memcpyDeviceToHost(void* dst, const void* src, size_t n) const { 31 | memcpy(dst, src, n); 32 | } 33 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void memset(void* buffer, int c, size_t n) const { 34 | ::memset(buffer, c, n); 35 | } 36 | 37 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t numThreads() const { 38 | #ifndef __CUDA_ARCH__ 39 | // Running on the host CPU 40 | return 1; 41 | #else 42 | // Running on a CUDA device 43 | return 32; 44 | #endif 45 | } 46 | 47 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t firstLevelCacheSize() const { 48 | #ifndef __CUDA_ARCH__ 49 | // Running on the host CPU 50 | return l1CacheSize(); 51 | #else 52 | // Running on a CUDA device, return the amount of shared memory available. 53 | return 48*1024; 54 | #endif 55 | } 56 | 57 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE size_t lastLevelCacheSize() const { 58 | #ifndef __CUDA_ARCH__ 59 | // Running single threaded on the host CPU 60 | return l3CacheSize(); 61 | #else 62 | // Running on a CUDA device 63 | return firstLevelCacheSize(); 64 | #endif 65 | } 66 | 67 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE int majorDeviceVersion() const { 68 | #ifndef __CUDA_ARCH__ 69 | // Running single threaded on the host CPU 70 | // Should return an enum that encodes the ISA supported by the CPU 71 | return 1; 72 | #else 73 | // Running on a CUDA device 74 | return __CUDA_ARCH__ / 100; 75 | #endif 76 | } 77 | }; 78 | 79 | } // namespace Eigen 80 | 81 | #endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_DEFAULT_H 82 | -------------------------------------------------------------------------------- /vcglib/wrap/gl/gl_object.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * MeshLab o o * 3 | * An extendible mesh processor o o * 4 | * _ O _ * 5 | * Copyright(C) 2005, 2009 \/)\/ * 6 | * Visual Computing Lab /\/| * 7 | * ISTI - Italian National Research Council | * 8 | * \ * 9 | * All rights reserved. * 10 | * * 11 | * This program is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU General Public License as published by * 13 | * the Free Software Foundation; either version 2 of the License, or * 14 | * (at your option) any later version. * 15 | * * 16 | * This program is distributed in the hope that it will be useful, * 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 19 | * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * 20 | * for more details. * 21 | * * 22 | ****************************************************************************/ 23 | 24 | #ifndef __GL_OBJECT_H__ 25 | #define __GL_OBJECT_H__ 26 | 27 | class GLObject 28 | { 29 | public: 30 | GLObject(void) 31 | { 32 | this->objectID = 0; 33 | } 34 | 35 | virtual ~GLObject(void) 36 | { 37 | } 38 | 39 | GLuint ObjectID(void) const 40 | { 41 | return this->objectID; 42 | } 43 | 44 | bool ValidObject(void) const 45 | { 46 | return (this->objectID != 0); 47 | } 48 | 49 | virtual void Gen(void) = 0; 50 | virtual void Del(void) = 0; 51 | 52 | protected: 53 | GLuint objectID; 54 | }; 55 | 56 | class Bindable 57 | { 58 | public: 59 | Bindable(void) 60 | { 61 | this->bound = false; 62 | } 63 | 64 | void Bind(void) 65 | { 66 | this->bound = true; 67 | this->DoBind(); 68 | } 69 | 70 | void Unbind(void) 71 | { 72 | this->DoUnbind(); 73 | this->bound = false; 74 | } 75 | 76 | bool IsBound(void) const 77 | { 78 | return this->bound; 79 | } 80 | 81 | protected: 82 | bool bound; 83 | 84 | virtual void DoBind(void) = 0; 85 | virtual void DoUnbind(void) = 0; 86 | }; 87 | 88 | #endif //__GL_OBJECT_H__ 89 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H 12 | 13 | namespace Eigen { 14 | 15 | /** \class TensorDevice 16 | * \ingroup CXX11_Tensor_Module 17 | * 18 | * \brief Pseudo expression providing an operator = that will evaluate its argument 19 | * on the specified computing 'device' (GPU, thread pool, ...) 20 | * 21 | * Example: 22 | * C.device(EIGEN_GPU) = A + B; 23 | * 24 | * Todo: operator *= and /=. 25 | */ 26 | 27 | template class TensorDevice { 28 | public: 29 | TensorDevice(const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {} 30 | 31 | template 32 | EIGEN_STRONG_INLINE TensorDevice& operator=(const OtherDerived& other) { 33 | typedef TensorAssignOp Assign; 34 | Assign assign(m_expression, other); 35 | internal::TensorExecutor::run(assign, m_device); 36 | return *this; 37 | } 38 | 39 | template 40 | EIGEN_STRONG_INLINE TensorDevice& operator+=(const OtherDerived& other) { 41 | typedef typename OtherDerived::Scalar Scalar; 42 | typedef TensorCwiseBinaryOp, const ExpressionType, const OtherDerived> Sum; 43 | Sum sum(m_expression, other); 44 | typedef TensorAssignOp Assign; 45 | Assign assign(m_expression, sum); 46 | internal::TensorExecutor::run(assign, m_device); 47 | return *this; 48 | } 49 | 50 | template 51 | EIGEN_STRONG_INLINE TensorDevice& operator-=(const OtherDerived& other) { 52 | typedef typename OtherDerived::Scalar Scalar; 53 | typedef TensorCwiseBinaryOp, const ExpressionType, const OtherDerived> Difference; 54 | Difference difference(m_expression, other); 55 | typedef TensorAssignOp Assign; 56 | Assign assign(m_expression, difference); 57 | internal::TensorExecutor::run(assign, m_device); 58 | return *this; 59 | } 60 | 61 | protected: 62 | const DeviceType& m_device; 63 | ExpressionType& m_expression; 64 | }; 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H 69 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_CXX11_TENSOR_TENSOR_IO_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_IO_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Print the tensor as a 2d matrix 18 | template 19 | struct TensorPrinter { 20 | static void run (std::ostream& os, const Tensor& tensor) { 21 | typedef typename internal::remove_const::type Scalar; 22 | typedef typename Tensor::Index Index; 23 | const Index total_size = internal::array_prod(tensor.dimensions()); 24 | if (total_size > 0) { 25 | const Index first_dim = Eigen::internal::array_get<0>(tensor.dimensions()); 26 | static const int layout = Tensor::Layout; 27 | Map > matrix(const_cast(tensor.data()), first_dim, total_size/first_dim); 28 | os << matrix; 29 | } 30 | } 31 | }; 32 | 33 | 34 | // Print the tensor as a vector 35 | template 36 | struct TensorPrinter { 37 | static void run (std::ostream& os, const Tensor& tensor) { 38 | typedef typename internal::remove_const::type Scalar; 39 | typedef typename Tensor::Index Index; 40 | const Index total_size = internal::array_prod(tensor.dimensions()); 41 | if (total_size > 0) { 42 | Map > array(const_cast(tensor.data()), total_size); 43 | os << array; 44 | } 45 | } 46 | }; 47 | 48 | 49 | // Print the tensor as a scalar 50 | template 51 | struct TensorPrinter { 52 | static void run (std::ostream& os, const Tensor& tensor) { 53 | os << tensor.coeff(0); 54 | } 55 | }; 56 | } 57 | 58 | template 59 | std::ostream& operator << (std::ostream& os, const TensorBase& expr) { 60 | typedef TensorEvaluator, DefaultDevice> Evaluator; 61 | typedef typename Evaluator::Dimensions Dimensions; 62 | 63 | // Evaluate the expression if needed 64 | TensorForcedEvalOp eval = expr.eval(); 65 | Evaluator tensor(eval, DefaultDevice()); 66 | tensor.evalSubExprsIfNeeded(NULL); 67 | 68 | // Print the result 69 | static const int rank = internal::array_size::value; 70 | internal::TensorPrinter::run(os, tensor); 71 | 72 | // Cleanup. 73 | tensor.cleanup(); 74 | return os; 75 | } 76 | 77 | } // end namespace Eigen 78 | 79 | #endif // EIGEN_CXX11_TENSOR_TENSOR_IO_H 80 | -------------------------------------------------------------------------------- /vcglib/eigenlib/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_INCOMPLETE_LU_H 11 | #define EIGEN_INCOMPLETE_LU_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | class IncompleteLU : public SparseSolverBase > 17 | { 18 | protected: 19 | typedef SparseSolverBase > Base; 20 | using Base::m_isInitialized; 21 | 22 | typedef _Scalar Scalar; 23 | typedef Matrix Vector; 24 | typedef typename Vector::Index Index; 25 | typedef SparseMatrix FactorType; 26 | 27 | public: 28 | typedef Matrix MatrixType; 29 | 30 | IncompleteLU() {} 31 | 32 | template 33 | IncompleteLU(const MatrixType& mat) 34 | { 35 | compute(mat); 36 | } 37 | 38 | Index rows() const { return m_lu.rows(); } 39 | Index cols() const { return m_lu.cols(); } 40 | 41 | template 42 | IncompleteLU& compute(const MatrixType& mat) 43 | { 44 | m_lu = mat; 45 | int size = mat.cols(); 46 | Vector diag(size); 47 | for(int i=0; i 78 | void _solve_impl(const Rhs& b, Dest& x) const 79 | { 80 | x = m_lu.template triangularView().solve(b); 81 | x = m_lu.template triangularView().solve(x); 82 | } 83 | 84 | protected: 85 | FactorType m_lu; 86 | }; 87 | 88 | } // end namespace Eigen 89 | 90 | #endif // EIGEN_INCOMPLETE_LU_H 91 | -------------------------------------------------------------------------------- /vcglib/eigenlib/Eigen/src/Core/Swap.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2006-2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at the mozilla.org home page 9 | 10 | #ifndef EIGEN_SWAP_H 11 | #define EIGEN_SWAP_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Overload default assignPacket behavior for swapping them 18 | template 19 | class generic_dense_assignment_kernel, Specialized> 20 | : public generic_dense_assignment_kernel, BuiltIn> 21 | { 22 | protected: 23 | typedef generic_dense_assignment_kernel, BuiltIn> Base; 24 | using Base::m_dst; 25 | using Base::m_src; 26 | using Base::m_functor; 27 | 28 | public: 29 | typedef typename Base::Scalar Scalar; 30 | typedef typename Base::DstXprType DstXprType; 31 | typedef swap_assign_op Functor; 32 | 33 | EIGEN_DEVICE_FUNC generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) 34 | : Base(dst, src, func, dstExpr) 35 | {} 36 | 37 | template 38 | void assignPacket(Index row, Index col) 39 | { 40 | PacketType tmp = m_src.template packet(row,col); 41 | const_cast(m_src).template writePacket(row,col, m_dst.template packet(row,col)); 42 | m_dst.template writePacket(row,col,tmp); 43 | } 44 | 45 | template 46 | void assignPacket(Index index) 47 | { 48 | PacketType tmp = m_src.template packet(index); 49 | const_cast(m_src).template writePacket(index, m_dst.template packet(index)); 50 | m_dst.template writePacket(index,tmp); 51 | } 52 | 53 | // TODO find a simple way not to have to copy/paste this function from generic_dense_assignment_kernel, by simple I mean no CRTP (Gael) 54 | template 55 | void assignPacketByOuterInner(Index outer, Index inner) 56 | { 57 | Index row = Base::rowIndexByOuterInner(outer, inner); 58 | Index col = Base::colIndexByOuterInner(outer, inner); 59 | assignPacket(row, col); 60 | } 61 | }; 62 | 63 | } // namespace internal 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_SWAP_H 68 | --------------------------------------------------------------------------------