├── algorithm ├── eigen │ ├── src │ │ ├── SparseCore │ │ │ ├── SparseAssign.h │ │ │ ├── CMakeLists.txt │ │ │ ├── SparseFuzzy.h │ │ │ ├── SparseRedux.h │ │ │ ├── CoreIterators.h │ │ │ ├── SparseTranspose.h │ │ │ └── SparseView.h │ │ ├── Core │ │ │ ├── util │ │ │ │ ├── NonMPL2.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── ReenableStupidWarnings.h │ │ │ │ └── DisableStupidWarnings.h │ │ │ ├── arch │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── NEON │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── SSE │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── AltiVec │ │ │ │ │ └── CMakeLists.txt │ │ │ │ └── Default │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── Settings.h │ │ │ ├── products │ │ │ │ └── CMakeLists.txt │ │ │ ├── CMakeLists.txt │ │ │ ├── CoreIterators.h │ │ │ └── ReturnByValue.h │ │ ├── QR │ │ │ ├── CMakeLists.txt │ │ │ └── HouseholderQR_MKL.h │ │ ├── SVD │ │ │ └── CMakeLists.txt │ │ ├── misc │ │ │ ├── CMakeLists.txt │ │ │ ├── Solve.h │ │ │ ├── Kernel.h │ │ │ └── Image.h │ │ ├── Jacobi │ │ │ └── CMakeLists.txt │ │ ├── LU │ │ │ ├── arch │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── plugins │ │ │ ├── CMakeLists.txt │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ └── MatrixCwiseUnaryOps.h │ │ ├── Cholesky │ │ │ └── CMakeLists.txt │ │ ├── SparseLU │ │ │ ├── CMakeLists.txt │ │ │ ├── SparseLU_Utils.h │ │ │ └── SparseLU_relax_snode.h │ │ ├── SparseQR │ │ │ └── CMakeLists.txt │ │ ├── Eigenvalues │ │ │ └── CMakeLists.txt │ │ ├── Householder │ │ │ ├── CMakeLists.txt │ │ │ └── BlockHouseholder.h │ │ ├── StlSupport │ │ │ ├── CMakeLists.txt │ │ │ └── details.h │ │ ├── MetisSupport │ │ │ └── CMakeLists.txt │ │ ├── SPQRSupport │ │ │ └── CMakeLists.txt │ │ ├── Geometry │ │ │ ├── arch │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── PaStiXSupport │ │ │ └── CMakeLists.txt │ │ ├── CholmodSupport │ │ │ └── CMakeLists.txt │ │ ├── PardisoSupport │ │ │ └── CMakeLists.txt │ │ ├── SparseCholesky │ │ │ └── CMakeLists.txt │ │ ├── SuperLUSupport │ │ │ └── CMakeLists.txt │ │ ├── UmfPackSupport │ │ │ └── CMakeLists.txt │ │ ├── OrderingMethods │ │ │ └── CMakeLists.txt │ │ ├── Eigen2Support │ │ │ ├── Geometry │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── All.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Macros.h │ │ │ ├── TriangularSolver.h │ │ │ ├── Memory.h │ │ │ ├── QR.h │ │ │ ├── Lazy.h │ │ │ ├── MathFunctions.h │ │ │ ├── VectorBlock.h │ │ │ └── Meta.h │ │ ├── IterativeLinearSolvers │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── Eigen │ ├── Dense │ ├── Array │ ├── Householder │ ├── CMakeLists.txt │ ├── Sparse │ ├── Jacobi │ ├── StdList │ ├── QtAlignedMalloc │ ├── MetisSupport │ ├── LeastSquares │ ├── StdDeque │ ├── StdVector │ ├── Cholesky │ ├── PardisoSupport │ ├── SVD │ ├── SPQRSupport │ ├── QR │ ├── SparseQR │ ├── LU │ ├── UmfPackSupport │ ├── Eigenvalues │ ├── SparseCholesky │ ├── PaStiXSupport │ ├── IterativeLinearSolvers │ ├── CholmodSupport │ ├── Geometry │ ├── SparseLU │ ├── SparseCore │ ├── SuperLUSupport │ └── OrderingMethods ├── DynamicFusion │ ├── CudaCholeskeySolver.cu │ ├── SparseVolume.cu │ ├── GpuHeap.h │ ├── CudaUtil.cpp │ ├── cudpp │ │ ├── ModerGpuWrapper.h │ │ ├── moderngpu │ │ │ └── include │ │ │ │ ├── kernels │ │ │ │ └── cubradixsort.cuh │ │ │ │ ├── moderngpu.cuh │ │ │ │ ├── mgpuenums.h │ │ │ │ └── util │ │ │ │ └── mgpualloc.h │ │ ├── ModerGpuWrapper.cu │ │ └── thrust_wrapper.h │ ├── cuda_utils.h │ ├── VoxelHash │ │ ├── chunk.h │ │ ├── voxel_hashing_utils.cu │ │ └── voxel_hashing_device.h │ ├── GpuCholeSky.h │ ├── kinect_util.cpp │ ├── CpuGaussNewton.h │ ├── RayCaster.h │ ├── CudaCholeskeySolver.h │ ├── MarchingCubes.h │ ├── SparseVolume.h │ ├── kinect_util.h │ ├── CudaDiagBlockMatrix.h │ ├── RayCaster.cpp │ ├── TsdfVolume.h │ ├── glsl │ │ └── glslprogram.h │ ├── CudaDiagBlockMatrix.cpp │ └── MicrosoftKinect.h ├── FreeImage │ ├── FreeImage.h │ └── CFreeImage.h ├── mpu │ ├── Convolution_Helper.cpp │ └── MarchingCube.h ├── global_param.h ├── freeglut │ ├── glut.h │ └── freeglut.h ├── global_data_holder.h ├── BFGS │ ├── BFGSFit.h │ └── BFGSFit.cpp ├── Renderable │ ├── GLNode.h │ ├── AbstractMesh.cpp │ ├── Renderable.h │ └── AbstractMesh.h ├── kdtree │ ├── AABB.cpp │ ├── common.h │ └── BSphere.h ├── global_data_holder.cpp └── camera │ └── Camera.h ├── dynamicfusionui.qrc ├── main.cpp ├── .gitignore ├── DynamicFusionUI.vcxproj.user ├── DepthViewer.h ├── DynamicFusionUI.sln ├── RayCastViewer.h └── dynamicfusionui.h /algorithm/eigen/src/SparseCore/SparseAssign.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /algorithm/eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/CudaCholeskeySolver.cu: -------------------------------------------------------------------------------- 1 | #include "CudaCholeskeySolver.h" -------------------------------------------------------------------------------- /algorithm/DynamicFusion/SparseVolume.cu: -------------------------------------------------------------------------------- 1 | #include "SparseVolume.h" 2 | 3 | namespace dfusion 4 | { 5 | 6 | } -------------------------------------------------------------------------------- /dynamicfusionui.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /algorithm/FreeImage/FreeImage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolphin-li/DynamicFusion/HEAD/algorithm/FreeImage/FreeImage.h -------------------------------------------------------------------------------- /algorithm/mpu/Convolution_Helper.cpp: -------------------------------------------------------------------------------- 1 | #include "Convolution_Helper.h" 2 | 3 | namespace conv_helper 4 | { 5 | 6 | } -------------------------------------------------------------------------------- /algorithm/DynamicFusion/GpuHeap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dolphin-li/DynamicFusion/HEAD/algorithm/DynamicFusion/GpuHeap.h -------------------------------------------------------------------------------- /algorithm/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 | -------------------------------------------------------------------------------- /algorithm/global_param.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace global_param 4 | { 5 | const static float VOLUME_BAND_HALF_WIDTH = 5.f; 6 | } -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /algorithm/eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /algorithm/eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseLU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseLU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseLU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseLU COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseQR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseQR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseQR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseQR/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCore_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCore_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCore COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/MetisSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_MetisSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_MetisSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/MetisSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SPQRSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SPQRSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SPQRSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SPQRSupport/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/PaStiXSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PastixSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PastixSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PaStiXSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include "dynamicfusionui.h" 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | QApplication a(argc, argv); 7 | DynamicFusionUI w; 8 | w.show(); 9 | return a.exec(); 10 | } 11 | -------------------------------------------------------------------------------- /algorithm/eigen/src/CholmodSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_CholmodSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_CholmodSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/CholmodSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/PardisoSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PardisoSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PardisoSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PardisoSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseCholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SuperLUSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SuperLUSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SuperLUSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SuperLUSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/UmfPackSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_UmfPackSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_UmfPackSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/UmfPackSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/OrderingMethods/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_OrderingMethods_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_OrderingMethods_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/OrderingMethods COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /algorithm/eigen/src/IterativeLinearSolvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_IterativeLinearSolvers_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_IterativeLinearSolvers_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/IterativeLinearSolvers COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /algorithm/eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /algorithm/eigen/Array: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ARRAY_MODULE_H 2 | #define EIGEN_ARRAY_MODULE_H 3 | 4 | // include Core first to handle Eigen2 support macros 5 | #include "Core" 6 | 7 | #ifndef EIGEN2_SUPPORT 8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. 9 | #endif 10 | 11 | #endif // EIGEN_ARRAY_MODULE_H 12 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/CudaUtil.cpp: -------------------------------------------------------------------------------- 1 | #include "cuda_utils.h" 2 | #include 3 | void ___cudaSafeCall(cudaError_t err, const char* msg) 4 | { 5 | //// debug 6 | //err = cudaThreadSynchronize(); 7 | //if (cudaSuccess != err){ 8 | // printf("CUDA error1(%s): %s\n", msg, cudaGetErrorString(err)); 9 | // exit(-1); 10 | //} 11 | //// end debug 12 | 13 | if (cudaSuccess != err){ 14 | printf("CUDA error(%s): %s\n", msg, cudaGetErrorString(err)); 15 | exit(-1); 16 | } 17 | } -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/ModerGpuWrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace modergpu_wrapper 4 | { 5 | void mergesort(int* val, int count); 6 | void mergesort(float* val, int count); 7 | void mergesort_by_key(int* keys_global, int* values_global, int count); 8 | void mergesort_by_key(int* keys_global, float* values_global, int count); 9 | void mergesort_by_key(float* keys_global, int* values_global, int count); 10 | void mergesort_by_key(float* keys_global, float* values_global, int count); 11 | void mergesort_by_key(int* keys_global, float4* values_global, int count); 12 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # folders 2 | data/* 3 | tmp/* 4 | GeneratedFiles/* 5 | 6 | # Compiled Object files 7 | *.slo 8 | *.lo 9 | *.o 10 | *.obj 11 | *.sdf 12 | *.opensdf 13 | *.suo 14 | *.pdb 15 | *.ilk 16 | 17 | # Precompiled Headers 18 | *.gch 19 | *.pch 20 | 21 | # Compiled Dynamic libraries 22 | *.so 23 | *.dylib 24 | *.dll 25 | 26 | # Fortran module files 27 | *.mod 28 | 29 | # Compiled Static libraries 30 | *.lai 31 | *.la 32 | *.a 33 | *.lib 34 | 35 | # Executables 36 | *.exe 37 | *.out 38 | *.app 39 | 40 | # Data Files 41 | *.depth 42 | *.fdepth 43 | *.png 44 | *.dvol 45 | *.cvol 46 | *.dfusion 47 | *.hfdvol -------------------------------------------------------------------------------- /algorithm/eigen/Householder: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #define EIGEN_HOUSEHOLDER_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Householder_Module Householder module 9 | * This module provides Householder transformations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | */ 15 | 16 | #include "src/Householder/Householder.h" 17 | #include "src/Householder/HouseholderSequence.h" 18 | #include "src/Householder/BlockHouseholder.h" 19 | 20 | #include "src/Core/util/ReenableStupidWarnings.h" 21 | 22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 24 | -------------------------------------------------------------------------------- /algorithm/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 | add_subdirectory(src) 20 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MACROS_H 11 | #define EIGEN2_MACROS_H 12 | 13 | #define ei_assert eigen_assert 14 | #define ei_internal_assert eigen_internal_assert 15 | 16 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 17 | 18 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 19 | 20 | #endif // EIGEN2_MACROS_H 21 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cuda_utils.h: -------------------------------------------------------------------------------- 1 | /***********************************************************/ 2 | /** \file 3 | \brief cuda utils used by Kinect Fusion 4 | \details 5 | \author Yizhong Zhang 6 | \date 11/13/2013 7 | */ 8 | /***********************************************************/ 9 | #ifndef __CUDA_UTILS_H__ 10 | #define __CUDA_UTILS_H__ 11 | 12 | #include 13 | #include 14 | #include "cuda_runtime_api.h" 15 | #pragma comment(lib, "cudart.lib") 16 | 17 | 18 | #define cudaSafeCall ___cudaSafeCall 19 | 20 | 21 | void ___cudaSafeCall(cudaError_t err, const char* msg = NULL); 22 | 23 | static inline int divUp(int total, int grain) { return (total + grain - 1) / grain; } 24 | 25 | 26 | 27 | #endif -------------------------------------------------------------------------------- /algorithm/eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | /** \defgroup Sparse_Module Sparse meta-module 5 | * 6 | * Meta-module including all related modules: 7 | * - \ref SparseCore_Module 8 | * - \ref OrderingMethods_Module 9 | * - \ref SparseCholesky_Module 10 | * - \ref SparseLU_Module 11 | * - \ref SparseQR_Module 12 | * - \ref IterativeLinearSolvers_Module 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "SparseCore" 20 | #include "OrderingMethods" 21 | #include "SparseCholesky" 22 | #include "SparseLU" 23 | #include "SparseQR" 24 | #include "IterativeLinearSolvers" 25 | 26 | #endif // EIGEN_SPARSE_MODULE_H 27 | 28 | -------------------------------------------------------------------------------- /algorithm/freeglut/glut.h: -------------------------------------------------------------------------------- 1 | #ifndef __GLUT_H__ 2 | #define __GLUT_H__ 3 | 4 | /* 5 | * glut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | 19 | /*** END OF FILE ***/ 20 | 21 | #endif /* __GLUT_H__ */ 22 | -------------------------------------------------------------------------------- /DynamicFusionUI.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | D:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl 6 | PATH=$(QTDIR)\bin%3b$(PATH) 7 | Auto 8 | 9 | 10 | D:\Qt\Qt5.3.1\5.3\msvc2013_64_opengl 11 | PATH=$(QTDIR)\bin%3b$(PATH) 12 | 13 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/VoxelHash/chunk.h: -------------------------------------------------------------------------------- 1 | /***********************************************************/ 2 | /** \file 3 | \brief data structure for chunk 4 | \details 5 | \author Yizhong Zhang 6 | \date 12/12/2013 7 | */ 8 | /***********************************************************/ 9 | #ifndef __CHUNK_H__ 10 | #define __CHUNK_H__ 11 | 12 | #include 13 | #include "voxel_hashing_internal.h" 14 | 15 | 16 | class Chunk{ 17 | public: 18 | std::vector hash_entry; 19 | std::list voxel_block; 20 | 21 | public: 22 | inline void AddData(const HashEntry& entry, const VoxelBlock& block){ 23 | hash_entry.push_back(entry); 24 | voxel_block.push_back(block); 25 | } 26 | }; 27 | 28 | 29 | 30 | 31 | #endif // __CHUNK_H__ -------------------------------------------------------------------------------- /algorithm/eigen/Jacobi: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #define EIGEN_JACOBI_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Jacobi_Module Jacobi module 9 | * This module provides Jacobi and Givens rotations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | * 15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 16 | * - MatrixBase::applyOnTheLeft() 17 | * - MatrixBase::applyOnTheRight(). 18 | */ 19 | 20 | #include "src/Jacobi/Jacobi.h" 21 | 22 | #include "src/Core/util/ReenableStupidWarnings.h" 23 | 24 | #endif // EIGEN_JACOBI_MODULE_H 25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 26 | 27 | -------------------------------------------------------------------------------- /algorithm/freeglut/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns 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 | -------------------------------------------------------------------------------- /algorithm/eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | 2 | #ifndef EIGEN_QTMALLOC_MODULE_H 3 | #define EIGEN_QTMALLOC_MODULE_H 4 | 5 | #include "Core" 6 | 7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 8 | 9 | #include "src/Core/util/DisableStupidWarnings.h" 10 | 11 | void *qMalloc(size_t size) 12 | { 13 | return Eigen::internal::aligned_malloc(size); 14 | } 15 | 16 | void qFree(void *ptr) 17 | { 18 | Eigen::internal::aligned_free(ptr); 19 | } 20 | 21 | void *qRealloc(void *ptr, size_t size) 22 | { 23 | void* newPtr = Eigen::internal::aligned_malloc(size); 24 | memcpy(newPtr, ptr, size); 25 | Eigen::internal::aligned_free(ptr); 26 | return newPtr; 27 | } 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif 32 | 33 | #endif // EIGEN_QTMALLOC_MODULE_H 34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 35 | -------------------------------------------------------------------------------- /algorithm/eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_METISSUPPORT_MODULE_H 2 | #define EIGEN_METISSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | 13 | /** \ingroup Support_modules 14 | * \defgroup MetisSupport_Module MetisSupport module 15 | * 16 | * \code 17 | * #include 18 | * \endcode 19 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 20 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 21 | */ 22 | 23 | 24 | #include "src/MetisSupport/MetisSupport.h" 25 | 26 | #include "src/Core/util/ReenableStupidWarnings.h" 27 | 28 | #endif // EIGEN_METISSUPPORT_MODULE_H 29 | -------------------------------------------------------------------------------- /DepthViewer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Camera.h" 5 | #include "kinect_util.h" 6 | class DepthViewer : public QGLWidget 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | DepthViewer(QWidget *parent); 12 | ~DepthViewer(); 13 | 14 | void setImage_h(const dfusion::depthtype* image_h, int w, int h); 15 | void setImage_d(PtrStepSz image_d); 16 | void setNormal_d(const dfusion::MapArr& image_d); 17 | 18 | void download_currentmap(std::vector& hostmap); 19 | 20 | void initializeGL(); 21 | void resizeGL(int w, int h); 22 | void paintGL(); 23 | protected: 24 | QGLFunctions *m_gl_func; 25 | GLuint m_texture_id; 26 | Camera m_camera; 27 | std::vector m_depthColors_h; 28 | 29 | PtrStepSz m_pbo_buffer; 30 | GLuint m_pbo_id; 31 | cudaGraphicsResource* m_pbo_cuda_res; 32 | }; -------------------------------------------------------------------------------- /algorithm/DynamicFusion/GpuCholeSky.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | namespace gpu_cholesky 4 | { 5 | void cholesky(float * A, int n_rows); 6 | 7 | // batched cholesky decomposition of PSD matrix: 8 | // ptr: input/output, only the lower triangular part is read and wrote. 9 | void single_thread_LtL_batched(float* outputLLt, int strideLLt, 10 | const float *inputL, int strideL, int nMatRowCol, int batchSize); 11 | 12 | // batched triangular matrix inverse of Lower part: 13 | // ptr: input/output, only the lower triangular part is read and wrote. 14 | void single_thread_tril_inv_batched(float *ptr, int nMatRowCol, int stride, int batchSize); 15 | 16 | // batched triangular matrix multiplication: L'*L 17 | // ptr: input/output, only the lower triangular part is read and wrote. 18 | void single_thread_cholesky_batched(float *ptr, int nMatRowCol, int stride, int batchSize); 19 | } -------------------------------------------------------------------------------- /algorithm/eigen/LeastSquares: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_REGRESSION_MODULE_H 2 | #define EIGEN_REGRESSION_MODULE_H 3 | 4 | #ifndef EIGEN2_SUPPORT 5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) 6 | #endif 7 | 8 | // exclude from normal eigen3-only documentation 9 | #ifdef EIGEN2_SUPPORT 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Eigenvalues" 16 | #include "Geometry" 17 | 18 | /** \defgroup LeastSquares_Module LeastSquares module 19 | * This module provides linear regression and related features. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/Eigen2Support/LeastSquares.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN2_SUPPORT 31 | 32 | #endif // EIGEN_REGRESSION_MODULE_H 33 | -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns 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 | -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns 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 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/kinect_util.cpp: -------------------------------------------------------------------------------- 1 | #include "kinect_util.h" 2 | #include "ObjMesh.h" 3 | namespace dfusion 4 | { 5 | void mapsToObj(ObjMesh& mesh, const dfusion::MapArr& vmap, const dfusion::MapArr& nmap) 6 | { 7 | int w = vmap.cols(); 8 | int h = vmap.rows(); 9 | int n = w*h; 10 | std::vector vhost(n), nhost(n); 11 | vmap.download(vhost.data(), w*sizeof(float4)); 12 | nmap.download(nhost.data(), w*sizeof(float4)); 13 | 14 | mesh.clear(); 15 | mesh.vertex_list.resize(n); 16 | mesh.vertex_normal_list.resize(n); 17 | 18 | for (int i = 0; i < n; i++) 19 | { 20 | mesh.vertex_list[i][0] = vhost[i].x; 21 | mesh.vertex_list[i][1] = vhost[i].y; 22 | mesh.vertex_list[i][2] = vhost[i].z; 23 | mesh.vertex_normal_list[i][0] = nhost[i].x; 24 | mesh.vertex_normal_list[i][1] = vhost[i].y; 25 | mesh.vertex_normal_list[i][2] = vhost[i].z; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /algorithm/DynamicFusion/CpuGaussNewton.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "definations.h" 3 | #include "DynamicFusionParam.h" 4 | namespace dfusion 5 | { 6 | class WarpField; 7 | struct EigenContainter; 8 | class CpuGaussNewton 9 | { 10 | public: 11 | CpuGaussNewton(); 12 | ~CpuGaussNewton(); 13 | 14 | void init(WarpField* pWarpField, const MapArr& vmap_cano, const MapArr& nmap_cano, 15 | Param param, Intr intr); 16 | 17 | void findCorr(const MapArr& vmap_live, const MapArr& nmap_live, 18 | const MapArr& vmap_warp, const MapArr& nmap_warp); 19 | 20 | void solve(bool factor_rigid_out = true); 21 | 22 | void debug_set_init_x(const float* x_host, int n); 23 | protected: 24 | private: 25 | WarpField* m_pWarpField; 26 | EigenContainter* m_egc; 27 | DeviceArray2D m_vmapKnn; 28 | DeviceArray m_twist; 29 | DeviceArray m_vw; 30 | DeviceArray m_nodesKnn; 31 | }; 32 | } -------------------------------------------------------------------------------- /algorithm/eigen/Cholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #define EIGEN_CHOLESKY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Cholesky_Module Cholesky module 9 | * 10 | * 11 | * 12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 13 | * Those decompositions are accessible via the following MatrixBase methods: 14 | * - MatrixBase::llt(), 15 | * - MatrixBase::ldlt() 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | */ 21 | 22 | #include "src/misc/Solve.h" 23 | #include "src/Cholesky/LLT.h" 24 | #include "src/Cholesky/LDLT.h" 25 | #ifdef EIGEN_USE_LAPACKE 26 | #include "src/Cholesky/LLT_MKL.h" 27 | #endif 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_CHOLESKY_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/RayCaster.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "definations.h" 4 | 5 | class Camera; 6 | 7 | namespace dfusion 8 | { 9 | class TsdfVolume; 10 | class RayCaster 11 | { 12 | public: 13 | RayCaster(); 14 | ~RayCaster(); 15 | 16 | void init(const TsdfVolume& v); 17 | 18 | void setCamera(const Camera& cam); 19 | 20 | // host_gray_buffer: pre-allocated, size = viewport width*height defined by the camera 21 | // host_step: strides of each row in bytes 22 | void shading(LightSource light, ColorMap& colorMap, bool show_normal_map=false); 23 | 24 | void clear(); 25 | 26 | const MapArr* get_vmap()const{ return &m_vmap; } 27 | const MapArr* get_nmap()const{ return &m_nmap; } 28 | protected: 29 | void raycast(); 30 | private: 31 | const TsdfVolume* m_volume; 32 | Intr m_intr; 33 | Mat33 m_Rc2v; 34 | float3 m_tc2v; 35 | Mat33 m_Rv2c; 36 | float3 m_tv2c; 37 | 38 | MapArr m_vmap; 39 | MapArr m_nmap; 40 | }; 41 | 42 | } -------------------------------------------------------------------------------- /algorithm/eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 2 | #define EIGEN_PARDISOSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup PardisoSupport_Module PardisoSupport module 14 | * 15 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * 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. 22 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 23 | * 24 | */ 25 | 26 | #include "src/PardisoSupport/PardisoSupport.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 31 | -------------------------------------------------------------------------------- /algorithm/eigen/SVD: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #define EIGEN_SVD_MODULE_H 3 | 4 | #include "QR" 5 | #include "Householder" 6 | #include "Jacobi" 7 | 8 | #include "src/Core/util/DisableStupidWarnings.h" 9 | 10 | /** \defgroup SVD_Module SVD module 11 | * 12 | * 13 | * 14 | * This module provides SVD decomposition for matrices (both real and complex). 15 | * This decomposition is accessible via the following MatrixBase method: 16 | * - MatrixBase::jacobiSvd() 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/SVD/JacobiSVD.h" 25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 26 | #include "src/SVD/JacobiSVD_MKL.h" 27 | #endif 28 | #include "src/SVD/UpperBidiagonalization.h" 29 | 30 | #ifdef EIGEN2_SUPPORT 31 | #include "src/Eigen2Support/SVD.h" 32 | #endif 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_SVD_MODULE_H 37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 38 | -------------------------------------------------------------------------------- /algorithm/eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 2 | #define EIGEN_SPQRSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SuiteSparseQR.hpp" 9 | 10 | /** \ingroup Support_modules 11 | * \defgroup SPQRSupport_Module SuiteSparseQR module 12 | * 13 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 14 | * 15 | * \code 16 | * #include 17 | * \endcode 18 | * 19 | * 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,...). 20 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | #include "src/CholmodSupport/CholmodSupport.h" 27 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /algorithm/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 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | // template 14 | // template 15 | // bool SparseMatrixBase::isApprox( 16 | // const OtherDerived& other, 17 | // typename NumTraits::Real prec 18 | // ) const 19 | // { 20 | // const typename internal::nested::type nested(derived()); 21 | // const typename internal::nested::type otherNested(other.derived()); 22 | // return (nested - otherNested).cwise().abs2().sum() 23 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 24 | // } 25 | 26 | #endif // EIGEN_SPARSE_FUZZY_H 27 | -------------------------------------------------------------------------------- /algorithm/eigen/QR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #define EIGEN_QR_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | 12 | /** \defgroup QR_Module QR module 13 | * 14 | * 15 | * 16 | * This module provides various QR decompositions 17 | * This module also provides some MatrixBase methods, including: 18 | * - MatrixBase::qr(), 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/QR/HouseholderQR.h" 27 | #include "src/QR/FullPivHouseholderQR.h" 28 | #include "src/QR/ColPivHouseholderQR.h" 29 | #ifdef EIGEN_USE_LAPACKE 30 | #include "src/QR/HouseholderQR_MKL.h" 31 | #include "src/QR/ColPivHouseholderQR_MKL.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/QR.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #ifdef EIGEN2_SUPPORT 41 | #include "Eigenvalues" 42 | #endif 43 | 44 | #endif // EIGEN_QR_MODULE_H 45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 46 | -------------------------------------------------------------------------------- /algorithm/eigen/SparseQR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSEQR_MODULE_H 2 | #define EIGEN_SPARSEQR_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup SparseQR_Module SparseQR module 9 | * \brief Provides QR decomposition for sparse matrices 10 | * 11 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 12 | * The columns of the input matrix should be reordered to limit the fill-in during the 13 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 14 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 15 | * of built-in and external ordering methods. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | 27 | #include "OrderingMethods" 28 | #include "src/SparseCore/SparseColEtree.h" 29 | #include "src/SparseQR/SparseQR.h" 30 | 31 | #include "src/Core/util/ReenableStupidWarnings.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /algorithm/mpu/MarchingCube.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "VolumeData.h" 3 | #include "ObjMesh.h" 4 | namespace mpu 5 | { 6 | class MarchingCube 7 | { 8 | public: 9 | MarchingCube(); 10 | ~MarchingCube(); 11 | 12 | void run(const VolumeData& data, ObjMesh& mesh); 13 | void run(const VolumeData& data, ObjMesh& mesh, ldp::Int3 begin, ldp::Int3 end); 14 | void run(const VolumeData& data, ObjMesh& mesh, kdtree::AABB box); 15 | protected: 16 | struct GridCell 17 | { 18 | // input field for marching cube 19 | ldp::Float3 p[8];//position of each corner of the grid in world space 20 | float val[8]; //value of the function at this grid corner 21 | 22 | // output field for marching cube 23 | ldp::Int3 out_tri[10]; 24 | ldp::Float3 out_vert[15]; 25 | int n_out_tri; 26 | int n_out_vert; 27 | 28 | // tmp field 29 | ldp::Float3 tmp_vert[12]; 30 | char tmp_map[12]; 31 | }; 32 | 33 | // given a grid cell, returns the set of triangles that approximates the region where val == 0. 34 | // NOTE: 35 | // preallocate Triangles[10] and Vertices [15] 36 | void polygonize(GridCell &Grid); 37 | private: 38 | }; 39 | } -------------------------------------------------------------------------------- /algorithm/eigen/LU: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #define EIGEN_LU_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup LU_Module LU module 9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 10 | * This module defines the following MatrixBase methods: 11 | * - MatrixBase::inverse() 12 | * - MatrixBase::determinant() 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "src/misc/Solve.h" 20 | #include "src/misc/Kernel.h" 21 | #include "src/misc/Image.h" 22 | #include "src/LU/FullPivLU.h" 23 | #include "src/LU/PartialPivLU.h" 24 | #ifdef EIGEN_USE_LAPACKE 25 | #include "src/LU/PartialPivLU_MKL.h" 26 | #endif 27 | #include "src/LU/Determinant.h" 28 | #include "src/LU/Inverse.h" 29 | 30 | #if defined EIGEN_VECTORIZE_SSE 31 | #include "src/LU/arch/Inverse_SSE.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/LU.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_LU_MODULE_H 41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 42 | -------------------------------------------------------------------------------- /algorithm/eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 2 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup UmfPackSupport_Module UmfPackSupport module 14 | * 15 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 16 | * It provides the following factorization class: 17 | * - class UmfPackLU: a multifrontal sequential LU factorization. 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | * 23 | * 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. 24 | * The dependencies depend on how umfpack has been compiled. 25 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 26 | * 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/UmfPackSupport/UmfPackSupport.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 37 | -------------------------------------------------------------------------------- /algorithm/FreeImage/CFreeImage.h: -------------------------------------------------------------------------------- 1 | #ifndef __IMAGE_LOADER_H__ 2 | #define __IMAGE_LOADER_H__ 3 | 4 | #include 5 | class CFreeImage 6 | { 7 | public: 8 | CFreeImage(); 9 | CFreeImage(const CFreeImage& other); 10 | ~CFreeImage(); 11 | 12 | bool load(const char* filename); 13 | bool save(const char* filename)const; 14 | 15 | int width()const{return _width;} 16 | int height()const{return _height;} 17 | int nChannels()const{return _nChannels;} 18 | 19 | /** 20 | * if numChannels == 3 or 4, then return BGR or BGRA format 21 | * */ 22 | const unsigned char* getBits()const{return _bits.data();} 23 | unsigned char* getBits(){return _bits.data();} 24 | const unsigned char* rowPtr(int y)const{return _bits.data()+y*_width*_nChannels;} 25 | 26 | /** 27 | * if numChannels == 3 or 4, then return BGR or BGRA format 28 | * */ 29 | void createImage(int width, int height, int nChannels, const unsigned char* bits=0); 30 | 31 | enum ResizeType 32 | { 33 | Bilinear, 34 | Lanczos3,//bugs now... 35 | }; 36 | bool ResizeImage(CFreeImage& dst, int w, int h, ResizeType type)const; 37 | 38 | void rgb2bgr(); 39 | 40 | void clear(); 41 | private: 42 | std::vector _bits; 43 | int _width, _height, _nChannels; 44 | };//ImageLoader 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | #endif//__IMAGE_LOADER_H__ -------------------------------------------------------------------------------- /DynamicFusionUI.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.21005.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DynamicFusionUI", "DynamicFusionUI.vcxproj", "{B12702AD-ABFB-343A-A199-8E24837244A3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Debug|x64 = Debug|x64 12 | Release|Win32 = Release|Win32 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|Win32.Build.0 = Debug|Win32 18 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.ActiveCfg = Debug|x64 19 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Debug|x64.Build.0 = Debug|x64 20 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.ActiveCfg = Release|Win32 21 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|Win32.Build.0 = Release|Win32 22 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.ActiveCfg = Release|x64 23 | {B12702AD-ABFB-343A-A199-8E24837244A3}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | EndGlobal 29 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/CudaCholeskeySolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class CudaBsrMatrix; 9 | struct CudaCholeskeySolver_EigenContainter; 10 | class CudaCholeskeySolver 11 | { 12 | public: 13 | CudaCholeskeySolver(); 14 | ~CudaCholeskeySolver(); 15 | 16 | void init(); 17 | void clear(); 18 | 19 | // analysis the sparse pattern of A 20 | // if reorder, then a CPU-path reorder algorithm is performed 21 | // which needs cpu-gpu data copies. 22 | // but the fill-ins will be greatly reduced when factor 23 | void analysis(const CudaBsrMatrix* A, bool reorder = false); 24 | 25 | // numerical factorize 26 | void factor(); 27 | 28 | // solve for A*x = b 29 | void solve(float* x, const float* b); 30 | 31 | // since A = L*L' 32 | // this functions solves for L*u = b 33 | void solveL(float* u, const float* b); 34 | 35 | // this functions solves for L'*x = u 36 | void solveLt(float* x, const float* u); 37 | private: 38 | const CudaBsrMatrix* m_A; 39 | CudaBsrMatrix* m_A_csr; 40 | bool m_reorder; 41 | bool m_isAnalysied; 42 | bool m_isFactored; 43 | bool m_isInited; 44 | 45 | cusolverSpHandle_t m_handle; 46 | csrcholInfo_t m_info; 47 | DeviceArray m_workSpace; 48 | 49 | CudaCholeskeySolver_EigenContainter* m_container; 50 | }; 51 | 52 | -------------------------------------------------------------------------------- /RayCastViewer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "Camera.h" 5 | #include "definations.h" 6 | class RayCastViewer : public QGLWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | RayCastViewer(QWidget *parent); 11 | ~RayCastViewer(); 12 | 13 | void initializeGL(); 14 | void resizeGL(int w, int h); 15 | void paintGL(); 16 | 17 | void setId(int id){ m_id = id; } 18 | 19 | void setRayCastingShadingImage(const dfusion::ColorMap& img); 20 | 21 | void setSameView(const RayCastViewer* other); 22 | 23 | const int getId()const{ return m_id; } 24 | 25 | void getCameraInfo(Camera& cam)const; 26 | void setCameraInfo(const Camera& cam); 27 | protected: 28 | void mousePressEvent(QMouseEvent *); 29 | void mouseReleaseEvent(QMouseEvent *); 30 | void mouseMoveEvent(QMouseEvent*); 31 | void wheelEvent(QWheelEvent*); 32 | void keyPressEvent(QKeyEvent*); 33 | 34 | void renderRayCasting(); 35 | protected: 36 | // camera related 37 | int m_id; 38 | Camera m_camera; 39 | ldp::Float3 m_defaultCameraLocation; 40 | ldp::Float3 m_defaultCameraDirection; 41 | ldp::Float3 m_defaultCameraUp; 42 | Qt::MouseButtons m_buttons; 43 | QPoint m_lastPos, m_lastMousePressPos; 44 | ldp::Mat4f m_rootTrans, m_defaultRootTrans; 45 | float m_dataScale; 46 | 47 | QGLFunctions* m_gl_func; 48 | GLuint m_texture_id; 49 | PtrStepSz m_pbo_buffer; 50 | GLuint m_pbo_id; 51 | cudaGraphicsResource* m_pbo_cuda_res; 52 | }; -------------------------------------------------------------------------------- /algorithm/global_data_holder.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "util.h" 4 | #include "ObjMesh.h" 5 | #include "mpu\VolumeData.h" 6 | #include "MicrosoftKinect.h" 7 | #include "kinect_util.h" 8 | #include "TsdfVolume.h" 9 | #include "RayCaster.h" 10 | #include "MarchingCubes.h" 11 | #include "GpuMesh.h" 12 | #include "DynamicFusionParam.h" 13 | #include "DynamicFusionProcessor.h" 14 | #include "GpuKdTree.h" 15 | class GlobalDataHolder 16 | { 17 | public: 18 | void init(); 19 | 20 | static void saveDepth(const std::vector& depth_h, std::string filename); 21 | static void loadDepth(std::vector& depth_h, std::string filename); 22 | public: 23 | dfusion::DynamicFusionProcessor m_processor; 24 | Microsoft_Kinect m_kinect; 25 | dfusion::Param m_dparam; 26 | dfusion::LightSource m_lights; 27 | 28 | std::vector m_depth_h; 29 | std::vector m_color_h; 30 | dfusion::DepthMap m_depth_d; 31 | dfusion::ColorMap m_color_d; 32 | dfusion::ColorMap m_warpedview_shading; 33 | dfusion::ColorMap m_canoview_shading; 34 | dfusion::ColorMap m_errorMap_shading; 35 | 36 | // the following is used for debugging/visualizing loaded volumes. 37 | dfusion::RayCaster m_rayCaster; 38 | dfusion::MarchingCubes m_marchCube; 39 | dfusion::TsdfVolume m_volume; 40 | dfusion::GpuMesh m_mesh; 41 | private: 42 | mutable ldp::TimeStamp m_timeStamp; 43 | }; 44 | 45 | extern GlobalDataHolder g_dataholder; -------------------------------------------------------------------------------- /algorithm/BFGS/BFGSFit.h: -------------------------------------------------------------------------------- 1 | // ****************************************************** 2 | // Class BFGSFit 3 | // Solve the x in min{(Ax-B)^2} using BFGS 4 | // Author: Chen Cao 10/17/2013 5 | // ****************************************************** 6 | 7 | #pragma once 8 | 9 | // Include common 10 | #include "program.h" 11 | 12 | // Include Eigen 13 | #include 14 | #include 15 | 16 | namespace ldp 17 | { 18 | class BFGSFit : public Program 19 | { 20 | public: 21 | // Constructor, initialize 22 | BFGSFit ( int n, double* x, double* lb, double* ub, long int* btype, 23 | int m = defaultm, int maxiter = defaultmaxiter, 24 | double factr = defaultfactr, double pgtol = defaultpgtol ); 25 | void initialize (); 26 | 27 | // Access functions 28 | void setMatrix ( const Eigen::MatrixXf& A, const Eigen::VectorXf& B ); 29 | 30 | // Re-implemented functions 31 | virtual double computeObjective ( int n, double* x ); 32 | virtual void computeGradient ( int n, double* x, double* g ); 33 | virtual void iterCallback ( int t, double* x, double f ); 34 | 35 | protected: 36 | // Basic members 37 | std::vector mX; // Object 38 | std::vector mG; // Gradient 39 | 40 | const Eigen::MatrixXf* mA_P; // Matrix A's pointer 41 | const Eigen::VectorXf* mB_P; // Vector B's pointer 42 | 43 | Eigen::VectorXf mAx_B; // A * X - B 44 | Eigen::MatrixXf mAt; // At 45 | Eigen::VectorXf mAtAx_B; // At*(A*X-B) 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/MarchingCubes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "definations.h" 4 | #include "DynamicFusionParam.h" 5 | namespace dfusion 6 | { 7 | class GpuMesh; 8 | class TsdfVolume; 9 | class MarchingCubes 10 | { 11 | public: 12 | struct Tile 13 | { 14 | int3 begin; 15 | int3 end; 16 | float3 origion; 17 | float voxelSize; 18 | int level; // w.r.t. a voxel, volume.voxelSize< m_tiles; 44 | std::vector m_tiledMeshes; 45 | 46 | // buffered for each tile 47 | DeviceArray m_voxelVerts; 48 | DeviceArray m_voxelVertsScan; 49 | DeviceArray m_compVoxelArray; 50 | cudaTextureObject_t m_volTex; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/moderngpu/include/kernels/cubradixsort.cuh: -------------------------------------------------------------------------------- 1 | #include "device/deviceutil.cuh" 2 | #include "cub/cub.cuh" 3 | 4 | namespace mgpu { 5 | 6 | template 7 | bool CubRadixSort(Key* keys_global, Key* keys2_global, int count, int beginBit, 8 | int endBit, CudaContext& context) { 9 | 10 | cub::DoubleBuffer keys(keys_global, keys2_global); 11 | 12 | size_t tempBytes = 0; 13 | cub::DeviceRadixSort::SortKeys(0, tempBytes, keys, count, beginBit, endBit, 14 | context.Stream()); 15 | 16 | MGPU_MEM(byte) tempDevice = context.Malloc(tempBytes); 17 | 18 | cub::DeviceRadixSort::SortKeys(tempDevice->get(), tempBytes, keys, count, 19 | beginBit, endBit, context.Stream()); 20 | MGPU_SYNC_CHECK("cub::DeviceRadixSort::SortKeys"); 21 | 22 | return 1 == keys.selector; 23 | } 24 | 25 | template 26 | bool CubRadixSort(Key* keys_global, Key* keys2_global, Value* values_global, 27 | Value* values2_global, int count, int beginBit, int endBit, 28 | CudaContext& context) { 29 | 30 | cub::DoubleBuffer keys(keys_global, keys2_global); 31 | cub::DoubleBuffer values(values_global, values2_global); 32 | 33 | size_t tempBytes = 0; 34 | cub::DeviceRadixSort::SortPairs(0, tempBytes, keys, values, count, 35 | beginBit, endBit, context.Stream()); 36 | 37 | MGPU_MEM(byte) tempDevice = context.Malloc(tempBytes); 38 | 39 | cub::DeviceRadixSort::SortPairs(tempDevice->get(), tempBytes, keys, values, 40 | count, beginBit, endBit, context.Stream()); 41 | MGPU_SYNC_CHECK("cub::DeviceRadixSort::SortPairs"); 42 | 43 | return 1 == keys.selector; 44 | } 45 | 46 | } // namespace mgpu 47 | -------------------------------------------------------------------------------- /algorithm/eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_EIGENVALUES_MODULE_H 2 | #define EIGEN_EIGENVALUES_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | #include "LU" 12 | #include "Geometry" 13 | 14 | /** \defgroup Eigenvalues_Module Eigenvalues module 15 | * 16 | * 17 | * 18 | * This module mainly provides various eigenvalue solvers. 19 | * This module also provides some MatrixBase methods, including: 20 | * - MatrixBase::eigenvalues(), 21 | * - MatrixBase::operatorNorm() 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include "src/Eigenvalues/Tridiagonalization.h" 29 | #include "src/Eigenvalues/RealSchur.h" 30 | #include "src/Eigenvalues/EigenSolver.h" 31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 33 | #include "src/Eigenvalues/HessenbergDecomposition.h" 34 | #include "src/Eigenvalues/ComplexSchur.h" 35 | #include "src/Eigenvalues/ComplexEigenSolver.h" 36 | #include "src/Eigenvalues/RealQZ.h" 37 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 38 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 39 | #ifdef EIGEN_USE_LAPACKE 40 | #include "src/Eigenvalues/RealSchur_MKL.h" 41 | #include "src/Eigenvalues/ComplexSchur_MKL.h" 42 | #include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_EIGENVALUES_MODULE_H 48 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 49 | -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 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/misc/Solve.h" 38 | #include "src/misc/SparseSolve.h" 39 | #include "src/SparseCholesky/SimplicialCholesky.h" 40 | 41 | #ifndef EIGEN_MPL2_ONLY 42 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 48 | -------------------------------------------------------------------------------- /algorithm/eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 2 | #define EIGEN_PASTIXSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | extern "C" { 10 | #include 11 | #include 12 | } 13 | 14 | #ifdef complex 15 | #undef complex 16 | #endif 17 | 18 | /** \ingroup Support_modules 19 | * \defgroup PaStiXSupport_Module PaStiXSupport module 20 | * 21 | * This module provides an interface to the PaSTiX library. 22 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 23 | * It provides the two following main factorization classes: 24 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 25 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 26 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * 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. 33 | * The dependencies depend on how PaSTiX has been compiled. 34 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 35 | * 36 | */ 37 | 38 | #include "src/misc/Solve.h" 39 | #include "src/misc/SparseSolve.h" 40 | 41 | #include "src/PaStiXSupport/PaStiXSupport.h" 42 | 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 47 | -------------------------------------------------------------------------------- /algorithm/Renderable/GLNode.h: -------------------------------------------------------------------------------- 1 | #ifndef __NODE_H121__ 2 | #define __NODE_H121__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "Renderable.h" 8 | using namespace std; 9 | using namespace ldp; 10 | class AbstractMesh; 11 | class GLNode :public Renderable 12 | { 13 | public: 14 | GLNode(void); 15 | ~GLNode(void); 16 | 17 | /** 18 | * showType = MESH::SW_V,... 19 | * */ 20 | void render(int showType, int frameIndex=0); 21 | void renderConstColor(ldp::Float3 color)const; 22 | void renderChildrenAsIndex(int indexBegin)const; 23 | virtual int getMeshType()const{return TYPE_NODE;} 24 | 25 | void attach(GLNode& node); 26 | void attach(Renderable* mesh); 27 | 28 | void detachLastNode(); 29 | void detachLastMesh(); 30 | 31 | void detachAll(); 32 | void detachMesh(int i); 33 | 34 | int getNumChildMesh()const; 35 | int getNumChildNode()const; 36 | Renderable* getMesh(int i); 37 | Renderable* getLastMesh(); 38 | 39 | GLNode* getNode(int i); 40 | GLNode* getLastNode(); 41 | 42 | 43 | int getNumAllMeshes()const;//meshes of mine and my child-nodes 44 | 45 | //recursivly make index from meshes of mine and my child-nodes. 46 | void getMeshWithGlobalIndex(int index, Renderable** me, GLNode** fatherNode); 47 | 48 | void setTransMat(const ldp::Mat4f& tMat); 49 | ldp::Mat4f getTransMat()const; 50 | 51 | GLNode *getFatherNode(); 52 | private: 53 | void recurRenderIndex(int &ib)const; 54 | void recurGetMeshWithIdx(int &idx, Renderable** out, GLNode** fatherNode); 55 | protected: 56 | list _childNodes; 57 | vector _meshes; 58 | 59 | ldp::Mat4f _myTrans; 60 | GLNode *_fatherNode; 61 | }; 62 | 63 | #endif //__NODE_H__ 64 | -------------------------------------------------------------------------------- /algorithm/kdtree/AABB.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Mitsuba, a physically based rendering system. 3 | 4 | Copyright (c) 2007-2012 by Wenzel Jakob and others. 5 | 6 | Mitsuba is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License Version 3 8 | as published by the Free Software Foundation. 9 | 10 | Mitsuba is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #include "AABB.h" 20 | 21 | namespace ldp 22 | { 23 | namespace kdtree 24 | { 25 | 26 | 27 | Point AABB::getCorner(uint8_t corner) const { 28 | return Point(corner & 1 ? max[0] : min[0], 29 | corner & 2 ? max[1] : min[1], 30 | corner & 4 ? max[2] : min[2]); 31 | } 32 | 33 | 34 | bool AABB::overlaps(const BSphere &sphere) const { 35 | real distance = 0; 36 | for (int i = 0; i < 3; ++i) { 37 | if (sphere.center[i] < min[i]) { 38 | real d = sphere.center[i] - min[i]; 39 | distance += d*d; 40 | } 41 | else if (sphere.center[i] > max[i]) { 42 | real d = sphere.center[i] - max[i]; 43 | distance += d*d; 44 | } 45 | } 46 | return distance < sphere.radius*sphere.radius; 47 | } 48 | 49 | BSphere AABB::getBSphere() const { 50 | Point3 center = getCenter(); 51 | return BSphere(center, (center - max).length()); 52 | } 53 | 54 | }//namespace mitsuba 55 | 56 | }// namespace ldp 57 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 11 | #define EIGEN_TRIANGULAR_SOLVER2_H 12 | 13 | namespace Eigen { 14 | 15 | const unsigned int UnitDiagBit = UnitDiag; 16 | const unsigned int SelfAdjointBit = SelfAdjoint; 17 | const unsigned int UpperTriangularBit = Upper; 18 | const unsigned int LowerTriangularBit = Lower; 19 | 20 | const unsigned int UpperTriangular = Upper; 21 | const unsigned int LowerTriangular = Lower; 22 | const unsigned int UnitUpperTriangular = UnitUpper; 23 | const unsigned int UnitLowerTriangular = UnitLower; 24 | 25 | template 26 | template 27 | typename ExpressionType::PlainObject 28 | Flagged::solveTriangular(const MatrixBase& other) const 29 | { 30 | return m_matrix.template triangularView().solve(other.derived()); 31 | } 32 | 33 | template 34 | template 35 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 36 | { 37 | m_matrix.template triangularView().solveInPlace(other.derived()); 38 | } 39 | 40 | } // end namespace Eigen 41 | 42 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 43 | -------------------------------------------------------------------------------- /algorithm/eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 2 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | 7 | #include "src/Core/util/DisableStupidWarnings.h" 8 | 9 | /** 10 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 11 | * 12 | * 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. 13 | * Those solvers are accessible via the following classes: 14 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 15 | * - BiCGSTAB for general square matrices. 16 | * 17 | * These iterative solvers are associated with some preconditioners: 18 | * - IdentityPreconditioner - not really useful 19 | * - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices. 20 | * - IncompleteILUT - incomplete LU factorization with dual thresholding 21 | * 22 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 33 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 34 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 35 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 36 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 41 | -------------------------------------------------------------------------------- /algorithm/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 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 http://mozilla.org/MPL/2.0/. 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 | for (Index j=0; j 28 | typename internal::traits >::Scalar 29 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 30 | { 31 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 32 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 33 | } 34 | 35 | template 36 | typename internal::traits >::Scalar 37 | SparseVector<_Scalar,_Options,_Index>::sum() const 38 | { 39 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 40 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN_SPARSEREDUX_H 46 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/ModerGpuWrapper.cu: -------------------------------------------------------------------------------- 1 | #include "ModerGpuWrapper.h" 2 | #include "moderngpu\include\util\mgpucontext.h" 3 | #include "moderngpu\include\moderngpu.cuh" 4 | #include 5 | #include 6 | #include 7 | using namespace mgpu; 8 | 9 | 10 | namespace modergpu_wrapper 11 | { 12 | ContextPtr g_context; 13 | 14 | static void create_context() 15 | { 16 | if (g_context.get() == nullptr) 17 | g_context = CreateCudaDevice(0); 18 | } 19 | 20 | void mergesort(int* val, int count) 21 | { 22 | create_context(); 23 | MergesortKeys(val, count, *g_context); 24 | } 25 | 26 | void mergesort(float* val, int count) 27 | { 28 | create_context(); 29 | MergesortKeys(val, count, *g_context); 30 | } 31 | 32 | void mergesort_by_key(int* keys_global, int* values_global, int count) 33 | { 34 | create_context(); 35 | MergesortPairs(keys_global, values_global, count, *g_context); 36 | } 37 | void mergesort_by_key(int* keys_global, float* values_global, int count) 38 | { 39 | create_context(); 40 | MergesortPairs(keys_global, values_global, count, *g_context); 41 | } 42 | void mergesort_by_key(float* keys_global, int* values_global, int count) 43 | { 44 | create_context(); 45 | MergesortPairs(keys_global, values_global, count, *g_context); 46 | } 47 | void mergesort_by_key(float* keys_global, float* values_global, int count) 48 | { 49 | create_context(); 50 | MergesortPairs(keys_global, values_global, count, *g_context); 51 | } 52 | void mergesort_by_key(int* keys_global, float4* values_global, int count) 53 | { 54 | create_context(); 55 | MergesortPairs(keys_global, values_global, count, *g_context); 56 | } 57 | 58 | void inclusive_scan_by_key(int* key_d, float4* value_d, float4* dst_d, int n) 59 | { 60 | 61 | } 62 | } -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MEMORY_H 11 | #define EIGEN2_MEMORY_H 12 | 13 | namespace Eigen { 14 | 15 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 16 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 17 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 18 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 19 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 20 | 21 | template inline void* ei_conditional_aligned_malloc(size_t size) 22 | { 23 | return internal::conditional_aligned_malloc(size); 24 | } 25 | template inline void ei_conditional_aligned_free(void *ptr) 26 | { 27 | internal::conditional_aligned_free(ptr); 28 | } 29 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 30 | { 31 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 32 | } 33 | 34 | template inline T* ei_aligned_new(size_t size) 35 | { 36 | return internal::aligned_new(size); 37 | } 38 | template inline void ei_aligned_delete(T *ptr, size_t size) 39 | { 40 | return internal::aligned_delete(ptr, size); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN2_MACROS_H 46 | -------------------------------------------------------------------------------- /algorithm/eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 2 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup CholmodSupport_Module CholmodSupport module 14 | * 15 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 16 | * It provides the two following main factorization classes: 17 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 18 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 19 | * 20 | * For the sake of completeness, this module also propose the two following classes: 21 | * - class CholmodSimplicialLLT 22 | * - class CholmodSimplicialLDLT 23 | * Note that these classes does not bring any particular advantage compared to the built-in 24 | * SimplicialLLT and SimplicialLDLT factorization classes. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * 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. 31 | * The dependencies depend on how cholmod has been compiled. 32 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/misc/Solve.h" 37 | #include "src/misc/SparseSolve.h" 38 | 39 | #include "src/CholmodSupport/CholmodSupport.h" 40 | 41 | 42 | #include "src/Core/util/ReenableStupidWarnings.h" 43 | 44 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 45 | 46 | -------------------------------------------------------------------------------- /algorithm/Renderable/AbstractMesh.cpp: -------------------------------------------------------------------------------- 1 | #include "AbstractMesh.h" 2 | #include "Error.h" 3 | 4 | const Float3 AbstractMesh::SELECT_COLOR = Float3(175.f/255.f,175.f/255.f,48.f/255.f); 5 | const Float3 AbstractMesh::NON_SEL_COLOR = Float3(0.0f,0.0f,0.0f); 6 | AbstractMesh::AbstractMesh(void):Renderable() 7 | { 8 | } 9 | 10 | AbstractMesh::~AbstractMesh(void) 11 | { 12 | } 13 | 14 | void AbstractMesh::getNormals(vector& store)const 15 | { 16 | if(normals.size()==0) 17 | { 18 | Logger::warning("Empty Normals, In TriMesh::getNormals()\n"); 19 | return; 20 | } 21 | if(store.size() != this->normals.size()) 22 | store.resize(normals.size()); 23 | memcpy(&store[0], &normals[0], normals.size()*sizeof(normals[0])); 24 | } 25 | void AbstractMesh::getVertices(vector& store)const 26 | { 27 | if(vertices.size()==0) 28 | { 29 | Logger::warning("Empty Mesh, In TriMesh::getVertices()\n"); 30 | return; 31 | } 32 | if(store.size() != this->vertices.size()) 33 | store.resize(vertices.size()); 34 | memcpy(&store[0], &vertices[0], vertices.size()*sizeof(vertices[0])); 35 | } 36 | 37 | void AbstractMesh::setVertices(const vector& input, bool isNormalsGen) 38 | { 39 | if(input.size() != this->vertices.size()) 40 | { 41 | vertices.resize(input.size()); 42 | isVertSelected.resize(input.size()); 43 | colors.resize(input.size()); 44 | } 45 | memcpy(&vertices[0], &input[0], vertices.size()*sizeof(vertices[0])); 46 | memset(&isVertSelected[0], 0, isVertSelected.size()*sizeof(isVertSelected[0])); 47 | for(int i=0; i<(int)colors.size(); i++) 48 | colors[i] = AbstractMesh::NON_SEL_COLOR; 49 | 50 | if(isNormalsGen) 51 | { 52 | generateNormals(); 53 | } 54 | } 55 | 56 | void AbstractMesh::setVertexSelected(int i, bool select) 57 | { 58 | isVertSelected[i]=(select ? 1:0); 59 | if(isVertSelected[i]) colors[i] = SELECT_COLOR; 60 | else colors[i] = NON_SEL_COLOR; 61 | } -------------------------------------------------------------------------------- /algorithm/eigen/Geometry: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_GEOMETRY_MODULE_H 2 | #define EIGEN_GEOMETRY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SVD" 9 | #include "LU" 10 | #include 11 | 12 | #ifndef M_PI 13 | #define M_PI 3.14159265358979323846 14 | #endif 15 | 16 | /** \defgroup Geometry_Module Geometry module 17 | * 18 | * 19 | * 20 | * This module provides support for: 21 | * - fixed-size homogeneous transformations 22 | * - translation, scaling, 2D and 3D rotations 23 | * - quaternions 24 | * - \ref MatrixBase::cross() "cross product" 25 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" 26 | * - some linear components: parametrized-lines and hyperplanes 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #include "src/Geometry/OrthoMethods.h" 34 | #include "src/Geometry/EulerAngles.h" 35 | 36 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 37 | #include "src/Geometry/Homogeneous.h" 38 | #include "src/Geometry/RotationBase.h" 39 | #include "src/Geometry/Rotation2D.h" 40 | #include "src/Geometry/Quaternion.h" 41 | #include "src/Geometry/AngleAxis.h" 42 | #include "src/Geometry/Transform.h" 43 | #include "src/Geometry/Translation.h" 44 | #include "src/Geometry/Scaling.h" 45 | #include "src/Geometry/Hyperplane.h" 46 | #include "src/Geometry/ParametrizedLine.h" 47 | #include "src/Geometry/AlignedBox.h" 48 | #include "src/Geometry/Umeyama.h" 49 | 50 | #if defined EIGEN_VECTORIZE_SSE 51 | #include "src/Geometry/arch/Geometry_SSE.h" 52 | #endif 53 | #endif 54 | 55 | #ifdef EIGEN2_SUPPORT 56 | #include "src/Eigen2Support/Geometry/All.h" 57 | #endif 58 | 59 | #include "src/Core/util/ReenableStupidWarnings.h" 60 | 61 | #endif // EIGEN_GEOMETRY_MODULE_H 62 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 63 | 64 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/thrust_wrapper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace thrust_wrapper 9 | { 10 | void sort_by_key(int* key_d, float4* value_d, int n); 11 | void sort_by_key(float* key_d, int* value_d, int n); 12 | void sort_by_key(int* key_d, int* value_d, int n); 13 | void sort_by_key(int* key_d, float* value_d, int n); 14 | 15 | void stable_sort_by_key(int* key_d, float4* value_d, int n); 16 | void stable_sort_by_key(float* key_d, int* value_d, int n); 17 | 18 | void exclusive_scan(const int* in, int* out, int n); 19 | void exclusive_scan(const unsigned int* in, unsigned int* out, int n); 20 | 21 | void inclusive_scan_by_key(int* key_d, float4* value_d, float4* dst_d, int n); 22 | 23 | size_t unique_by_key(int* key_d, float4* value_d, int n); 24 | 25 | // the input value are counting iterators from @input_count_begin 26 | size_t unique_counting_by_key_copy(const int* key_d, int input_count_begin, 27 | int* out_key_d, int* out_value_d, int n); 28 | 29 | // out[map[i]] = in[i]; 30 | void scatter(const int* in_d, const int* map_d, int* out_d, int n); 31 | 32 | // out[i] = in[map[i]) 33 | void gather(const int* in_d, const int* map_d, int* out_d, int n); 34 | void gather(const float4* in_d, const int* map_d, float4* out_d, int n); 35 | 36 | // xyzwxyzw...xyzw -> xxx...yyy...zzz 37 | void seperate_channels(const float4* xyzw_d, float* x_d, float* y_d, float* z_d, int n); 38 | 39 | // ptr_d[i] = begin+i 40 | void make_counting_array(int* ptr_d, int n, int begin=0); 41 | 42 | void copy(int* dst, const int* src, int size); 43 | void copy(float* dst, const float* src, int size); 44 | 45 | // ptr_d[i] = value 46 | void assign(int* ptr_d, int value, int n); 47 | void assign(float* ptr_d, float value, int n); 48 | void assign(float4* ptr_d, float4 value, int n); 49 | } -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 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 | #include "src/misc/Solve.h" 24 | #include "src/misc/SparseSolve.h" 25 | 26 | // Ordering interface 27 | #include "OrderingMethods" 28 | 29 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 30 | 31 | #include "src/SparseLU/SparseLU_Structs.h" 32 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 33 | #include "src/SparseLU/SparseLUImpl.h" 34 | #include "src/SparseCore/SparseColEtree.h" 35 | #include "src/SparseLU/SparseLU_Memory.h" 36 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_relax_snode.h" 38 | #include "src/SparseLU/SparseLU_pivotL.h" 39 | #include "src/SparseLU/SparseLU_panel_dfs.h" 40 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 41 | #include "src/SparseLU/SparseLU_panel_bmod.h" 42 | #include "src/SparseLU/SparseLU_column_dfs.h" 43 | #include "src/SparseLU/SparseLU_column_bmod.h" 44 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 45 | #include "src/SparseLU/SparseLU_pruneL.h" 46 | #include "src/SparseLU/SparseLU_Utils.h" 47 | #include "src/SparseLU/SparseLU.h" 48 | 49 | #endif // EIGEN_SPARSELU_MODULE_H 50 | -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 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 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/SparseVolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "definations.h" 4 | 5 | #include "voxelhash\voxel_hashing_internal.h" 6 | #include 7 | #include "voxelhash\chunk.h" 8 | 9 | namespace dfusion 10 | { 11 | class SparseVolume 12 | { 13 | friend class DynamicFusionProcessor; 14 | public: 15 | SparseVolume(); 16 | ~SparseVolume(); 17 | 18 | void init(int3 resolution, float voxel_size, float3 origion); 19 | 20 | /** 21 | set the size of each voxel 22 | */ 23 | void setVoxelSize(float voxel_size); 24 | float getVoxelSize()const{ return voxel_size_; } 25 | float getBlockSize()const{ return getVoxelSize()*BLOCK_DIM; } 26 | 27 | /** \brief Sets Tsdf truncation distance. Must be greater than 2 * volume_voxel_size 28 | * \param[in] distance TSDF truncation distance 29 | */ 30 | void setTsdfTruncDist(float distance); 31 | float getTsdfTruncDist()const{ return tranc_dist_; } 32 | 33 | protected: 34 | void allocate(int3 resolution, float voxel_size, float3 origion); 35 | private: 36 | float voxel_size_; 37 | float3 origion_; 38 | int3 resolution_; 39 | float tranc_dist_; 40 | 41 | int hash_entry_size_; 42 | int voxel_block_size_; 43 | int voxel_block_number_; 44 | int selected_hash_entry_number_; 45 | int selected_voxel_block_number_; 46 | float active_region_offset_; 47 | float active_region_radius_; 48 | DeviceArray hash_entry_; 49 | DeviceArray selected_hash_entry_; 50 | DeviceArray voxel_block_; 51 | DeviceArray voxel_block_buffer_; 52 | DeviceArray hash_bucket_atomic_lock_; 53 | DeviceArray available_voxel_block_; 54 | DeviceArray hash_parameters_; 55 | thrust::device_vector hash_entry_scan_; 56 | DeviceArray delete_hash_entry_; 57 | DeviceArray chunk_on_CPU_; 58 | DeviceArray selected_voxel_block_vertex_list_; 59 | std::vector chunk_; 60 | std::vector selected_hash_entry_h_; 61 | std::vector voxel_block_buffer_h_; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/QR.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) 2011 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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_QR_H 12 | #define EIGEN2_QR_H 13 | 14 | namespace Eigen { 15 | 16 | template 17 | class QR : public HouseholderQR 18 | { 19 | public: 20 | 21 | typedef HouseholderQR Base; 22 | typedef Block MatrixRBlockType; 23 | 24 | QR() : Base() {} 25 | 26 | template 27 | explicit QR(const T& t) : Base(t) {} 28 | 29 | template 30 | bool solve(const MatrixBase& b, ResultType *result) const 31 | { 32 | *result = static_cast(this)->solve(b); 33 | return true; 34 | } 35 | 36 | MatrixType matrixQ(void) const { 37 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 38 | ret = this->householderQ() * ret; 39 | return ret; 40 | } 41 | 42 | bool isFullRank() const { 43 | return true; 44 | } 45 | 46 | const TriangularView 47 | matrixR(void) const 48 | { 49 | int cols = this->cols(); 50 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 51 | } 52 | }; 53 | 54 | /** \return the QR decomposition of \c *this. 55 | * 56 | * \sa class QR 57 | */ 58 | template 59 | const QR::PlainObject> 60 | MatrixBase::qr() const 61 | { 62 | return QR(eval()); 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN2_QR_H 68 | -------------------------------------------------------------------------------- /algorithm/eigen/SparseCore: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECORE_MODULE_H 2 | #define EIGEN_SPARSECORE_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * \defgroup SparseCore_Module SparseCore module 16 | * 17 | * This module provides a sparse matrix representation, and basic associatd matrix manipulations 18 | * and operations. 19 | * 20 | * See the \ref TutorialSparse "Sparse tutorial" 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * This module depends on: Core. 27 | */ 28 | 29 | namespace Eigen { 30 | 31 | /** The type used to identify a general sparse storage. */ 32 | struct Sparse {}; 33 | 34 | } 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/CompressedStorage.h" 39 | #include "src/SparseCore/AmbiVector.h" 40 | #include "src/SparseCore/SparseMatrix.h" 41 | #include "src/SparseCore/MappedSparseMatrix.h" 42 | #include "src/SparseCore/SparseVector.h" 43 | #include "src/SparseCore/SparseBlock.h" 44 | #include "src/SparseCore/SparseTranspose.h" 45 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 46 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 47 | #include "src/SparseCore/SparseDot.h" 48 | #include "src/SparseCore/SparsePermutation.h" 49 | #include "src/SparseCore/SparseRedux.h" 50 | #include "src/SparseCore/SparseFuzzy.h" 51 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 52 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 53 | #include "src/SparseCore/SparseProduct.h" 54 | #include "src/SparseCore/SparseDenseProduct.h" 55 | #include "src/SparseCore/SparseDiagonalProduct.h" 56 | #include "src/SparseCore/SparseTriangularView.h" 57 | #include "src/SparseCore/SparseSelfAdjointView.h" 58 | #include "src/SparseCore/TriangularSolver.h" 59 | #include "src/SparseCore/SparseView.h" 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | #endif // EIGEN_SPARSECORE_MODULE_H 64 | 65 | -------------------------------------------------------------------------------- /algorithm/eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 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 | // 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 http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing common coefficient wise functions. 12 | 13 | /** \returns an expression of the difference of \c *this and \a other 14 | * 15 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 16 | * 17 | * \sa class CwiseBinaryOp, operator-=() 18 | */ 19 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 20 | 21 | /** \returns an expression of the sum of \c *this and \a other 22 | * 23 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 24 | * 25 | * \sa class CwiseBinaryOp, operator+=() 26 | */ 27 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 28 | 29 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 30 | * 31 | * The template parameter \a CustomBinaryOp is the type of the functor 32 | * of the custom operator (see class CwiseBinaryOp for an example) 33 | * 34 | * Here is an example illustrating the use of custom functors: 35 | * \include class_CwiseBinaryOp.cpp 36 | * Output: \verbinclude class_CwiseBinaryOp.out 37 | * 38 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 39 | */ 40 | template 41 | EIGEN_STRONG_INLINE const CwiseBinaryOp 42 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 43 | { 44 | return CwiseBinaryOp(derived(), other.derived(), func); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /algorithm/kdtree/common.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ldpMat\ldp_basic_mat.h" 4 | #include "ldpMat\Quaternion.h" 5 | 6 | #include "camera\Camera.h" 7 | #include 8 | 9 | #undef min 10 | #undef max 11 | namespace ldp 12 | { 13 | namespace kdtree 14 | { 15 | typedef float real; 16 | typedef ldp_basic_vec2 Vec2; 17 | typedef ldp_basic_vec3 Vec3; 18 | typedef ldp_basic_vec4 Vec4; 19 | typedef float Float; 20 | typedef Vec3 vector3; 21 | typedef Vec4 Color; 22 | typedef Vec3 Point; 23 | typedef Point Point3; 24 | typedef unsigned int Pixel; 25 | typedef unsigned char uint8_t; 26 | typedef unsigned int uint32_t; 27 | typedef unsigned short uint16_t; 28 | typedef unsigned long long uint64_t; 29 | typedef long long int64_t; 30 | 31 | #define FINLINE __forceinline 32 | 33 | #define SAMPLES 128 34 | #define TRACEDEPTH 4 35 | #define MAXTREEDEPTH 20 36 | #define IMPORTANCE 37 | #define TILESIZE 64 38 | #define MAX_THREADS 8 39 | 40 | // Intersection method return values 41 | #define HIT 1 // Ray hit primitive 42 | #define MISS 0 // Ray missed primitive 43 | #define INPRIM -1 // Ray started inside primitive 44 | 45 | #define MAXLIGHTS 10 46 | 47 | #ifndef LDP_DEFINE_VECTOR_DOUBLE_PRECISION 48 | #define EPSILON 0.0001f 49 | #else 50 | #define EPSILON 0.0000001f 51 | #endif 52 | 53 | #define DOT(A,B) (A.dot(B)) 54 | #define NORMALIZE(A) {A.normalizeLocal();} 55 | #define LENGTH(A) (A.length()) 56 | #define SQRLENGTH(A) (A.sqrLength()) 57 | #define SQRDISTANCE(A,B) (A.sqrDist(B)) 58 | 59 | #define PI 3.141592653589793238462f 60 | 61 | static std::string fullNameToPath(const char* name) 62 | { 63 | // get file path 64 | std::string scenePath = name; 65 | int pos1 = scenePath.find_last_of("\\"); 66 | if (!(pos1 >= 0 && pos1 < (int)scenePath.size())) 67 | pos1 = 0; 68 | int pos2 = scenePath.find_last_of("/"); 69 | if (!(pos2 >= 0 && pos2 < (int)scenePath.size())) 70 | pos2 = 0; 71 | int pos = std::max(pos1, pos2); 72 | if (pos) pos++; 73 | scenePath = scenePath.substr(0, pos); 74 | return scenePath; 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /algorithm/eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 2 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #ifdef EMPTY 9 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 10 | #endif 11 | 12 | typedef int int_t; 13 | #include 14 | #include 15 | #include 16 | 17 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 18 | // so we remove it in favor of a SUPERLU_EMPTY token. 19 | // If EMPTY was already defined then we don't undef it. 20 | 21 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 22 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 23 | #elif defined(EMPTY) 24 | # undef EMPTY 25 | #endif 26 | 27 | #define SUPERLU_EMPTY (-1) 28 | 29 | namespace Eigen { struct SluMatrix; } 30 | 31 | /** \ingroup Support_modules 32 | * \defgroup SuperLUSupport_Module SuperLUSupport module 33 | * 34 | * This module provides an interface to the SuperLU library. 35 | * It provides the following factorization class: 36 | * - class SuperLU: a supernodal sequential LU factorization. 37 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 38 | * 39 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 40 | * 41 | * \code 42 | * #include 43 | * \endcode 44 | * 45 | * 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. 46 | * The dependencies depend on how superlu has been compiled. 47 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 48 | * 49 | */ 50 | 51 | #include "src/misc/Solve.h" 52 | #include "src/misc/SparseSolve.h" 53 | 54 | #include "src/SuperLUSupport/SuperLUSupport.h" 55 | 56 | 57 | #include "src/Core/util/ReenableStupidWarnings.h" 58 | 59 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 60 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/kinect_util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "definations.h" 4 | class ObjMesh; 5 | namespace dfusion 6 | { 7 | 8 | /** ********************************************************************** 9 | * function utils 10 | * ***********************************************************************/ 11 | void mapsToObj(ObjMesh& mesh, const dfusion::MapArr& vmap, const dfusion::MapArr& nmap); 12 | 13 | // jet_Rgb_d = jet((depth_d-shift)/div) 14 | void calc_temperature_jet(PtrStepSz depth_d, PtrStepSz jetRgb_d, float shift, float div); 15 | 16 | // shading 17 | void generateImage(const MapArr& vmap, const MapArr& nmap, ColorMap& dst, const LightSource& light); 18 | 19 | // normal to color 20 | void generateNormalMap(const MapArr& nmap, ColorMap& dst, Mat33 R); 21 | void generateNormalMap(const MapArr& nmap, ColorMap& dst); 22 | 23 | // a simple copy function 24 | void copyColorMapToPbo(PtrStepSz src, PtrStepSz dst); 25 | 26 | // depth map smoothing 27 | void bilateralFilter(const DepthMap& src, DepthMap& dst); 28 | 29 | // compute vertex/normal from kinect depth 30 | void createVMap(const Intr& intr, const DepthMap& depth, MapArr& vmap); 31 | void createNMap(const MapArr& vmap, MapArr& nmap); 32 | 33 | // /2 scale 34 | void pyrDown(const DepthMap& src, DepthMap& dst); 35 | 36 | void resizeVMap(const MapArr& input, MapArr& output); 37 | void resizeNMap(const MapArr& input, MapArr& output); 38 | 39 | // 40 | void rigidTransform(MapArr& vmap, MapArr& nmap, Tbx::Transfo T); 41 | 42 | // estimate rigid transform Ax=b 43 | void estimateCombined(const Mat33& Rcurr, const float3& tcurr, 44 | const MapArr& vmap_curr, const MapArr& nmap_curr, 45 | const Mat33& Rprev, const float3& tprev, const Intr& intr, 46 | const MapArr& vmap_prev, const MapArr& nmap_prev, 47 | float distThres, float angleThres, 48 | DeviceArray2D& gbuf, DeviceArray& mbuf, 49 | float* matrixA_host, float* vectorB_host); 50 | 51 | // 52 | void computeErrorMap(const MapArr& vmap_live, const MapArr& nmap_live, 53 | const MapArr& vmap_warp, const MapArr& nmap_warp, ColorMap& errMap, 54 | Intr intr, float errMap_range, float distThre, float angleThre_sin); 55 | } -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/CoreIterators.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 | // 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_COREITERATORS_H 11 | #define EIGEN_COREITERATORS_H 12 | 13 | namespace Eigen { 14 | 15 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 16 | */ 17 | 18 | /** \ingroup SparseCore_Module 19 | * \class InnerIterator 20 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 21 | * 22 | * todo 23 | */ 24 | 25 | // generic version for dense matrix and expressions 26 | template class DenseBase::InnerIterator 27 | { 28 | protected: 29 | typedef typename Derived::Scalar Scalar; 30 | typedef typename Derived::Index Index; 31 | 32 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 33 | public: 34 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 35 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 36 | {} 37 | 38 | EIGEN_STRONG_INLINE Scalar value() const 39 | { 40 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 41 | : m_expression.coeff(m_inner, m_outer); 42 | } 43 | 44 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 45 | 46 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 47 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 48 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 49 | 50 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 51 | 52 | protected: 53 | const Derived& m_expression; 54 | Index m_inner; 55 | const Index m_outer; 56 | const Index m_end; 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_COREITERATORS_H 62 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/VoxelHash/voxel_hashing_utils.cu: -------------------------------------------------------------------------------- 1 | /***********************************************************/ 2 | /** \file 3 | \brief util functions that must be compiled in nvcc 4 | \details 5 | \author Yizhong Zhang 6 | \date 12/7/2013 7 | */ 8 | /***********************************************************/ 9 | #include 10 | 11 | #include "voxel_hashing_internal.h" 12 | 13 | 14 | /** 15 | alloc memory for gpu storage 16 | */ 17 | extern "C" 18 | void initMemoryc(thrust::device_vector& vec, int size){ 19 | vec.resize(size); 20 | } 21 | 22 | extern "C" 23 | void initMemoryf(thrust::device_vector& vec, int size){ 24 | vec.resize(size); 25 | } 26 | 27 | extern "C" 28 | void initMemoryi(thrust::device_vector& vec, int size){ 29 | vec.resize(size); 30 | } 31 | 32 | extern "C" 33 | void initMemoryull(thrust::device_vector& vec, int size){ 34 | vec.resize(size); 35 | } 36 | 37 | 38 | /** 39 | perform scan on a vector 40 | */ 41 | void scan_inclusive(thrust::device_vector& vec_d){ 42 | thrust::inclusive_scan(vec_d.begin(), vec_d.end(), vec_d.begin()); 43 | } 44 | 45 | void scan_exclusive(thrust::device_vector& vec_d){ 46 | thrust::exclusive_scan(vec_d.begin(), vec_d.end(), vec_d.begin()); 47 | } 48 | 49 | void scan_inclusive(thrust::device_vector& vec_d, int data_num){ 50 | if( data_num >= vec_d.size() ) 51 | thrust::inclusive_scan(vec_d.begin(), vec_d.end(), vec_d.begin()); 52 | else 53 | thrust::inclusive_scan(vec_d.begin(), vec_d.begin()+data_num, vec_d.begin()); 54 | } 55 | 56 | void scan_exclusive(thrust::device_vector& vec_d, int data_num){ 57 | if( data_num >= vec_d.size() ) 58 | thrust::exclusive_scan(vec_d.begin(), vec_d.end(), vec_d.begin()); 59 | else 60 | thrust::exclusive_scan(vec_d.begin(), vec_d.begin()+data_num, vec_d.begin()); 61 | } 62 | 63 | extern "C" 64 | void scan_inclusiveull(thrust::device_vector& vec_d){ 65 | thrust::inclusive_scan(vec_d.begin(), vec_d.end(), vec_d.begin()); 66 | } 67 | 68 | extern "C" 69 | void scan_exclusiveull(thrust::device_vector& vec_d){ 70 | thrust::exclusive_scan(vec_d.begin(), vec_d.end(), vec_d.begin()); 71 | } 72 | 73 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseCore/CoreIterators.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 | // 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_COREITERATORS_H 11 | #define EIGEN_COREITERATORS_H 12 | 13 | namespace Eigen { 14 | 15 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 16 | */ 17 | 18 | /** \ingroup SparseCore_Module 19 | * \class InnerIterator 20 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 21 | * 22 | * todo 23 | */ 24 | 25 | // generic version for dense matrix and expressions 26 | template class DenseBase::InnerIterator 27 | { 28 | protected: 29 | typedef typename Derived::Scalar Scalar; 30 | typedef typename Derived::Index Index; 31 | 32 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 33 | public: 34 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 35 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 36 | {} 37 | 38 | EIGEN_STRONG_INLINE Scalar value() const 39 | { 40 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 41 | : m_expression.coeff(m_inner, m_outer); 42 | } 43 | 44 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 45 | 46 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 47 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 48 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 49 | 50 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 51 | 52 | protected: 53 | const Derived& m_expression; 54 | Index m_inner; 55 | const Index m_outer; 56 | const Index m_end; 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_COREITERATORS_H 62 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // typedef that may be a reference type. 25 | // 279 - controlling expression is constant 26 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 27 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 28 | #pragma warning push 29 | #endif 30 | #pragma warning disable 2196 279 31 | #elif defined __clang__ 32 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 33 | // this is really a stupid warning as it warns on compile-time expressions involving enums 34 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 35 | #pragma clang diagnostic push 36 | #endif 37 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 38 | #endif 39 | 40 | #endif // not EIGEN_WARNINGS_DISABLED 41 | -------------------------------------------------------------------------------- /algorithm/Renderable/Renderable.h: -------------------------------------------------------------------------------- 1 | #ifndef __RENDERABLE_H__ 2 | #define __RENDERABLE_H__ 3 | 4 | #include "assert.h" 5 | #include "ldp_basic_mat.h" 6 | #include 7 | using ldp::Float3; 8 | class Renderable 9 | { 10 | public: 11 | Renderable() 12 | { 13 | _isEnabled = true; 14 | _isSelected = false; 15 | _name = "Renderable"; 16 | } 17 | virtual ~Renderable() 18 | { 19 | 20 | } 21 | public: 22 | const static int TYPE_GENERAL = 0x10000000; 23 | const static int TYPE_ABSTRACT = 0x10000001; 24 | const static int TYPE_TRIMESH = 0x10000002; 25 | const static int TYPE_QUADMESH = 0x10000003; 26 | const static int TYPE_POINTCLOUD = 0x10000004; 27 | const static int TYPE_OBJMESH = 0x10000005; 28 | const static int TYPE_NODE = 0x10000006; 29 | const static int TYPE_DEPTHIMAGE = 0x10000007; 30 | const static int TYPE_COLORIMAGE = 0x10000008; 31 | const static int TYPE_BMESH = 0x10000009; 32 | const static int TYPE_BONE_MESH = 0x10000010; 33 | 34 | //show type 35 | const static int SW_V = 0x00000001; 36 | const static int SW_E = 0x00000002; 37 | const static int SW_F = 0x00000004; 38 | const static int SW_N = 0x00000008; 39 | const static int SW_FLAT = 0x00000010; 40 | const static int SW_SMOOTH = 0x00000020; 41 | const static int SW_TEXTURE = 0x00000040; 42 | const static int SW_LIGHTING = 0x00000080; 43 | const static int SW_COLOR = 0x00000100; 44 | public: 45 | virtual void render(int showType, int frameIndex=0) =0; 46 | 47 | virtual void renderConstColor(Float3 color)const = 0; 48 | 49 | virtual int getMeshType()const{return TYPE_GENERAL;} 50 | 51 | virtual void clear(){assert(0 && "your child class should overload clear()");} 52 | 53 | bool isEnabled()const{ 54 | return _isEnabled; 55 | } 56 | 57 | void setEnabled(bool enable){ 58 | _isEnabled = enable; 59 | } 60 | 61 | bool isSelected()const{ 62 | return _isSelected; 63 | } 64 | 65 | void setSelected(bool enable){ 66 | _isSelected = enable; 67 | } 68 | 69 | void setName(const char* name) 70 | { 71 | _name = name; 72 | } 73 | 74 | const char* getName()const 75 | { 76 | return _name.c_str(); 77 | } 78 | protected: 79 | bool _isEnabled; 80 | bool _isSelected; 81 | std::string _name; 82 | }; 83 | 84 | 85 | 86 | 87 | 88 | #endif -------------------------------------------------------------------------------- /algorithm/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 http://mozilla.org/MPL/2.0/. 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 | Index 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 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/VoxelHash/voxel_hashing_device.h: -------------------------------------------------------------------------------- 1 | /***********************************************************/ 2 | /** \file 3 | \brief voxel hashing device functions 4 | \details 5 | \author Yizhong Zhang 6 | \date 12/7/2013 7 | */ 8 | /***********************************************************/ 9 | #ifndef __VOXEL_HASHING_DEVICE_H__ 10 | #define __VOXEL_HASHING_DEVICE_H__ 11 | 12 | #include "voxel_hashing_internal.h" 13 | 14 | /** 15 | hashing functions 16 | */ 17 | __host__ __device__ __forceinline__ int 18 | hashing_func(int x, int y, int z, int n) 19 | { 20 | const int p1 = 73856093; 21 | const int p2 = 19349669; 22 | const int p3 = 83492791; 23 | //return unsigned int( (x * p1) ^ (y * p2) ^ (z * p3) ) % n; 24 | return unsigned int( ((x+9973) * p1) ^ ((y+19997) * p2) ^ ((z+29989) * p3) ) % n; 25 | } 26 | 27 | __host__ __device__ __forceinline__ int 28 | hashing_func(int3 xyz, int n) 29 | { 30 | return hashing_func(xyz.x, xyz.y, xyz.z, n); 31 | } 32 | 33 | 34 | /** 35 | transform world coordinate x y z to block coordinate i j k 36 | */ 37 | __device__ __forceinline__ void 38 | coord2block(int& i, int& j, int& k, float x, float y, float z, float block_size) 39 | { 40 | i = __float2int_rd(x/block_size); 41 | j = __float2int_rd(y/block_size); 42 | k = __float2int_rd(z/block_size); 43 | } 44 | 45 | __device__ __forceinline__ int3 46 | coord2block(float x, float y, float z, float block_size) 47 | { 48 | int i, j, k; 49 | coord2block(i, j, k, x, y, z, block_size); 50 | return make_int3(i, j, k); 51 | } 52 | 53 | __device__ __forceinline__ int3 54 | coord2block(float3 xyz, float block_size) 55 | { 56 | return coord2block(xyz.x, xyz.y, xyz.z, block_size); 57 | } 58 | 59 | /** 60 | transform world coordinate x y z to voxel coordinate i j k 61 | */ 62 | __device__ __forceinline__ void 63 | coord2voxel(int& i, int& j, int& k, float x, float y, float z, float voxel_size) 64 | { 65 | i = __float2int_rd(x/voxel_size); 66 | j = __float2int_rd(y/voxel_size); 67 | k = __float2int_rd(z/voxel_size); 68 | } 69 | 70 | __device__ __forceinline__ int3 71 | coord2voxel(float x, float y, float z, float voxel_size) 72 | { 73 | int i, j, k; 74 | coord2voxel(i, j, k, x, y, z, voxel_size); 75 | return make_int3(i, j, k); 76 | } 77 | 78 | __device__ __forceinline__ int3 79 | coord2voxel(float3 xyz, float voxel_size) 80 | { 81 | return coord2voxel(xyz.x, xyz.y, xyz.z, voxel_size); 82 | } 83 | 84 | 85 | #endif -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_LAZY_H 11 | #define EIGEN_LAZY_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated it is only used by lazy() which is deprecated 16 | * 17 | * \returns an expression of *this with added flags 18 | * 19 | * Example: \include MatrixBase_marked.cpp 20 | * Output: \verbinclude MatrixBase_marked.out 21 | * 22 | * \sa class Flagged, extract(), part() 23 | */ 24 | template 25 | template 26 | inline const Flagged 27 | MatrixBase::marked() const 28 | { 29 | return derived(); 30 | } 31 | 32 | /** \deprecated use MatrixBase::noalias() 33 | * 34 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 35 | * 36 | * Example: \include MatrixBase_lazy.cpp 37 | * Output: \verbinclude MatrixBase_lazy.out 38 | * 39 | * \sa class Flagged, marked() 40 | */ 41 | template 42 | inline const Flagged 43 | MatrixBase::lazy() const 44 | { 45 | return derived(); 46 | } 47 | 48 | 49 | /** \internal 50 | * Overloaded to perform an efficient C += (A*B).lazy() */ 51 | template 52 | template 53 | Derived& MatrixBase::operator+=(const Flagged, 0, 54 | EvalBeforeAssigningBit>& other) 55 | { 56 | other._expression().derived().addTo(derived()); return derived(); 57 | } 58 | 59 | /** \internal 60 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 61 | template 62 | template 63 | Derived& MatrixBase::operator-=(const Flagged, 0, 64 | EvalBeforeAssigningBit>& other) 65 | { 66 | other._expression().derived().subTo(derived()); return derived(); 67 | } 68 | 69 | } // end namespace Eigen 70 | 71 | #endif // EIGEN_LAZY_H 72 | -------------------------------------------------------------------------------- /algorithm/eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 2 | #define EIGEN_ORDERINGMETHODS_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** 9 | * \defgroup OrderingMethods_Module OrderingMethods module 10 | * 11 | * This module is currently for internal use only 12 | * 13 | * It defines various built-in and external ordering methods for sparse matrices. 14 | * They are typically used to reduce the number of elements during 15 | * the sparse matrix decomposition (LLT, LU, QR). 16 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 17 | * those ordering methods and applied to the columns of the matrix. 18 | * Using for instance the sparse Cholesky decomposition, it is expected that 19 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 20 | * 21 | * 22 | * Usage : 23 | * \code 24 | * #include 25 | * \endcode 26 | * 27 | * A simple usage is as a template parameter in the sparse decomposition classes : 28 | * 29 | * \code 30 | * SparseLU > solver; 31 | * \endcode 32 | * 33 | * \code 34 | * SparseQR > solver; 35 | * \endcode 36 | * 37 | * It is possible as well to call directly a particular ordering method for your own purpose, 38 | * \code 39 | * AMDOrdering ordering; 40 | * PermutationMatrix perm; 41 | * SparseMatrix A; 42 | * //Fill the matrix ... 43 | * 44 | * ordering(A, perm); // Call AMD 45 | * \endcode 46 | * 47 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 48 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 49 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 50 | * If your matrix is already symmetric (at leat in structure), you can avoid that 51 | * by calling the method with a SelfAdjointView type. 52 | * 53 | * \code 54 | * // Call the ordering on the pattern of the lower triangular matrix A 55 | * ordering(A.selfadjointView(), perm); 56 | * \endcode 57 | */ 58 | 59 | #ifndef EIGEN_MPL2_ONLY 60 | #include "src/OrderingMethods/Amd.h" 61 | #endif 62 | 63 | #include "src/OrderingMethods/Ordering.h" 64 | #include "src/Core/util/ReenableStupidWarnings.h" 65 | 66 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 67 | -------------------------------------------------------------------------------- /algorithm/BFGS/BFGSFit.cpp: -------------------------------------------------------------------------------- 1 | // ****************************************************** 2 | // Class BFGSFit 3 | // Solve the x in min{(Ax-B)^2} using BFGS 4 | // Author: Chen Cao 10/17/2013 5 | // ****************************************************** 6 | 7 | #include "BFGSFit.h" 8 | 9 | using namespace ldp; 10 | 11 | // <-----------------------Public Functions-----------------------> 12 | 13 | ////////////////////////////////////////////////////////////////////////// 14 | // 15 | BFGSFit::BFGSFit( int n, double* x, double* lb, double* ub, long int* btype, 16 | int m /* = defaultm */, int maxiter /* = defaultmaxiter */, 17 | double factr /* = defaultfactr */, double pgtol /* = defaultpgtol */ ) 18 | : Program( n, x, lb, ub, btype, m, maxiter, factr, pgtol ) 19 | { 20 | initialize(); 21 | } 22 | 23 | void BFGSFit::initialize() 24 | { 25 | mX .clear(); 26 | mG .clear(); 27 | 28 | mA_P = NULL; 29 | mB_P = NULL; 30 | 31 | mAx_B .setZero( 0 ); 32 | mAt .setZero( 0, 0 ); 33 | mAtAx_B .setZero( 0 ); 34 | } 35 | // 36 | ////////////////////////////////////////////////////////////////////////// 37 | 38 | ////////////////////////////////////////////////////////////////////////// 39 | // 40 | void BFGSFit::setMatrix( const Eigen::MatrixXf& A, const Eigen::VectorXf& B ) 41 | { 42 | mA_P = &A; 43 | mB_P = &B; 44 | 45 | mAt = mA_P->transpose(); 46 | } 47 | // 48 | ////////////////////////////////////////////////////////////////////////// 49 | 50 | ////////////////////////////////////////////////////////////////////////// 51 | // 52 | double BFGSFit::computeObjective( int n, double* x ) 53 | { 54 | Eigen::VectorXf xVec( n ); 55 | for( int i=0; i 79 | ////////////////////////////////////////////////////////////////////////// 80 | 81 | // -------------------------------------------------------------------------------- /algorithm/global_data_holder.cpp: -------------------------------------------------------------------------------- 1 | #include "global_data_holder.h" 2 | #include 3 | GlobalDataHolder g_dataholder; 4 | using namespace ldp; 5 | 6 | void GlobalDataHolder::init() 7 | { 8 | m_kinect.InitKinect(); 9 | m_depth_h.resize(dfusion::KINECT_WIDTH*dfusion::KINECT_HEIGHT); 10 | m_color_h.resize(dfusion::KINECT_WIDTH*dfusion::KINECT_HEIGHT); 11 | m_depth_d.create(dfusion::KINECT_HEIGHT, dfusion::KINECT_WIDTH); 12 | m_color_d.create(dfusion::KINECT_WIDTH, dfusion::KINECT_HEIGHT); 13 | 14 | m_lights.pos = make_float3(0, 0, 0); 15 | m_lights.amb = make_float3(0.3, 0.3, 0.3); 16 | m_lights.diffuse = make_float3(0.8, 0.8, 0.8); 17 | m_lights.spec = make_float3(0, 0, 0); 18 | 19 | m_processor.init(m_dparam); 20 | } 21 | 22 | void GlobalDataHolder::saveDepth(const std::vector& depth_h, std::string filename) 23 | { 24 | if (depth_h.size() != dfusion::KINECT_WIDTH*dfusion::KINECT_HEIGHT) 25 | throw std::exception("saveDepth: size not matched!"); 26 | 27 | std::ofstream stm(filename, std::ios_base::binary); 28 | if (stm.fail()) 29 | throw std::exception(("save failed: "+ filename).c_str()); 30 | 31 | std::vector tmp(depth_h.size()); 32 | for (size_t i = 0; i < tmp.size(); i++) 33 | tmp[i] = depth_h[i]; 34 | 35 | int w = dfusion::KINECT_WIDTH; 36 | int h = dfusion::KINECT_HEIGHT; 37 | stm.write((const char*)&w, sizeof(int)); 38 | stm.write((const char*)&h, sizeof(int)); 39 | stm.write((const char*)tmp.data(), tmp.size()*sizeof(unsigned short)); 40 | 41 | stm.close(); 42 | } 43 | 44 | void GlobalDataHolder::loadDepth(std::vector& depth_h, std::string filename) 45 | { 46 | std::ifstream stm(filename, std::ios_base::binary); 47 | if (stm.fail()) 48 | throw std::exception(("load failed: " + filename).c_str()); 49 | 50 | depth_h.resize(dfusion::KINECT_WIDTH*dfusion::KINECT_HEIGHT); 51 | std::vector tmp(depth_h.size()); 52 | 53 | int w = 0, h = 0; 54 | stm.read((char*)&w, sizeof(int)); 55 | stm.read((char*)&h, sizeof(int)); 56 | if (w != dfusion::KINECT_WIDTH || h != dfusion::KINECT_HEIGHT) 57 | throw std::exception("loadDepth: size not matched!"); 58 | stm.read((char*)tmp.data(), tmp.size()*sizeof(unsigned short)); 59 | 60 | for (size_t i = 0; i < tmp.size(); i++) 61 | depth_h[i] = tmp[i]; 62 | 63 | //debug 64 | //for (int y = 0; y < dfusion::KINECT_HEIGHT; y++) 65 | //for (int x = 0; x < dfusion::KINECT_WIDTH; x++) 66 | // depth_h[y*dfusion::KINECT_WIDTH + x] = tmp[y*dfusion::KINECT_WIDTH + dfusion::KINECT_WIDTH-1-x]; 67 | 68 | stm.close(); 69 | } 70 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/CudaDiagBlockMatrix.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "cuda_utils.h" 8 | 9 | class CudaDiagBlockMatrix 10 | { 11 | enum{ 12 | CTA_SIZE = 512 13 | }; 14 | struct Range 15 | { 16 | CudaDiagBlockMatrix* A; 17 | int blockBegin; 18 | int blockEnd; 19 | Range(CudaDiagBlockMatrix* A_, int blockBegin_ = 0, 20 | int blockEnd_ = INT_MAX) 21 | { 22 | A = A_; 23 | blockBegin = blockBegin_; 24 | blockEnd = blockEnd_; 25 | } 26 | }; 27 | public: 28 | CudaDiagBlockMatrix(); 29 | ~CudaDiagBlockMatrix(); 30 | 31 | void clear(); 32 | void resize(int numBlocks, int blockSize); 33 | 34 | int blockSize()const{ return m_blockSize; } 35 | int numBlocks()const{ return m_numBlocks; } 36 | int rows()const{ return m_numBlocks * m_blockSize; } 37 | int cols()const{ return m_numBlocks * m_blockSize; } 38 | int nnz()const{ return m_blockSize*m_blockSize*m_numBlocks; } 39 | const float* value()const{ return m_values.ptr(); } 40 | float* value(){ return m_values.ptr(); } 41 | cudaTextureObject_t getTexture()const{ return m_tex; } 42 | 43 | CudaDiagBlockMatrix& operator = (float constVal); 44 | CudaDiagBlockMatrix& operator = (const CudaDiagBlockMatrix& rhs); 45 | DeviceArray toDeviceArray(){ return DeviceArray(value(), nnz()); } 46 | void setValue(const float* val_d); 47 | 48 | // return alpha * this + beta 49 | CudaDiagBlockMatrix& axpy(float alpha, float beta = 0.f); 50 | 51 | // this(i,i) = alpha * this(i,i) + beta 52 | CudaDiagBlockMatrix& axpy_diag(float alpha, float beta = 0.f); 53 | 54 | // cholesky decomposition, results overwrite 55 | // the lower part of the row majored matrix. 56 | // assume positive definate 57 | CudaDiagBlockMatrix& cholesky(); 58 | 59 | // inverse the lower triangular part of the matrix 60 | CudaDiagBlockMatrix& invL(); 61 | 62 | // Upper(this) = Lower(this)^t 63 | CudaDiagBlockMatrix& transpose_L_to_U(); 64 | 65 | // compute result = L'*L, where L is the lower triangular part of this 66 | void LtL(CudaDiagBlockMatrix& result)const; 67 | 68 | // vec_out = alpha * Lower(this) * vec_in + beta; 69 | void Lv(const float* vec_in, float* vec_out, float alpha = 1.f, float beta = 0.f); 70 | 71 | // vec_out = alpha * Lower(this)^t * vec_in + beta; 72 | void Ltv(const float* vec_in, float* vec_out, float alpha = 1.f, float beta = 0.f); 73 | 74 | Range range(int blockBegin_ = 0, int blockEnd_ = INT_MAX){ 75 | return Range(this, blockBegin_, blockEnd_); 76 | } 77 | private: 78 | int m_blockSize; 79 | int m_numBlocks; 80 | cudaTextureObject_t m_tex; 81 | 82 | DeviceArray m_values; 83 | }; 84 | 85 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/RayCaster.cpp: -------------------------------------------------------------------------------- 1 | #include "RayCaster.h" 2 | #include "TsdfVolume.h" 3 | #include "fmath.h" 4 | #include "Camera.h" 5 | namespace dfusion 6 | { 7 | RayCaster::RayCaster() 8 | { 9 | m_volume = nullptr; 10 | } 11 | 12 | RayCaster::~RayCaster() 13 | { 14 | } 15 | 16 | void RayCaster::init(const TsdfVolume& V) 17 | { 18 | m_volume = &V; 19 | } 20 | 21 | void RayCaster::setCamera(const Camera& cam) 22 | { 23 | release_assert(m_volume); 24 | const float l = cam.getViewPortLeft(); 25 | const float r = cam.getViewPortRight(); 26 | const float t = cam.getViewPortTop(); 27 | const float b = cam.getViewPortBottom(); 28 | const float f = (b-t) * 0.5f / tanf(cam.getFov() * fmath::DEG_TO_RAD * 0.5f); 29 | 30 | // origion 31 | ldp::Float3 ori(m_volume->getOrigion().x, m_volume->getOrigion().y, m_volume->getOrigion().z); 32 | ldp::Mat4f Omat = ldp::Mat4f().eye(); 33 | Omat.setTranslationPart(ori); 34 | 35 | ldp::Mat4f volume2camera = cam.getModelViewMatrix() * Omat; 36 | ldp::Mat4f camera2volume = volume2camera.inv(); 37 | 38 | // camera intrinsic 39 | m_intr = Intr(f, f, (r + l)*0.5f, (b + t)*0.5f); 40 | 41 | // volume to world 42 | // NOTE: in mat33, each vec is a row-vec 43 | for (int x = 0; x < 3; x++) 44 | { 45 | m_Rv2c.data[x].x = volume2camera(x, 0); 46 | m_Rv2c.data[x].y = volume2camera(x, 1); 47 | m_Rv2c.data[x].z = volume2camera(x, 2); 48 | } 49 | m_tv2c.x = volume2camera(0, 3); 50 | m_tv2c.y = volume2camera(1, 3); 51 | m_tv2c.z = volume2camera(2, 3); 52 | 53 | // camera to volume 54 | for (int x = 0; x < 3; x++) 55 | { 56 | m_Rc2v.data[x].x = camera2volume(x, 0); 57 | m_Rc2v.data[x].y = camera2volume(x, 1); 58 | m_Rc2v.data[x].z = camera2volume(x, 2); 59 | } 60 | m_tc2v.x = camera2volume(0, 3); 61 | m_tc2v.y = camera2volume(1, 3); 62 | m_tc2v.z = camera2volume(2, 3); 63 | 64 | // allocate 2d buffers 65 | m_vmap.create(std::lroundf(b - t), std::lroundf(r - l)); 66 | m_nmap.create(m_vmap.rows(), m_vmap.cols()); 67 | } 68 | 69 | // host_gray_buffer: pre-allocated, size = viewport width*height defined by the camera 70 | void RayCaster::shading(LightSource light, ColorMap& colorMap, bool show_normal_map) 71 | { 72 | release_assert(m_volume); 73 | 74 | colorMap.create(m_vmap.rows(), m_vmap.cols()); 75 | 76 | // 1. ray casting 77 | raycast(); 78 | 79 | // 2. shading 80 | if (show_normal_map) 81 | { 82 | Mat33 R = m_Rc2v; 83 | generateNormalMap(m_nmap, colorMap, R); 84 | } 85 | else 86 | { 87 | generateImage(m_vmap, m_nmap, colorMap, light); 88 | } 89 | } 90 | 91 | void RayCaster::clear() 92 | { 93 | m_volume = nullptr; 94 | m_vmap.release(); 95 | m_nmap.release(); 96 | } 97 | 98 | } -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/moderngpu/include/moderngpu.cuh: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of the NVIDIA CORPORATION nor the 12 | * names of its contributors may be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY 19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | ******************************************************************************/ 27 | 28 | /****************************************************************************** 29 | * 30 | * Code and text by Sean Baxter, NVIDIA Research 31 | * See http://nvlabs.github.io/moderngpu for repository and documentation. 32 | * 33 | ******************************************************************************/ 34 | 35 | #pragma once 36 | 37 | #include "kernels/reduce.cuh" 38 | #include "kernels/scan.cuh" 39 | #include "kernels/bulkremove.cuh" 40 | #include "kernels/bulkinsert.cuh" 41 | #include "kernels/merge.cuh" 42 | #include "kernels/mergesort.cuh" 43 | #include "kernels/segmentedsort.cuh" 44 | #include "kernels/localitysort.cuh" 45 | #include "kernels/sortedsearch.cuh" 46 | #include "kernels/loadbalance.cuh" 47 | #include "kernels/intervalmove.cuh" 48 | #include "kernels/join.cuh" 49 | #include "kernels/sets.cuh" 50 | #include "kernels/segreducecsr.cuh" 51 | #include "kernels/reducebykey.cuh" 52 | #include "kernels/spmvcsr.cuh" 53 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseCore/SparseTranspose.h: -------------------------------------------------------------------------------- 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | namespace Eigen { 14 | 15 | template class TransposeImpl 16 | : public SparseMatrixBase > 17 | { 18 | typedef typename internal::remove_all::type _MatrixTypeNested; 19 | public: 20 | 21 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose ) 22 | 23 | class InnerIterator; 24 | class ReverseInnerIterator; 25 | 26 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 27 | }; 28 | 29 | // NOTE: VC10 and VC11 trigger an ICE if don't put typename TransposeImpl:: in front of Index, 30 | // a typedef typename TransposeImpl::Index Index; 31 | // does not fix the issue. 32 | // An alternative is to define the nested class in the parent class itself. 33 | template class TransposeImpl::InnerIterator 34 | : public _MatrixTypeNested::InnerIterator 35 | { 36 | typedef typename _MatrixTypeNested::InnerIterator Base; 37 | typedef typename TransposeImpl::Index Index; 38 | public: 39 | 40 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl::Index outer) 41 | : Base(trans.derived().nestedExpression(), outer) 42 | {} 43 | typename TransposeImpl::Index row() const { return Base::col(); } 44 | typename TransposeImpl::Index col() const { return Base::row(); } 45 | }; 46 | 47 | template class TransposeImpl::ReverseInnerIterator 48 | : public _MatrixTypeNested::ReverseInnerIterator 49 | { 50 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 51 | typedef typename TransposeImpl::Index Index; 52 | public: 53 | 54 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl::Index outer) 55 | : Base(xpr.derived().nestedExpression(), outer) 56 | {} 57 | typename TransposeImpl::Index row() const { return Base::col(); } 58 | typename TransposeImpl::Index col() const { return Base::row(); } 59 | }; 60 | 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_SPARSETRANSPOSE_H 64 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/moderngpu/include/mgpuenums.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright 7 | * notice, this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright 9 | * notice, this list of conditions and the following disclaimer in the 10 | * documentation and/or other materials provided with the distribution. 11 | * * Neither the name of the NVIDIA CORPORATION nor the 12 | * names of its contributors may be used to endorse or promote products 13 | * derived from this software without specific prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY 19 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | * 26 | ******************************************************************************/ 27 | 28 | /****************************************************************************** 29 | * 30 | * Code and text by Sean Baxter, NVIDIA Research 31 | * See http://nvlabs.github.io/moderngpu for repository and documentation. 32 | * 33 | ******************************************************************************/ 34 | 35 | #pragma once 36 | 37 | namespace mgpu { 38 | 39 | enum MgpuBounds { 40 | MgpuBoundsLower, 41 | MgpuBoundsUpper 42 | }; 43 | 44 | enum MgpuScanType { 45 | MgpuScanTypeExc, 46 | MgpuScanTypeInc 47 | }; 48 | 49 | enum MgpuSearchType { 50 | MgpuSearchTypeNone, 51 | MgpuSearchTypeIndex, 52 | MgpuSearchTypeMatch, 53 | MgpuSearchTypeIndexMatch 54 | }; 55 | 56 | enum MgpuJoinKind { 57 | MgpuJoinKindInner, 58 | MgpuJoinKindLeft, 59 | MgpuJoinKindRight, 60 | MgpuJoinKindOuter 61 | }; 62 | 63 | enum MgpuSetOp { 64 | MgpuSetOpIntersection, 65 | MgpuSetOpUnion, 66 | MgpuSetOpDiff, 67 | MgpuSetOpSymDiff 68 | }; 69 | 70 | } // namespace mgpu 71 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/TsdfVolume.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "kinect_util.h" 4 | #include 5 | 6 | namespace mpu 7 | { 8 | class VolumeData; 9 | } 10 | namespace dfusion 11 | { 12 | /** \brief TsdfVolume class 13 | * \author Anatoly Baskeheev, Itseez Ltd, (myname.mysurname@mycompany.com) 14 | */ 15 | class TsdfVolume 16 | { 17 | public: 18 | /** \brief Constructor 19 | * \param[in] resolution volume resolution 20 | */ 21 | TsdfVolume(); 22 | 23 | void init(int3 resolution, float voxel_size, float3 origion); 24 | void initFromHost(const mpu::VolumeData* vhost); 25 | /** 26 | set the size of each voxel 27 | */ 28 | void setVoxelSize(float voxel_size); 29 | float getVoxelSize()const{ return voxel_size_; } 30 | 31 | /** \brief Sets Tsdf truncation distance. Must be greater than 2 * volume_voxel_size 32 | * \param[in] distance TSDF truncation distance 33 | */ 34 | void setTsdfTruncDist(float distance); 35 | 36 | /** \brief Returns tsdf volume container that point to data in GPU memroy */ 37 | cudaArray_t data() const; 38 | cudaArray_t data(); 39 | 40 | cudaTextureObject_t getTexture()const; 41 | cudaSurfaceObject_t getSurface()const; 42 | 43 | /** \brief Returns volume resolution */ 44 | const int3& getResolution() const; 45 | 46 | const float3& getOrigion() const; 47 | 48 | /** \brief Returns tsdf truncation distance in meters */ 49 | float getTsdfTruncDist() const; 50 | 51 | /** \brief Resets tsdf volume data to uninitialized state */ 52 | void reset(); 53 | 54 | /** \brief Downloads tsdf volume from GPU memory. 55 | * \param[out] tsdf Array with tsdf values. if volume resolution is 512x512x512, so for voxel (x,y,z) tsdf value can be retrieved as volume[512*512*z + 512*y + x]; 56 | * \param[in] voxels with weight <= this threshold be be viewed as "null" 57 | */ 58 | void downloadRawVolume(std::vector& tsdf)const; 59 | void download(mpu::VolumeData* vhost)const; 60 | void uploadRawVolume(std::vector& tsdf); 61 | 62 | void save(const char* filename)const; 63 | void load(const char* filename); 64 | protected: 65 | void copyFromHost(const float* data); 66 | void copyToHost(float* data)const; 67 | void copyToHostRaw(TsdfData* data)const; 68 | void allocate(int3 resolution, float voxel_size, float3 origion); 69 | 70 | void bindTexture(); 71 | void unbindTexture(); 72 | void bindSurface(); 73 | void unbindSurface(); 74 | private: 75 | /** \brief tsdf volume size in meters */ 76 | float voxel_size_; 77 | 78 | float3 origion_; 79 | 80 | /** \brief tsdf volume resolution */ 81 | int3 resolution_; 82 | 83 | /** \brief tsdf volume data container */ 84 | cudaArray_t volume_; 85 | 86 | /** \brief tsdf truncation distance */ 87 | float tranc_dist_; 88 | 89 | cudaTextureObject_t tex_; 90 | cudaSurfaceObject_t surf_; 91 | }; 92 | } -------------------------------------------------------------------------------- /algorithm/eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_SOLVE_H 11 | #define EIGEN_MISC_SOLVE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class solve_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix ReturnType; 30 | }; 31 | 32 | template struct solve_retval_base 33 | : public ReturnByValue > 34 | { 35 | typedef typename remove_all::type RhsNestedCleaned; 36 | typedef _DecompositionType DecompositionType; 37 | typedef ReturnByValue Base; 38 | typedef typename Base::Index Index; 39 | 40 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 41 | : m_dec(dec), m_rhs(rhs) 42 | {} 43 | 44 | inline Index rows() const { return m_dec.cols(); } 45 | inline Index cols() const { return m_rhs.cols(); } 46 | inline const DecompositionType& dec() const { return m_dec; } 47 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 48 | 49 | template inline void evalTo(Dest& dst) const 50 | { 51 | static_cast*>(this)->evalTo(dst); 52 | } 53 | 54 | protected: 55 | const DecompositionType& m_dec; 56 | typename Rhs::Nested m_rhs; 57 | }; 58 | 59 | } // end namespace internal 60 | 61 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 62 | typedef typename DecompositionType::MatrixType MatrixType; \ 63 | typedef typename MatrixType::Scalar Scalar; \ 64 | typedef typename MatrixType::RealScalar RealScalar; \ 65 | typedef typename MatrixType::Index Index; \ 66 | typedef Eigen::internal::solve_retval_base Base; \ 67 | using Base::dec; \ 68 | using Base::rhs; \ 69 | using Base::rows; \ 70 | using Base::cols; \ 71 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 72 | : Base(dec, rhs) {} 73 | 74 | } // end namespace Eigen 75 | 76 | #endif // EIGEN_MISC_SOLVE_H 77 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/cudpp/moderngpu/include/util/mgpualloc.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include "util/util.h" 5 | #include 6 | 7 | namespace mgpu { 8 | 9 | class CudaDevice; 10 | 11 | class CudaContext; 12 | typedef intrusive_ptr ContextPtr; 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | // Customizable allocator. 16 | 17 | // CudaAlloc is the interface class all allocator accesses. Users may derive 18 | // this, implement custom allocators, and set it to the device with 19 | // CudaDevice::SetAllocator. 20 | 21 | class CudaAlloc : public CudaBase { 22 | public: 23 | virtual cudaError_t Malloc(size_t size, void** p) = 0; 24 | virtual bool Free(void* p) = 0; 25 | virtual void Clear() = 0; 26 | 27 | virtual ~CudaAlloc() { } 28 | 29 | CudaDevice& Device() { return _device; } 30 | 31 | protected: 32 | CudaAlloc(CudaDevice& device) : _device(device) { } 33 | CudaDevice& _device; 34 | }; 35 | 36 | // A concrete class allocator that simply calls cudaMalloc and cudaFree. 37 | class CudaAllocSimple : public CudaAlloc { 38 | public: 39 | CudaAllocSimple(CudaDevice& device) : CudaAlloc(device) { } 40 | 41 | virtual cudaError_t Malloc(size_t size, void** p); 42 | virtual bool Free(void* p); 43 | virtual void Clear() { } 44 | virtual ~CudaAllocSimple() { } 45 | }; 46 | 47 | // A concrete class allocator that uses exponentially-spaced buckets and an LRU 48 | // to reuse allocations. This is the default allocator. It is shared between 49 | // all contexts on the device. 50 | class CudaAllocBuckets : public CudaAlloc { 51 | public: 52 | CudaAllocBuckets(CudaDevice& device); 53 | virtual ~CudaAllocBuckets(); 54 | 55 | virtual cudaError_t Malloc(size_t size, void** p); 56 | virtual bool Free(void* p); 57 | virtual void Clear(); 58 | 59 | size_t Allocated() const { return _allocated; } 60 | size_t Committed() const { return _committed; } 61 | size_t Capacity() const { return _capacity; } 62 | 63 | bool SanityCheck() const; 64 | 65 | void SetCapacity(size_t capacity, size_t maxObjectSize) { 66 | _capacity = capacity; 67 | _maxObjectSize = maxObjectSize; 68 | Clear(); 69 | } 70 | 71 | private: 72 | static const int NumBuckets = 84; 73 | static const size_t BucketSizes[NumBuckets]; 74 | 75 | struct MemNode; 76 | typedef std::list MemList; 77 | typedef std::map AddressMap; 78 | typedef std::multimap PriorityMap; 79 | 80 | struct MemNode { 81 | AddressMap::iterator address; 82 | PriorityMap::iterator priority; 83 | int bucket; 84 | }; 85 | 86 | void Compact(size_t extra); 87 | void FreeNode(MemList::iterator memIt); 88 | int LocateBucket(size_t size) const; 89 | 90 | AddressMap _addressMap; 91 | PriorityMap _priorityMap; 92 | MemList _memLists[NumBuckets + 1]; 93 | 94 | size_t _maxObjectSize, _capacity, _allocated, _committed; 95 | int _counter; 96 | }; 97 | 98 | } // namespace mgpu 99 | -------------------------------------------------------------------------------- /algorithm/eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 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 | // 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 http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 12 | 13 | /** \returns an expression of the coefficient-wise absolute value of \c *this 14 | * 15 | * Example: \include MatrixBase_cwiseAbs.cpp 16 | * Output: \verbinclude MatrixBase_cwiseAbs.out 17 | * 18 | * \sa cwiseAbs2() 19 | */ 20 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 21 | cwiseAbs() const { return derived(); } 22 | 23 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 24 | * 25 | * Example: \include MatrixBase_cwiseAbs2.cpp 26 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 27 | * 28 | * \sa cwiseAbs() 29 | */ 30 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 31 | cwiseAbs2() const { return derived(); } 32 | 33 | /** \returns an expression of the coefficient-wise square root of *this. 34 | * 35 | * Example: \include MatrixBase_cwiseSqrt.cpp 36 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 37 | * 38 | * \sa cwisePow(), cwiseSquare() 39 | */ 40 | inline const CwiseUnaryOp, const Derived> 41 | cwiseSqrt() const { return derived(); } 42 | 43 | /** \returns an expression of the coefficient-wise inverse of *this. 44 | * 45 | * Example: \include MatrixBase_cwiseInverse.cpp 46 | * Output: \verbinclude MatrixBase_cwiseInverse.out 47 | * 48 | * \sa cwiseProduct() 49 | */ 50 | inline const CwiseUnaryOp, const Derived> 51 | cwiseInverse() const { return derived(); } 52 | 53 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 54 | * 55 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 56 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 57 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 58 | * isMuchSmallerThan(). 59 | * 60 | * \sa cwiseEqual(const MatrixBase &) const 61 | */ 62 | inline const CwiseUnaryOp >, const Derived> 63 | cwiseEqual(const Scalar& s) const 64 | { 65 | return CwiseUnaryOp >,const Derived> 66 | (derived(), std::bind1st(std::equal_to(), s)); 67 | } 68 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/glsl/glslprogram.h: -------------------------------------------------------------------------------- 1 | #ifndef GLSLPROGRAM_H 2 | #define GLSLPROGRAM_H 3 | 4 | #include 5 | #define _USE_MATH_DEFINES 6 | #include 7 | #include 8 | 9 | #ifdef WIN32 10 | #include 11 | #endif 12 | 13 | #include "glew.h" 14 | #include 15 | #include 16 | #include "glut.h" 17 | #include 18 | #include 19 | 20 | 21 | inline int GetOSU( int flag ) 22 | { 23 | int i; 24 | glGetIntegerv( flag, &i ); 25 | return i; 26 | } 27 | 28 | 29 | void CheckGlErrors( const char* ); 30 | 31 | 32 | 33 | class GLSLProgram 34 | { 35 | private: 36 | std::map AttributeLocs; 37 | char * Ffile; 38 | unsigned int Fshader; 39 | char * Gfile; 40 | GLuint Gshader; 41 | bool IncludeGstap; 42 | GLenum InputTopology; 43 | GLenum OutputTopology; 44 | GLuint Program; 45 | char * TCfile; 46 | GLuint TCshader; 47 | char * TEfile; 48 | GLuint TEshader; 49 | std::map UniformLocs; 50 | bool Valid; 51 | char * Vfile; 52 | GLuint Vshader; 53 | bool Verbose; 54 | 55 | static int CurrentProgram; 56 | 57 | void AttachShader( GLuint ); 58 | bool CanDoBinaryFiles; 59 | bool CanDoFragmentShaders; 60 | bool CanDoGeometryShaders; 61 | bool CanDoTessControlShaders; 62 | bool CanDoTessEvaluationShaders; 63 | bool CanDoVertexShaders; 64 | int CompileShader( GLuint ); 65 | bool CreateHelper( char *, ... ); 66 | int GetAttributeLocation( char * ); 67 | int GetUniformLocation( char * ); 68 | 69 | 70 | public: 71 | GLSLProgram( ); 72 | 73 | bool Create( char *, char * = NULL, char * = NULL, char * = NULL, char * = NULL ); 74 | bool IsExtensionSupported( const char * ); 75 | bool IsNotValid( ); 76 | bool IsValid( ); 77 | void LoadBinaryFile( char * ); 78 | void LoadProgramBinary( const char *, GLenum ); 79 | void SaveBinaryFile( char * ); 80 | void SaveProgramBinary( const char *, GLenum * ); 81 | void SetAttribute( char *, int ); 82 | void SetAttribute( char *, float ); 83 | void SetAttribute( char *, float, float, float ); 84 | void SetAttribute( char *, float[3] ); 85 | #ifdef VEC3_H 86 | void SetAttribute( char *, Vec3& ); 87 | #endif 88 | #ifdef VERTEX_ARRAY_H 89 | void SetAttribute( char *, VertexArray&, GLenum ); 90 | #endif 91 | #ifdef VERTEX_BUFFER_OBJECT_H 92 | void SetAttribute( char *, VertexBufferObject&, GLenum ); 93 | #endif 94 | void SetGstap( bool ); 95 | void SetInputTopology( GLenum ); 96 | void SetOutputTopology( GLenum ); 97 | void SetUniform( char *, int ); 98 | void SetUniform( char *, float ); 99 | void SetUniform( char *, float, float, float ); 100 | void SetUniform( char *, float[3] ); 101 | #ifdef VEC3_H 102 | void SetUniform( char *, Vec3& ); 103 | #endif 104 | #ifdef MATRIX4_H 105 | void SetUniform( char *, Matrix4& ); 106 | #endif 107 | void SetVerbose( bool ); 108 | void Use( ); 109 | void Use( GLuint ); 110 | void UseFixedFunction( ); 111 | }; 112 | 113 | #endif // #ifndef GLSLPROGRAM_H 114 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MATH_FUNCTIONS_H 11 | #define EIGEN2_MATH_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | template inline typename NumTraits::Real ei_real(const T& x) { return numext::real(x); } 16 | template inline typename NumTraits::Real ei_imag(const T& x) { return numext::imag(x); } 17 | template inline T ei_conj(const T& x) { return numext::conj(x); } 18 | template inline typename NumTraits::Real ei_abs (const T& x) { using std::abs; return abs(x); } 19 | template inline typename NumTraits::Real ei_abs2(const T& x) { return numext::abs2(x); } 20 | template inline T ei_sqrt(const T& x) { using std::sqrt; return sqrt(x); } 21 | template inline T ei_exp (const T& x) { using std::exp; return exp(x); } 22 | template inline T ei_log (const T& x) { using std::log; return log(x); } 23 | template inline T ei_sin (const T& x) { using std::sin; return sin(x); } 24 | template inline T ei_cos (const T& x) { using std::cos; return cos(x); } 25 | template inline T ei_atan2(const T& x,const T& y) { using std::atan2; return atan2(x,y); } 26 | template inline T ei_pow (const T& x,const T& y) { return numext::pow(x,y); } 27 | template inline T ei_random () { return internal::random(); } 28 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 29 | 30 | template inline T precision () { return NumTraits::dummy_precision(); } 31 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 32 | 33 | 34 | template 35 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 36 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 37 | { 38 | return internal::isMuchSmallerThan(x, y, precision); 39 | } 40 | 41 | template 42 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 43 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 44 | { 45 | return internal::isApprox(x, y, precision); 46 | } 47 | 48 | template 49 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 50 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 51 | { 52 | return internal::isApproxOrLessThan(x, y, precision); 53 | } 54 | 55 | } // end namespace Eigen 56 | 57 | #endif // EIGEN2_MATH_FUNCTIONS_H 58 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 12 | #define EIGEN_BLOCK_HOUSEHOLDER_H 13 | 14 | // This file contains some helper function to deal with block householder reflectors 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | 20 | /** \internal */ 21 | template 22 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 23 | { 24 | typedef typename TriangularFactorType::Index Index; 25 | typedef typename VectorsType::Scalar Scalar; 26 | const Index nbVecs = vectors.cols(); 27 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 28 | 29 | for(Index i = 0; i < nbVecs; i++) 30 | { 31 | Index rs = vectors.rows() - i; 32 | Scalar Vii = vectors(i,i); 33 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 34 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 35 | * vectors.col(i).tail(rs); 36 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 37 | // FIXME add .noalias() once the triangular product can work inplace 38 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 39 | * triFactor.col(i).head(i); 40 | triFactor(i,i) = hCoeffs(i); 41 | } 42 | } 43 | 44 | /** \internal */ 45 | template 46 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 47 | { 48 | typedef typename MatrixType::Index Index; 49 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 50 | Index nbVecs = vectors.cols(); 51 | Matrix T(nbVecs,nbVecs); 52 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 53 | 54 | const TriangularView& V(vectors); 55 | 56 | // A -= V T V^* A 57 | Matrix tmp = V.adjoint() * mat; 59 | // FIXME add .noalias() once the triangular product can work inplace 60 | tmp = T.template triangularView().adjoint() * tmp; 61 | mat.noalias() -= V * tmp; 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 69 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/VectorBlock.h: -------------------------------------------------------------------------------- 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 | // 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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_VECTORBLOCK_H 12 | #define EIGEN2_VECTORBLOCK_H 13 | 14 | namespace Eigen { 15 | 16 | /** \deprecated use DenseMase::head(Index) */ 17 | template 18 | inline VectorBlock 19 | MatrixBase::start(Index size) 20 | { 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 22 | return VectorBlock(derived(), 0, size); 23 | } 24 | 25 | /** \deprecated use DenseMase::head(Index) */ 26 | template 27 | inline const VectorBlock 28 | MatrixBase::start(Index size) const 29 | { 30 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 31 | return VectorBlock(derived(), 0, size); 32 | } 33 | 34 | /** \deprecated use DenseMase::tail(Index) */ 35 | template 36 | inline VectorBlock 37 | MatrixBase::end(Index size) 38 | { 39 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 40 | return VectorBlock(derived(), this->size() - size, size); 41 | } 42 | 43 | /** \deprecated use DenseMase::tail(Index) */ 44 | template 45 | inline const VectorBlock 46 | MatrixBase::end(Index size) const 47 | { 48 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 49 | return VectorBlock(derived(), this->size() - size, size); 50 | } 51 | 52 | /** \deprecated use DenseMase::head() */ 53 | template 54 | template 55 | inline VectorBlock 56 | MatrixBase::start() 57 | { 58 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 59 | return VectorBlock(derived(), 0); 60 | } 61 | 62 | /** \deprecated use DenseMase::head() */ 63 | template 64 | template 65 | inline const VectorBlock 66 | MatrixBase::start() const 67 | { 68 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 69 | return VectorBlock(derived(), 0); 70 | } 71 | 72 | /** \deprecated use DenseMase::tail() */ 73 | template 74 | template 75 | inline VectorBlock 76 | MatrixBase::end() 77 | { 78 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 79 | return VectorBlock(derived(), size() - Size); 80 | } 81 | 82 | /** \deprecated use DenseMase::tail() */ 83 | template 84 | template 85 | inline const VectorBlock 86 | MatrixBase::end() const 87 | { 88 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 89 | return VectorBlock(derived(), size() - Size); 90 | } 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN2_VECTORBLOCK_H 95 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/CudaDiagBlockMatrix.cpp: -------------------------------------------------------------------------------- 1 | #include "CudaDiagBlockMatrix.h" 2 | #include "GpuCholeSky.h" 3 | 4 | CudaDiagBlockMatrix::CudaDiagBlockMatrix() 5 | { 6 | m_blockSize = 0; 7 | m_numBlocks = 0; 8 | m_tex = 0; 9 | } 10 | 11 | CudaDiagBlockMatrix::~CudaDiagBlockMatrix() 12 | { 13 | clear(); 14 | } 15 | 16 | void CudaDiagBlockMatrix::clear() 17 | { 18 | m_blockSize = 0; 19 | m_numBlocks = 0; 20 | if (m_tex) 21 | cudaSafeCall(cudaDestroyTextureObject(m_tex), "CudaDiagBlockMatrix::clear(), destroy tex"); 22 | m_tex = 0; 23 | m_values.release(); 24 | } 25 | 26 | template 27 | static void bindLinearTex(T* ptr, int sizeBytes, cudaTextureObject_t& old) 28 | { 29 | if (old) 30 | cudaSafeCall(cudaDestroyTextureObject(old), "CudaBsrMatrix::bindTexture::Destory"); 31 | cudaResourceDesc texRes; 32 | memset(&texRes, 0, sizeof(cudaResourceDesc)); 33 | texRes.resType = cudaResourceTypeLinear; 34 | texRes.res.linear.devPtr = ptr; 35 | texRes.res.linear.sizeInBytes = sizeBytes; 36 | texRes.res.linear.desc = cudaCreateChannelDesc(); 37 | cudaTextureDesc texDescr; 38 | memset(&texDescr, 0, sizeof(cudaTextureDesc)); 39 | texDescr.normalizedCoords = 0; 40 | texDescr.filterMode = cudaFilterModePoint; 41 | texDescr.addressMode[0] = cudaAddressModeClamp; 42 | texDescr.addressMode[1] = cudaAddressModeClamp; 43 | texDescr.addressMode[2] = cudaAddressModeClamp; 44 | texDescr.readMode = cudaReadModeElementType; 45 | cudaSafeCall(cudaCreateTextureObject(&old, &texRes, &texDescr, NULL), 46 | "CudaBsrMatrix::bindTexture"); 47 | } 48 | 49 | void CudaDiagBlockMatrix::resize(int numBlocks, int blockSize) 50 | { 51 | m_numBlocks = numBlocks; 52 | m_blockSize = blockSize; 53 | if (nnz() > m_values.size()) 54 | { 55 | m_values.create(nnz() * 1.2); 56 | 57 | // bind to texture 58 | bindLinearTex(value(), m_values.sizeBytes(), m_tex); 59 | } 60 | } 61 | 62 | CudaDiagBlockMatrix& CudaDiagBlockMatrix::cholesky() 63 | { 64 | gpu_cholesky::single_thread_cholesky_batched(value(), blockSize(), 65 | blockSize()*blockSize(), numBlocks()); 66 | return *this; 67 | } 68 | 69 | CudaDiagBlockMatrix& CudaDiagBlockMatrix::invL() 70 | { 71 | gpu_cholesky::single_thread_tril_inv_batched(value(), blockSize(), 72 | blockSize()*blockSize(), numBlocks()); 73 | return *this; 74 | } 75 | 76 | void CudaDiagBlockMatrix::LtL(CudaDiagBlockMatrix& result)const 77 | { 78 | result.resize(numBlocks(), blockSize()); 79 | gpu_cholesky::single_thread_LtL_batched( 80 | result.value(), blockSize()*blockSize(), value(), 81 | blockSize()*blockSize(), blockSize(), numBlocks()); 82 | } 83 | 84 | CudaDiagBlockMatrix& CudaDiagBlockMatrix::operator = (const CudaDiagBlockMatrix& rhs) 85 | { 86 | resize(rhs.numBlocks(), rhs.blockSize()); 87 | cudaSafeCall(cudaMemcpy(value(), rhs.value(), nnz()*sizeof(float), 88 | cudaMemcpyDeviceToDevice), "CudaDiagBlockMatrix::operator = rhs"); 89 | return *this; 90 | } 91 | 92 | void CudaDiagBlockMatrix::setValue(const float* val_d) 93 | { 94 | cudaSafeCall(cudaMemcpy(value(), val_d, nnz()*sizeof(float), 95 | cudaMemcpyDeviceToDevice), "CudaDiagBlockMatrix::setValue"); 96 | } 97 | 98 | -------------------------------------------------------------------------------- /algorithm/eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STL_DETAILS_H 12 | #define EIGEN_STL_DETAILS_H 13 | 14 | #ifndef EIGEN_ALIGNED_ALLOCATOR 15 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 16 | #endif 17 | 18 | namespace Eigen { 19 | 20 | // This one is needed to prevent reimplementing the whole std::vector. 21 | template 22 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 23 | { 24 | public: 25 | typedef size_t size_type; 26 | typedef ptrdiff_t difference_type; 27 | typedef T* pointer; 28 | typedef const T* const_pointer; 29 | typedef T& reference; 30 | typedef const T& const_reference; 31 | typedef T value_type; 32 | 33 | template 34 | struct rebind 35 | { 36 | typedef aligned_allocator_indirection other; 37 | }; 38 | 39 | aligned_allocator_indirection() {} 40 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 41 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 42 | template 43 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 44 | template 45 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 46 | ~aligned_allocator_indirection() {} 47 | }; 48 | 49 | #ifdef _MSC_VER 50 | 51 | // sometimes, MSVC detects, at compile time, that the argument x 52 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 53 | // even if this function is never called. Whence this little wrapper. 54 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 55 | typename Eigen::internal::conditional< \ 56 | Eigen::internal::is_arithmetic::value, \ 57 | T, \ 58 | Eigen::internal::workaround_msvc_stl_support \ 59 | >::type 60 | 61 | namespace internal { 62 | template struct workaround_msvc_stl_support : public T 63 | { 64 | inline workaround_msvc_stl_support() : T() {} 65 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 66 | inline operator T& () { return *static_cast(this); } 67 | inline operator const T& () const { return *static_cast(this); } 68 | template 69 | inline T& operator=(const OtherT& other) 70 | { T::operator=(other); return *this; } 71 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 72 | { T::operator=(other); return *this; } 73 | }; 74 | } 75 | 76 | #else 77 | 78 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 79 | 80 | #endif 81 | 82 | } 83 | 84 | #endif // EIGEN_STL_DETAILS_H 85 | -------------------------------------------------------------------------------- /algorithm/eigen/src/misc/Kernel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_KERNEL_H 11 | #define EIGEN_MISC_KERNEL_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class kernel_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 27 | // is the number of cols of the original matrix 28 | // so that the product "matrix * kernel = zero" makes sense 29 | Dynamic, // we don't know at compile-time the dimension of the kernel 30 | MatrixType::Options, 31 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 32 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 33 | // whose dimension is the number of columns of the original matrix 34 | > ReturnType; 35 | }; 36 | 37 | template struct kernel_retval_base 38 | : public ReturnByValue > 39 | { 40 | typedef _DecompositionType DecompositionType; 41 | typedef ReturnByValue Base; 42 | typedef typename Base::Index Index; 43 | 44 | kernel_retval_base(const DecompositionType& dec) 45 | : m_dec(dec), 46 | m_rank(dec.rank()), 47 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 48 | {} 49 | 50 | inline Index rows() const { return m_dec.cols(); } 51 | inline Index cols() const { return m_cols; } 52 | inline Index rank() const { return m_rank; } 53 | inline const DecompositionType& dec() const { return m_dec; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | }; 64 | 65 | } // end namespace internal 66 | 67 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 68 | typedef typename DecompositionType::MatrixType MatrixType; \ 69 | typedef typename MatrixType::Scalar Scalar; \ 70 | typedef typename MatrixType::RealScalar RealScalar; \ 71 | typedef typename MatrixType::Index Index; \ 72 | typedef Eigen::internal::kernel_retval_base Base; \ 73 | using Base::dec; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 78 | 79 | } // end namespace Eigen 80 | 81 | #endif // EIGEN_MISC_KERNEL_H 82 | -------------------------------------------------------------------------------- /algorithm/eigen/src/QR/HouseholderQR_MKL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to Intel(R) MKL 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_MKL_H 35 | #define EIGEN_QR_MKL_H 36 | 37 | #include "Eigen/src/Core/util/MKL_support.h" 38 | 39 | namespace Eigen { 40 | 41 | namespace internal { 42 | 43 | /** \internal Specialization for the data types supported by MKL */ 44 | 45 | #define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \ 46 | template \ 47 | void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs, \ 48 | typename MatrixQR::Index maxBlockSize=32, \ 49 | EIGTYPE* tempData = 0) \ 50 | { \ 51 | lapack_int m = mat.rows(); \ 52 | lapack_int n = mat.cols(); \ 53 | lapack_int lda = mat.outerStride(); \ 54 | lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 55 | LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \ 56 | hCoeffs.adjointInPlace(); \ 57 | \ 58 | } 59 | 60 | EIGEN_MKL_QR_NOPIV(double, double, d) 61 | EIGEN_MKL_QR_NOPIV(float, float, s) 62 | EIGEN_MKL_QR_NOPIV(dcomplex, MKL_Complex16, z) 63 | EIGEN_MKL_QR_NOPIV(scomplex, MKL_Complex8, c) 64 | 65 | } // end namespace internal 66 | 67 | } // end namespace Eigen 68 | 69 | #endif // EIGEN_QR_MKL_H 70 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseLU/SparseLU_relax_snode.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 http://mozilla.org/MPL/2.0/. 9 | 10 | /* This file is a modified version of heap_relax_snode.c file in SuperLU 11 | * -- SuperLU routine (version 3.0) -- 12 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 13 | * and Lawrence Berkeley National Lab. 14 | * October 15, 2003 15 | * 16 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 17 | * 18 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 19 | * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 20 | * 21 | * Permission is hereby granted to use or copy this program for any 22 | * purpose, provided the above notices are retained on all copies. 23 | * Permission to modify the code and to distribute modified code is 24 | * granted, provided the above notices are retained, and a notice that 25 | * the code was modified is included with the above copyright notice. 26 | */ 27 | 28 | #ifndef SPARSELU_RELAX_SNODE_H 29 | #define SPARSELU_RELAX_SNODE_H 30 | 31 | namespace Eigen { 32 | 33 | namespace internal { 34 | 35 | /** 36 | * \brief Identify the initial relaxed supernodes 37 | * 38 | * This routine is applied to a column elimination tree. 39 | * It assumes that the matrix has been reordered according to the postorder of the etree 40 | * \param n the number of columns 41 | * \param et elimination tree 42 | * \param relax_columns Maximum number of columns allowed in a relaxed snode 43 | * \param descendants Number of descendants of each node in the etree 44 | * \param relax_end last column in a supernode 45 | */ 46 | template 47 | void SparseLUImpl::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) 48 | { 49 | 50 | // compute the number of descendants of each node in the etree 51 | Index j, parent; 52 | relax_end.setConstant(emptyIdxLU); 53 | descendants.setZero(); 54 | for (j = 0; j < n; j++) 55 | { 56 | parent = et(j); 57 | if (parent != n) // not the dummy root 58 | descendants(parent) += descendants(j) + 1; 59 | } 60 | // Identify the relaxed supernodes by postorder traversal of the etree 61 | Index snode_start; // beginning of a snode 62 | for (j = 0; j < n; ) 63 | { 64 | parent = et(j); 65 | snode_start = j; 66 | while ( parent != n && descendants(parent) < relax_columns ) 67 | { 68 | j = parent; 69 | parent = et(j); 70 | } 71 | // Found a supernode in postordered etree, j is the last column 72 | relax_end(snode_start) = j; // Record last column 73 | j++; 74 | // Search for a new leaf 75 | while (descendants(j) != 0 && j < n) j++; 76 | } // End postorder traversal of the etree 77 | 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | #endif 84 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/Meta.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_META_H 11 | #define EIGEN2_META_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | struct ei_traits : internal::traits 17 | {}; 18 | 19 | struct ei_meta_true { enum { ret = 1 }; }; 20 | struct ei_meta_false { enum { ret = 0 }; }; 21 | 22 | template 23 | struct ei_meta_if { typedef Then ret; }; 24 | 25 | template 26 | struct ei_meta_if { typedef Else ret; }; 27 | 28 | template struct ei_is_same_type { enum { ret = 0 }; }; 29 | template struct ei_is_same_type { enum { ret = 1 }; }; 30 | 31 | template struct ei_unref { typedef T type; }; 32 | template struct ei_unref { typedef T type; }; 33 | 34 | template struct ei_unpointer { typedef T type; }; 35 | template struct ei_unpointer { typedef T type; }; 36 | template struct ei_unpointer { typedef T type; }; 37 | 38 | template struct ei_unconst { typedef T type; }; 39 | template struct ei_unconst { typedef T type; }; 40 | template struct ei_unconst { typedef T & type; }; 41 | template struct ei_unconst { typedef T * type; }; 42 | 43 | template struct ei_cleantype { typedef T type; }; 44 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 45 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 46 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 47 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 48 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 49 | 50 | /** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer. 51 | * Usage example: \code ei_meta_sqrt<1023>::ret \endcode 52 | */ 53 | template Y))) > 57 | // use ?: instead of || just to shut up a stupid gcc 4.3 warning 58 | class ei_meta_sqrt 59 | { 60 | enum { 61 | MidX = (InfX+SupX)/2, 62 | TakeInf = MidX*MidX > Y ? 1 : 0, 63 | NewInf = int(TakeInf) ? InfX : int(MidX), 64 | NewSup = int(TakeInf) ? int(MidX) : SupX 65 | }; 66 | public: 67 | enum { ret = ei_meta_sqrt::ret }; 68 | }; 69 | 70 | template 71 | class ei_meta_sqrt { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; }; 72 | 73 | } // end namespace Eigen 74 | 75 | #endif // EIGEN2_META_H 76 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Eigen2Support/Geometry/All.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN2_GEOMETRY_MODULE_H 2 | #define EIGEN2_GEOMETRY_MODULE_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | #define M_PI 3.14159265358979323846 8 | #endif 9 | 10 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 11 | #include "RotationBase.h" 12 | #include "Rotation2D.h" 13 | #include "Quaternion.h" 14 | #include "AngleAxis.h" 15 | #include "Transform.h" 16 | #include "Translation.h" 17 | #include "Scaling.h" 18 | #include "AlignedBox.h" 19 | #include "Hyperplane.h" 20 | #include "ParametrizedLine.h" 21 | #endif 22 | 23 | 24 | #define RotationBase eigen2_RotationBase 25 | #define Rotation2D eigen2_Rotation2D 26 | #define Rotation2Df eigen2_Rotation2Df 27 | #define Rotation2Dd eigen2_Rotation2Dd 28 | 29 | #define Quaternion eigen2_Quaternion 30 | #define Quaternionf eigen2_Quaternionf 31 | #define Quaterniond eigen2_Quaterniond 32 | 33 | #define AngleAxis eigen2_AngleAxis 34 | #define AngleAxisf eigen2_AngleAxisf 35 | #define AngleAxisd eigen2_AngleAxisd 36 | 37 | #define Transform eigen2_Transform 38 | #define Transform2f eigen2_Transform2f 39 | #define Transform2d eigen2_Transform2d 40 | #define Transform3f eigen2_Transform3f 41 | #define Transform3d eigen2_Transform3d 42 | 43 | #define Translation eigen2_Translation 44 | #define Translation2f eigen2_Translation2f 45 | #define Translation2d eigen2_Translation2d 46 | #define Translation3f eigen2_Translation3f 47 | #define Translation3d eigen2_Translation3d 48 | 49 | #define Scaling eigen2_Scaling 50 | #define Scaling2f eigen2_Scaling2f 51 | #define Scaling2d eigen2_Scaling2d 52 | #define Scaling3f eigen2_Scaling3f 53 | #define Scaling3d eigen2_Scaling3d 54 | 55 | #define AlignedBox eigen2_AlignedBox 56 | 57 | #define Hyperplane eigen2_Hyperplane 58 | #define ParametrizedLine eigen2_ParametrizedLine 59 | 60 | #define ei_toRotationMatrix eigen2_ei_toRotationMatrix 61 | #define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl 62 | #define ei_transform_product_impl eigen2_ei_transform_product_impl 63 | 64 | #include "RotationBase.h" 65 | #include "Rotation2D.h" 66 | #include "Quaternion.h" 67 | #include "AngleAxis.h" 68 | #include "Transform.h" 69 | #include "Translation.h" 70 | #include "Scaling.h" 71 | #include "AlignedBox.h" 72 | #include "Hyperplane.h" 73 | #include "ParametrizedLine.h" 74 | 75 | #undef ei_toRotationMatrix 76 | #undef ei_quaternion_assign_impl 77 | #undef ei_transform_product_impl 78 | 79 | #undef RotationBase 80 | #undef Rotation2D 81 | #undef Rotation2Df 82 | #undef Rotation2Dd 83 | 84 | #undef Quaternion 85 | #undef Quaternionf 86 | #undef Quaterniond 87 | 88 | #undef AngleAxis 89 | #undef AngleAxisf 90 | #undef AngleAxisd 91 | 92 | #undef Transform 93 | #undef Transform2f 94 | #undef Transform2d 95 | #undef Transform3f 96 | #undef Transform3d 97 | 98 | #undef Translation 99 | #undef Translation2f 100 | #undef Translation2d 101 | #undef Translation3f 102 | #undef Translation3d 103 | 104 | #undef Scaling 105 | #undef Scaling2f 106 | #undef Scaling2d 107 | #undef Scaling3f 108 | #undef Scaling3d 109 | 110 | #undef AlignedBox 111 | 112 | #undef Hyperplane 113 | #undef ParametrizedLine 114 | 115 | #endif // EIGEN2_GEOMETRY_MODULE_H 116 | -------------------------------------------------------------------------------- /algorithm/eigen/src/SparseCore/SparseView.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 | // Copyright (C) 2010 Daniel Lowengrub 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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSEVIEW_H 12 | #define EIGEN_SPARSEVIEW_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | struct traits > : traits 20 | { 21 | typedef typename MatrixType::Index Index; 22 | typedef Sparse StorageKind; 23 | enum { 24 | Flags = int(traits::Flags) & (RowMajorBit) 25 | }; 26 | }; 27 | 28 | } // end namespace internal 29 | 30 | template 31 | class SparseView : public SparseMatrixBase > 32 | { 33 | typedef typename MatrixType::Nested MatrixTypeNested; 34 | typedef typename internal::remove_all::type _MatrixTypeNested; 35 | public: 36 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView) 37 | 38 | SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0), 39 | typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) : 40 | m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {} 41 | 42 | class InnerIterator; 43 | 44 | inline Index rows() const { return m_matrix.rows(); } 45 | inline Index cols() const { return m_matrix.cols(); } 46 | 47 | inline Index innerSize() const { return m_matrix.innerSize(); } 48 | inline Index outerSize() const { return m_matrix.outerSize(); } 49 | 50 | protected: 51 | MatrixTypeNested m_matrix; 52 | Scalar m_reference; 53 | typename NumTraits::Real m_epsilon; 54 | }; 55 | 56 | template 57 | class SparseView::InnerIterator : public _MatrixTypeNested::InnerIterator 58 | { 59 | typedef typename SparseView::Index Index; 60 | public: 61 | typedef typename _MatrixTypeNested::InnerIterator IterBase; 62 | InnerIterator(const SparseView& view, Index outer) : 63 | IterBase(view.m_matrix, outer), m_view(view) 64 | { 65 | incrementToNonZero(); 66 | } 67 | 68 | EIGEN_STRONG_INLINE InnerIterator& operator++() 69 | { 70 | IterBase::operator++(); 71 | incrementToNonZero(); 72 | return *this; 73 | } 74 | 75 | using IterBase::value; 76 | 77 | protected: 78 | const SparseView& m_view; 79 | 80 | private: 81 | void incrementToNonZero() 82 | { 83 | while((bool(*this)) && internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon)) 84 | { 85 | IterBase::operator++(); 86 | } 87 | } 88 | }; 89 | 90 | template 91 | const SparseView MatrixBase::sparseView(const Scalar& m_reference, 92 | const typename NumTraits::Real& m_epsilon) const 93 | { 94 | return SparseView(derived(), m_reference, m_epsilon); 95 | } 96 | 97 | } // end namespace Eigen 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /algorithm/eigen/src/misc/Image.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 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 http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_IMAGE_H 11 | #define EIGEN_MISC_IMAGE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class image_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 27 | // dimension is the number of rows of the original matrix 28 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 29 | MatrixType::Options, 30 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 31 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 32 | > ReturnType; 33 | }; 34 | 35 | template struct image_retval_base 36 | : public ReturnByValue > 37 | { 38 | typedef _DecompositionType DecompositionType; 39 | typedef typename DecompositionType::MatrixType MatrixType; 40 | typedef ReturnByValue Base; 41 | typedef typename Base::Index Index; 42 | 43 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 44 | : m_dec(dec), m_rank(dec.rank()), 45 | m_cols(m_rank == 0 ? 1 : m_rank), 46 | m_originalMatrix(originalMatrix) 47 | {} 48 | 49 | inline Index rows() const { return m_dec.rows(); } 50 | inline Index cols() const { return m_cols; } 51 | inline Index rank() const { return m_rank; } 52 | inline const DecompositionType& dec() const { return m_dec; } 53 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | const MatrixType& m_originalMatrix; 64 | }; 65 | 66 | } // end namespace internal 67 | 68 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 69 | typedef typename DecompositionType::MatrixType MatrixType; \ 70 | typedef typename MatrixType::Scalar Scalar; \ 71 | typedef typename MatrixType::RealScalar RealScalar; \ 72 | typedef typename MatrixType::Index Index; \ 73 | typedef Eigen::internal::image_retval_base Base; \ 74 | using Base::dec; \ 75 | using Base::originalMatrix; \ 76 | using Base::rank; \ 77 | using Base::rows; \ 78 | using Base::cols; \ 79 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 80 | : Base(dec, originalMatrix) {} 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_MISC_IMAGE_H 85 | -------------------------------------------------------------------------------- /algorithm/DynamicFusion/MicrosoftKinect.h: -------------------------------------------------------------------------------- 1 | /***********************************************************/ 2 | /** \file 3 | \brief Microsoft Kinect with Microsoft Kinect SDK 4 | \author Yizhong Zhang 5 | \date 11/15/2012 6 | */ 7 | /***********************************************************/ 8 | #ifndef __MICROSOFT_KINECT_H__ 9 | #define __MICROSOFT_KINECT_H__ 10 | 11 | // the following control version of kinect 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "definations.h" 19 | #ifndef ENABLE_KINECT_20 20 | #define ENABLE_KINECT_10 21 | #endif 22 | 23 | #ifdef ENABLE_KINECT_10 24 | # include 25 | # pragma comment(lib, "Kinect10.lib") 26 | #endif 27 | 28 | #ifdef ENABLE_KINECT_20 29 | # include 30 | # pragma comment(lib, "kinect20.lib") 31 | #endif 32 | 33 | struct Point3D{ 34 | float X; 35 | float Y; 36 | float Z; 37 | }; 38 | 39 | struct RGB24Pixel{ 40 | unsigned char nRed; 41 | unsigned char nGreen; 42 | unsigned char nBlue; 43 | }; 44 | 45 | struct BGRA32Pixel{ 46 | unsigned char nBlue; 47 | unsigned char nGreen; 48 | unsigned char nRed; 49 | unsigned char alpha; 50 | }; 51 | 52 | 53 | class Microsoft_Kinect{ 54 | public: 55 | // constructor and destructor 56 | Microsoft_Kinect(); 57 | int InitKinect(); 58 | ~Microsoft_Kinect(); 59 | void FreeSpace(); 60 | 61 | // the size of buffer must be 640*480 and continues. 62 | // if depth/pBGRA==nullptr, then ignored. 63 | int GetDepthColorIntoBuffer(dfusion::depthtype* depth, unsigned char* pBGRA, 64 | bool map2depth = true, bool mirror_input = true); 65 | 66 | // get data 67 | int GetDepthMap(bool mirror); 68 | int GetColorMap(bool mirror); 69 | int ReadAccelerometer(float gravity[3]); 70 | public: 71 | // current frame id 72 | int frame_id; 73 | Microsoft_Kinect* ref_kinect; 74 | 75 | // depth data 76 | int dep_width, dep_height; 77 | float dep_h_fov, dep_v_fov; 78 | 79 | // color data 80 | int img_width, img_height; 81 | float img_h_fov, img_v_fov; 82 | BGRA32Pixel* image_map; 83 | 84 | #ifdef ENABLE_KINECT_10 85 | NUI_DEPTH_IMAGE_PIXEL* depth_map; 86 | INuiCoordinateMapper* pMapper; 87 | std::vector coordMapping; 88 | // Kinect SDK Interface, v1 89 | INuiSensor* pNuiSensor; 90 | HANDLE pColorStreamHandle; 91 | HANDLE pDepthStreamHandle; 92 | HANDLE hNextColorFrameEvent; 93 | HANDLE hNextDepthFrameEvent; 94 | #endif 95 | 96 | #ifdef ENABLE_KINECT_20 97 | UINT16* depth_map; 98 | // Kinect interface v2.0 99 | IKinectSensor* m_pKinectSensor; // Current Kinect 100 | IDepthFrameReader* m_pDepthFrameReader; // Depth reader 101 | #endif 102 | 103 | private: 104 | // kinect v1.0 functions 105 | int InitKinect10(); 106 | int FreeSpace10(); 107 | int GetDepthMap10(bool mirror); 108 | 109 | // kinect v2.0 functions 110 | int InitKinect20(); 111 | int FreeSpace20(); 112 | int GetDepthMap20(); 113 | 114 | void ErrorCheck( HRESULT status, std::string str ); 115 | }; 116 | 117 | 118 | template 119 | inline void SafeRelease(Interface *& pInterfaceToRelease) 120 | { 121 | if (pInterfaceToRelease != NULL) 122 | { 123 | pInterfaceToRelease->Release(); 124 | pInterfaceToRelease = NULL; 125 | } 126 | } 127 | 128 | #endif 129 | -------------------------------------------------------------------------------- /algorithm/Renderable/AbstractMesh.h: -------------------------------------------------------------------------------- 1 | #ifndef __ABSTRACTMESH_H__ 2 | #define __ABSTRACTMESH_H__ 3 | 4 | #include 5 | #include 6 | #include "Renderable.h" 7 | using namespace ldp; 8 | using namespace std; 9 | 10 | class TriMesh; 11 | class AbstractMesh: public Renderable 12 | { 13 | friend class ObjLoader; 14 | friend class OffLoader; 15 | public: 16 | const static Float3 SELECT_COLOR; 17 | const static Float3 NON_SEL_COLOR; 18 | protected: 19 | string name; 20 | Float3 boundingBox[2];//boudingBox[0]=min, boundingBox[1]=max 21 | vectorvertices; 22 | vectorcolors; 23 | vectornormals;//vertex normals 24 | vector isVertSelected; 25 | public: 26 | AbstractMesh(void); 27 | virtual ~AbstractMesh(void); 28 | 29 | virtual void clear(){ 30 | vertices.clear(); 31 | normals.clear(); 32 | colors.clear(); 33 | isVertSelected.clear(); 34 | } 35 | 36 | virtual void toTriMesh(TriMesh* store)const{}//convert a general mesh to a triangle mesh 37 | 38 | virtual void renderConstColor(Float3 color)const{} 39 | virtual void render(int showType, int frameIndex=0){} 40 | virtual void generateNormals(){} 41 | virtual void getFaces(vector& store)const{}//3*int for trimesh and 4*int for quadmesh 42 | virtual void getEdges(vector& store)const{} 43 | virtual void getFaceNormals(vector& store)const{}//get face normals 44 | virtual void generateEdges(){} 45 | virtual void setFaces(vector& input){} 46 | virtual int getMeshType()const{return TYPE_ABSTRACT;} 47 | 48 | virtual Float3* getVertexPointer(){return &vertices[0];} 49 | virtual Float3* getNormalPointer(){return &normals[0];} 50 | virtual Int2* getEdgePointer(){return 0;} 51 | virtual int* getFacePointer(){return 0;} 52 | virtual Float3* getFaceNormalPointer(){return 0;} 53 | 54 | bool isVertexSelected(int i)const{return isVertSelected[i]==1;} 55 | void setVertexSelected(int i, bool select); 56 | void getVertices(vector& store)const; 57 | void setVertices(const vector& input, bool isNormalsGen=true); 58 | void getNormals(vector& store)const;//get vertex normals 59 | 60 | //getters for single primitives 61 | void getVertex(int idx, Float3& store)const{ 62 | store = vertices[idx]; 63 | } 64 | void getNormal(int idx, Float3& store)const{ 65 | store = normals[idx]; 66 | } 67 | void getBoundingBox(Float3 bBox[2])const{ 68 | bBox[0] = boundingBox[0]; 69 | bBox[1] = boundingBox[1]; 70 | } 71 | int getNumVerts()const{ 72 | return vertices.size(); 73 | } 74 | virtual int getNumFaces()const{return -1;}//this should be down by children 75 | virtual int getNumEdges()const{return -1;} 76 | virtual void getFace(int idx, Int4 &store)const{} 77 | virtual void getFace(int idx, Int3 &store)const{} 78 | virtual void getEdge(int idx, Int2 &store)const{} 79 | 80 | //setters for single primitives 81 | void setVertex(int idx,const Float3& input){ 82 | vertices[idx] = input; 83 | } 84 | void setNormal(int idx,const Float3& input){ 85 | normals[idx] = input; 86 | } 87 | void setBoundingBox(const Float3 bBox[2]){ 88 | boundingBox[0] = bBox[0]; 89 | boundingBox[1] = bBox[1]; 90 | } 91 | 92 | 93 | virtual void setFace(int idx,const Int4 &input){} 94 | virtual void setFace(int idx,const Int3 &input){} 95 | virtual void setEdge(int idx,const Int2 &input){} 96 | 97 | }; 98 | 99 | 100 | #endif //_ABSTRACTMESH_H__ 101 | -------------------------------------------------------------------------------- /algorithm/kdtree/BSphere.h: -------------------------------------------------------------------------------- 1 | /* 2 | This file is part of Mitsuba, a physically based rendering system. 3 | 4 | Copyright (c) 2007-2012 by Wenzel Jakob and others. 5 | 6 | Mitsuba is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License Version 3 8 | as published by the Free Software Foundation. 9 | 10 | Mitsuba is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "Ray.h" 22 | #include 23 | 24 | namespace ldp 25 | { 26 | namespace kdtree 27 | { 28 | #undef min 29 | #undef max 30 | 31 | /** \brief Bounding sphere data structure in three dimensions 32 | * 33 | * \ingroup libcore 34 | * \ingroup libpython 35 | */ 36 | struct BSphere { 37 | Point center; 38 | real radius; 39 | 40 | /// Construct a bounding sphere at the origin having radius zero 41 | inline BSphere() : center(0.0f), radius(0.0f) { } 42 | 43 | /// Create a bounding sphere from a given center point and radius 44 | inline BSphere(const Point ¢er, real radius) 45 | : center(center), radius(radius) { 46 | } 47 | 48 | /// Copy constructor 49 | inline BSphere(const BSphere &boundingSphere) 50 | : center(boundingSphere.center), radius(boundingSphere.radius) { 51 | } 52 | 53 | /// Return whether this bounding sphere has a radius of zero or less. 54 | inline bool isEmpty() const { 55 | return radius <= 0.0f; 56 | } 57 | 58 | /// Expand the bounding sphere radius to contain another point. 59 | inline void expandBy(const Point p) { 60 | radius = std::max(radius, (p - center).length()); 61 | } 62 | 63 | /// Check whether the specified point is inside or on the sphere 64 | inline bool contains(const Point p) const { 65 | return (p - center).length() <= radius; 66 | } 67 | 68 | /// Equality test 69 | inline bool operator==(const BSphere &boundingSphere) const { 70 | return center == boundingSphere.center && radius == boundingSphere.radius; 71 | } 72 | 73 | /// Inequality test 74 | inline bool operator!=(const BSphere &boundingSphere) const { 75 | return center != boundingSphere.center || radius != boundingSphere.radius; 76 | } 77 | 78 | /** 79 | * \brief Calculate the intersection points with the given ray 80 | * \return \c true if the ray intersects the bounding sphere 81 | * 82 | * \remark In the Python bindings, this function returns the 83 | * \c nearT and \c farT values as a tuple (or \c None, when no 84 | * intersection was found) 85 | */ 86 | inline bool rayIntersect(const Ray &ray, real &nearHit, real &farHit) const { 87 | Vec3 o = ray.o - center; 88 | real A = ray.d.sqrLength(); 89 | real B = 2 * o.dot(ray.d); 90 | real C = o.sqrLength() - radius*radius; 91 | 92 | return solveQuadratic(A, B, C, nearHit, farHit); 93 | } 94 | 95 | /// Return a string representation of the bounding sphere 96 | inline std::string toString() const { 97 | return ""; 98 | } 99 | }; 100 | }// namespace mitsuba 101 | }// namespace ldp 102 | -------------------------------------------------------------------------------- /algorithm/camera/Camera.h: -------------------------------------------------------------------------------- 1 | #ifndef __CAMERA_H__ 2 | #define __CAMERA_H__ 3 | 4 | #include "../ldpMat/ldp_basic_mat.h" 5 | using namespace ldp; 6 | class Camera 7 | { 8 | public: 9 | Camera(void); 10 | Camera(const Camera& r); 11 | ~Camera(void); 12 | 13 | /** 14 | * Apply the transform matrix to current glContex 15 | * */ 16 | void apply()const; 17 | 18 | void reset(); 19 | /** 20 | * Directly set transform matrix to the camera. 21 | * The corresponding frustum infos are not changed. 22 | * */ 23 | void setModelViewMatrix(const Mat4f& rhs); 24 | Mat4f getModelViewMatrix()const; 25 | 26 | void setProjectionMatrix(const Mat4f& rhs); 27 | Mat4f getProjectionMatrix()const; 28 | 29 | /** 30 | * Convinient method, change direction of camera to (target-location) 31 | * !Note: this method doesn't change frustum infomations, e.g. frustumLeft 32 | * but change the modelView matrix 33 | * */ 34 | void lookAt(const Float3& location,const Float3& target, const Float3& up); 35 | 36 | Float3 getWorldCoords(const Float3& screenCoords)const; 37 | Float3 getScreenCoords(const Float3& worldCoords)const; 38 | 39 | /** 40 | * Some getters and setters 41 | * */ 42 | void setViewPort(float vLeft, float vRight, float vTop, float vBottom); 43 | float getViewPortLeft()const; 44 | float getViewPortRight()const; 45 | float getViewPortTop()const; 46 | float getViewPortBottom()const; 47 | 48 | void setFrustum(float fLeft, float fRight, float fTop, float fBottom,float fNear, float fFar ); 49 | float getFrustumLeft()const; 50 | float getFrustumRight()const; 51 | float getFrustumTop()const; 52 | float getFrustumBottom()const; 53 | float getFrustumNear()const; 54 | float getFrustumFar()const; 55 | 56 | void setLocation(const Float3& location); 57 | Float3 getLocation()const; 58 | void setDirection(const Float3& direction); 59 | Float3 getDirection()const; 60 | void setUp(const Float3& up); 61 | Float3 getUp()const; 62 | void setScalar(const Float3& scalar); 63 | Float3 getScalar()const; 64 | 65 | void scale(const Float3& scalar); 66 | void translate(const Float3& transvec); 67 | 68 | //isOrtho=false is set in this method 69 | void setPerspective(float fov, float aspect, float fNear, float fFar); 70 | float getFov()const; 71 | float getAspect()const; 72 | 73 | /** 74 | * Arcball related 75 | * */ 76 | void arcballClick(Float2 pos);//call me when button clicked 77 | void arcballDrag(Float2 pos);//call me when mouse dragged. 78 | 79 | /** 80 | * Enable/Disable ortho 81 | * */ 82 | void enableOrtho(bool enable); 83 | bool isOrthoEnabled()const; 84 | 85 | /** 86 | * Interperlation 87 | * */ 88 | const Camera& interpolateModelViewMatrixWith(const Camera& rhs, float s); 89 | 90 | /** 91 | * Save/Load 92 | * */ 93 | bool save(const char* fileName)const; 94 | bool load(const char* fileName); 95 | bool save(FILE* pFile)const; 96 | bool load(FILE* pFile); 97 | 98 | protected: 99 | bool isOrtho; 100 | Mat4f projection; 101 | Mat4f modelView; 102 | Mat4f modelViewProjection; 103 | Mat4f invModelViewProjection; 104 | 105 | float viewPortLeft; 106 | float viewPortRight; 107 | float viewPortTop; 108 | float viewPortBottom; 109 | 110 | //arcball related 111 | Float3 stVec;//saved clicked vector 112 | Mat3f lastRot; 113 | protected: 114 | /** 115 | * Update the transform matrix 116 | * */ 117 | Float3 arcballSphereMap(Float2 pos) const; 118 | }; 119 | 120 | #endif //__CAMERA_H__ 121 | -------------------------------------------------------------------------------- /dynamicfusionui.h: -------------------------------------------------------------------------------- 1 | #ifndef DYNAMICFUSIONUI_H 2 | #define DYNAMICFUSIONUI_H 3 | 4 | #include 5 | #include "ui_dynamicfusionui.h" 6 | 7 | class DynamicFusionUI : public QMainWindow 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | DynamicFusionUI(QWidget *parent = 0); 13 | ~DynamicFusionUI(); 14 | 15 | void timerEvent(QTimerEvent* ev); 16 | void dragEnterEvent(QDragEnterEvent* ev); 17 | void dropEvent(QDropEvent *ev); 18 | 19 | public slots: 20 | void on_actionSave_triggered(); 21 | void on_actionLoad_triggered(); 22 | void on_actionLoad_frames_triggered(); 23 | void on_actionRecord_frames_triggered(); 24 | void on_actionLoad_volume_triggered(); 25 | void on_actionSave_current_mesh_triggered(); 26 | void on_actionPause_triggered(); 27 | void on_actionExport_mesh_triggered(); 28 | void on_rbRayCasting_clicked(); 29 | void on_rbMarchCube_clicked(); 30 | void on_pbReset_clicked(); 31 | 32 | void on_rbResX128_clicked(); 33 | void on_rbResX256_clicked(); 34 | void on_rbResX384_clicked(); 35 | void on_rbResX512_clicked(); 36 | void on_rbResY128_clicked(); 37 | void on_rbResY256_clicked(); 38 | void on_rbResY384_clicked(); 39 | void on_rbResY512_clicked(); 40 | void on_rbResZ128_clicked(); 41 | void on_rbResZ256_clicked(); 42 | void on_rbResZ384_clicked(); 43 | void on_rbResZ512_clicked(); 44 | void on_sbVoxelsPerMeter_valueChanged(int v); 45 | 46 | void on_cbNoRigid_clicked(); 47 | void on_cbShowMesh_clicked(); 48 | void on_cbShowColor_clicked(); 49 | void on_cbShowNodes_clicked(); 50 | void on_cbShowGraph_clicked(); 51 | void on_cbShowCorr_clicked(); 52 | void on_sbShowGraphLevel_valueChanged(int); 53 | void on_sbActiveNode_valueChanged(int v); 54 | 55 | void on_sbNodeRadius_valueChanged(int v); 56 | void on_dbDwLvScale_valueChanged(double v); 57 | void on_dbDwSoft_valueChanged(double v); 58 | void on_sbICPIter_valueChanged(int v); 59 | void on_sbGSIter_valueChanged(int v); 60 | void on_cbDumpFrames_clicked(); 61 | void on_cbEnableNonRigid_clicked(); 62 | void on_dbBeta_valueChanged(double v); 63 | void on_dbLambda_valueChanged(double v); 64 | 65 | void on_gbAutoReset_clicked(); 66 | void on_sbAutoResetSeconds_valueChanged(int v); 67 | void on_sbMaxWeights_valueChanged(int v); 68 | void on_dbGSStep_valueChanged(double v); 69 | 70 | void on_pbDebug_clicked(); 71 | void on_sbFrmIdxPlus_valueChanged(int v); 72 | void on_pbUpdateParam_clicked(); 73 | void on_pbSaveCamera_clicked(); 74 | void on_pbLoadCamera_clicked(); 75 | 76 | void on_cbEnableRigid_clicked(); 77 | protected: 78 | void updateUiFromParam(); 79 | 80 | void frameLoading(); 81 | void frameSaving(); 82 | void frameLive(); 83 | 84 | void updateLoadedStaticVolume(); 85 | void updateDynamicFusion(); 86 | 87 | private: 88 | Ui::DynamicFusionUIClass ui; 89 | 90 | int m_fpsTimerId; 91 | int m_autoResetTimerId; 92 | double m_autoResetRemaingTime; 93 | 94 | enum State 95 | { 96 | Pause, 97 | Loading, 98 | Saving, 99 | Live, 100 | ShowLoadedStaticVolume, 101 | }; 102 | enum RenderType 103 | { 104 | RenderRayCasting, 105 | RenderMarchCube, 106 | }; 107 | State m_state; 108 | State m_lastState; 109 | RenderType m_renderType; 110 | QString m_currentPath; 111 | bool m_view_normalmap; 112 | int m_frameIndex; 113 | private: 114 | 115 | void setState(State s){ m_lastState = m_state; m_state = s; } 116 | void restoreState(){ m_state = m_lastState; } 117 | }; 118 | 119 | #endif // DYNAMICFUSIONUI_H 120 | -------------------------------------------------------------------------------- /algorithm/eigen/src/Core/ReturnByValue.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 | // Copyright (C) 2009-2010 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 http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_RETURNBYVALUE_H 12 | #define EIGEN_RETURNBYVALUE_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class ReturnByValue 17 | * \ingroup Core_Module 18 | * 19 | */ 20 | 21 | namespace internal { 22 | 23 | template 24 | struct traits > 25 | : public traits::ReturnType> 26 | { 27 | enum { 28 | // We're disabling the DirectAccess because e.g. the constructor of 29 | // the Block-with-DirectAccess expression requires to have a coeffRef method. 30 | // Also, we don't want to have to implement the stride stuff. 31 | Flags = (traits::ReturnType>::Flags 32 | | EvalBeforeNestingBit) & ~DirectAccessBit 33 | }; 34 | }; 35 | 36 | /* The ReturnByValue object doesn't even have a coeff() method. 37 | * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. 38 | * So internal::nested always gives the plain return matrix type. 39 | * 40 | * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? 41 | */ 42 | template 43 | struct nested, n, PlainObject> 44 | { 45 | typedef typename traits::ReturnType type; 46 | }; 47 | 48 | } // end namespace internal 49 | 50 | template class ReturnByValue 51 | : internal::no_assignment_operator, public internal::dense_xpr_base< ReturnByValue >::type 52 | { 53 | public: 54 | typedef typename internal::traits::ReturnType ReturnType; 55 | 56 | typedef typename internal::dense_xpr_base::type Base; 57 | EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) 58 | 59 | template 60 | inline void evalTo(Dest& dst) const 61 | { static_cast(this)->evalTo(dst); } 62 | inline Index rows() const { return static_cast(this)->rows(); } 63 | inline Index cols() const { return static_cast(this)->cols(); } 64 | 65 | #ifndef EIGEN_PARSED_BY_DOXYGEN 66 | #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT 67 | class Unusable{ 68 | Unusable(const Unusable&) {} 69 | Unusable& operator=(const Unusable&) {return *this;} 70 | }; 71 | const Unusable& coeff(Index) const { return *reinterpret_cast(this); } 72 | const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } 73 | Unusable& coeffRef(Index) { return *reinterpret_cast(this); } 74 | Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } 75 | #endif 76 | }; 77 | 78 | template 79 | template 80 | Derived& DenseBase::operator=(const ReturnByValue& other) 81 | { 82 | other.evalTo(derived()); 83 | return derived(); 84 | } 85 | 86 | } // end namespace Eigen 87 | 88 | #endif // EIGEN_RETURNBYVALUE_H 89 | --------------------------------------------------------------------------------