├── .gitignore ├── .gitmodules ├── API ├── Makefile ├── build │ └── .gitignore ├── release │ └── include │ │ └── Thallo.h └── src │ ├── ad.t │ ├── asdl.t │ ├── autoscheduler.t │ ├── cpu_cuda.t │ ├── createwrapper.t │ ├── cuda_util.t │ ├── fun.t │ ├── gauss_newton.t │ ├── ir.t │ ├── lib.t │ ├── maybe_emit.t │ ├── pprofiler.t │ ├── precision.t │ ├── thallo.t │ └── util.t ├── README.md ├── examples ├── arap_mesh_deformation │ ├── Makefile │ ├── arap_mesh_deformation.t │ └── src │ │ ├── CUDAWarpingSolver.cpp │ │ ├── CUDAWarpingSolver.h │ │ ├── CombinedSolver.h │ │ ├── LandMark.cpp │ │ ├── LandMark.h │ │ ├── LandMarkSet.cpp │ │ ├── LandMarkSet.h │ │ ├── OpenMesh.h │ │ ├── Resource.h │ │ ├── RotationHelper.h │ │ ├── SolverUtil.h │ │ ├── WarpingSolver.cu │ │ ├── WarpingSolverEquations.h │ │ ├── WarpingSolverParameters.h │ │ ├── WarpingSolverState.h │ │ ├── WarpingSolverUtil.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── basic │ └── out.png ├── bundle_adjustment │ ├── Makefile │ ├── bundle_adjustment.t │ └── src │ │ ├── CombinedSolver.h │ │ ├── bal_problem.cpp │ │ ├── bal_problem.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ └── main.cpp ├── bundle_fusion_solve │ ├── Makefile │ ├── build │ │ └── CUDASolver │ │ │ └── CUDASolverBundling.d │ ├── bundle_fusion_solve.t │ └── src │ │ ├── CUDASolver │ │ ├── CUDACacheUtil.h │ │ ├── CUDACameraUtil.h │ │ ├── CUDASolverBundling.cpp │ │ ├── CUDASolverBundling.h │ │ ├── EntryJ.h │ │ ├── GlobalDefines.h │ │ ├── ICPUtil.h │ │ ├── LieDerivUtil.h │ │ ├── SolverBundling.cu │ │ ├── SolverBundlingDenseUtil.h │ │ ├── SolverBundlingEquations.h │ │ ├── SolverBundlingEquationsLie.h │ │ ├── SolverBundlingParameters.h │ │ ├── SolverBundlingState.h │ │ ├── SolverBundlingUtil.h │ │ └── SolverUtil.h │ │ ├── CombinedSolver.h │ │ ├── OpenMesh.h │ │ ├── cutil │ │ └── inc │ │ │ ├── GL │ │ │ ├── freeglut.h │ │ │ ├── freeglut_ext.h │ │ │ ├── freeglut_std.h │ │ │ ├── glew.h │ │ │ ├── glext.h │ │ │ ├── glut.h │ │ │ ├── glxew.h │ │ │ ├── glxext.h │ │ │ ├── wglew.h │ │ │ └── wglext.h │ │ │ ├── bank_checker.h │ │ │ ├── cmd_arg_reader.h │ │ │ ├── cuda_drvapi_dynlink.c │ │ │ ├── cutil.h │ │ │ ├── cutil_gl_error.h │ │ │ ├── cutil_gl_inline.h │ │ │ ├── cutil_inline.h │ │ │ ├── cutil_inline_bankchecker.h │ │ │ ├── cutil_inline_drvapi.h │ │ │ ├── cutil_inline_runtime.h │ │ │ ├── cutil_math.h │ │ │ ├── drvapi_error_string.h │ │ │ ├── dynlink │ │ │ ├── cuda_drvapi_dynlink.h │ │ │ ├── cuda_drvapi_dynlink_cuda.h │ │ │ ├── cuda_drvapi_dynlink_d3d.h │ │ │ └── cuda_drvapi_dynlink_gl.h │ │ │ ├── dynlink_d3d10.h │ │ │ ├── dynlink_d3d11.h │ │ │ ├── error_checker.h │ │ │ ├── exception.h │ │ │ ├── helper_cuda.h │ │ │ ├── helper_cuda_drvapi.h │ │ │ ├── helper_cuda_gl.h │ │ │ ├── helper_functions.h │ │ │ ├── helper_image.h │ │ │ ├── helper_math.h │ │ │ ├── helper_string.h │ │ │ ├── helper_timer.h │ │ │ ├── multithreading.h │ │ │ ├── nvGLWidgets.h │ │ │ ├── nvGlutWidgets.h │ │ │ ├── nvMath.h │ │ │ ├── nvMatrix.h │ │ │ ├── nvQuaternion.h │ │ │ ├── nvShaderUtils.h │ │ │ ├── nvVector.h │ │ │ ├── nvWidgets.h │ │ │ ├── param.h │ │ │ ├── paramgl.h │ │ │ ├── rendercheck_d3d10.h │ │ │ ├── rendercheck_d3d11.h │ │ │ ├── rendercheck_d3d9.h │ │ │ ├── rendercheck_gl.h │ │ │ ├── sdkHelper.h │ │ │ ├── stopwatch.h │ │ │ ├── stopwatch_base.h │ │ │ ├── stopwatch_base.inl │ │ │ ├── stopwatch_functions.h │ │ │ ├── stopwatch_linux.h │ │ │ ├── stopwatch_win.h │ │ │ └── string_helper.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── cotangent_mesh_smoothing │ ├── Makefile │ ├── cotangent_mesh_smoothing.t │ └── src │ │ ├── CombinedSolver.h │ │ ├── OpenMesh.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ ├── main.h │ │ └── resource.h ├── data │ ├── Armadillo20k.mrk │ ├── StandardDeviationExpression.vec │ ├── StandardDeviationExpressionPCA.vec │ ├── StandardDeviationShapePCA.vec │ ├── bal │ │ ├── dubrovnik │ │ │ └── listing │ │ ├── final │ │ │ └── listing │ │ ├── ladybug │ │ │ └── listing │ │ ├── trafalgar │ │ │ └── listing │ │ └── venice │ │ │ └── listing │ ├── cat512.constraints │ ├── cat512.png │ ├── cat512_mask.png │ ├── cone.ply │ ├── copyright.txt │ ├── dogdance0.png │ ├── dogdance1.png │ ├── g2o │ │ ├── credits.txt │ │ ├── input_M3500_g2o.g2o │ │ └── sphere_bignoise_vertex3.g2o │ ├── head.ply │ ├── poisson0.png │ ├── poisson1.png │ ├── poisson_mask.png │ ├── raptor_simplify2k.mrk │ ├── raptor_simplify2k.off │ ├── shape_from_shading │ │ ├── default.SFSSolverParameters │ │ ├── default_initialUnknown.imagedump │ │ ├── default_maskEdgeMap.imagedump │ │ ├── default_targetDepth.imagedump │ │ └── default_targetIntensity.imagedump │ ├── simple_proximal │ │ ├── K.tif │ │ ├── M.tif │ │ ├── b1.tif │ │ ├── b2.tif │ │ ├── b3.tif │ │ ├── dx.tif │ │ ├── dy.tif │ │ ├── lambda.tif │ │ ├── result.tif │ │ └── x0.tif │ ├── small_armadillo.mrk │ ├── small_armadillo.ply │ ├── sphere.ply │ ├── squat_target │ │ ├── mesh_0043.obj │ │ ├── mesh_0044.obj │ │ ├── mesh_0045.obj │ │ ├── mesh_0046.obj │ │ ├── mesh_0047.obj │ │ ├── mesh_0048.obj │ │ ├── mesh_0049.obj │ │ └── mesh_0050.obj │ ├── sv_deconv │ │ ├── K.tif │ │ ├── M.tif │ │ ├── b1.tif │ │ ├── b2.tif │ │ ├── b3.tif │ │ ├── dx.tif │ │ ├── dy.tif │ │ ├── lambda.tif │ │ ├── result.tif │ │ └── x0.tif │ └── ye_high2.png ├── deconvolution │ ├── Makefile │ └── src │ │ ├── CombinedSolver.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ └── main.cpp ├── embedded_mesh_deformation │ ├── Makefile │ ├── embedded_mesh_deformation.t │ └── src │ │ ├── CombinedSolver.h │ │ ├── LandMark.h │ │ ├── LandMarkSet.h │ │ ├── OpenMesh.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ ├── main.h │ │ └── resource.h ├── external │ ├── Eigen │ │ ├── CMakeLists.txt │ │ ├── Cholesky │ │ ├── CholmodSupport │ │ ├── Core │ │ ├── Dense │ │ ├── Eigen │ │ ├── Eigenvalues │ │ ├── Geometry │ │ ├── Householder │ │ ├── IterativeLinearSolvers │ │ ├── Jacobi │ │ ├── LICENSE.txt │ │ ├── LU │ │ ├── MetisSupport │ │ ├── OrderingMethods │ │ ├── PaStiXSupport │ │ ├── PardisoSupport │ │ ├── QR │ │ ├── QtAlignedMalloc │ │ ├── SPQRSupport │ │ ├── SVD │ │ ├── Sparse │ │ ├── SparseCholesky │ │ ├── SparseCore │ │ ├── SparseLU │ │ ├── SparseQR │ │ ├── StdDeque │ │ ├── StdList │ │ ├── StdVector │ │ ├── SuperLUSupport │ │ ├── UmfPackSupport │ │ └── src │ │ │ ├── CMakeLists.txt │ │ │ ├── Cholesky │ │ │ ├── CMakeLists.txt │ │ │ ├── LDLT.h │ │ │ ├── LLT.h │ │ │ └── LLT_MKL.h │ │ │ ├── CholmodSupport │ │ │ ├── CMakeLists.txt │ │ │ └── CholmodSupport.h │ │ │ ├── Core │ │ │ ├── Array.h │ │ │ ├── ArrayBase.h │ │ │ ├── ArrayWrapper.h │ │ │ ├── Assign.h │ │ │ ├── AssignEvaluator.h │ │ │ ├── Assign_MKL.h │ │ │ ├── BandMatrix.h │ │ │ ├── Block.h │ │ │ ├── BooleanRedux.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CommaInitializer.h │ │ │ ├── CoreEvaluators.h │ │ │ ├── CoreIterators.h │ │ │ ├── CwiseBinaryOp.h │ │ │ ├── CwiseNullaryOp.h │ │ │ ├── CwiseUnaryOp.h │ │ │ ├── CwiseUnaryView.h │ │ │ ├── DenseBase.h │ │ │ ├── DenseCoeffsBase.h │ │ │ ├── DenseStorage.h │ │ │ ├── Diagonal.h │ │ │ ├── DiagonalMatrix.h │ │ │ ├── DiagonalProduct.h │ │ │ ├── Dot.h │ │ │ ├── EigenBase.h │ │ │ ├── ForceAlignedAccess.h │ │ │ ├── Fuzzy.h │ │ │ ├── GeneralProduct.h │ │ │ ├── GenericPacketMath.h │ │ │ ├── GlobalFunctions.h │ │ │ ├── IO.h │ │ │ ├── Inverse.h │ │ │ ├── Map.h │ │ │ ├── MapBase.h │ │ │ ├── MathFunctions.h │ │ │ ├── Matrix.h │ │ │ ├── MatrixBase.h │ │ │ ├── NestByValue.h │ │ │ ├── NoAlias.h │ │ │ ├── NumTraits.h │ │ │ ├── PermutationMatrix.h │ │ │ ├── PlainObjectBase.h │ │ │ ├── Product.h │ │ │ ├── ProductEvaluators.h │ │ │ ├── Random.h │ │ │ ├── Redux.h │ │ │ ├── Ref.h │ │ │ ├── Replicate.h │ │ │ ├── ReturnByValue.h │ │ │ ├── Reverse.h │ │ │ ├── Select.h │ │ │ ├── SelfAdjointView.h │ │ │ ├── SelfCwiseBinaryOp.h │ │ │ ├── Solve.h │ │ │ ├── SolveTriangular.h │ │ │ ├── SolverBase.h │ │ │ ├── SpecialFunctions.h │ │ │ ├── StableNorm.h │ │ │ ├── Stride.h │ │ │ ├── Swap.h │ │ │ ├── Transpose.h │ │ │ ├── Transpositions.h │ │ │ ├── TriangularMatrix.h │ │ │ ├── VectorBlock.h │ │ │ ├── VectorwiseOp.h │ │ │ ├── Visitor.h │ │ │ ├── arch │ │ │ │ ├── AVX │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── AltiVec │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CUDA │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ │ ├── Default │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── Settings.h │ │ │ │ ├── NEON │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ │ └── SSE │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ └── TypeCasting.h │ │ │ ├── functors │ │ │ │ ├── AssignmentFunctors.h │ │ │ │ ├── BinaryFunctors.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── NullaryFunctors.h │ │ │ │ ├── StlFunctors.h │ │ │ │ └── UnaryFunctors.h │ │ │ ├── products │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ │ ├── GeneralMatrixMatrix.h │ │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ │ ├── GeneralMatrixMatrixTriangular_MKL.h │ │ │ │ ├── GeneralMatrixMatrix_MKL.h │ │ │ │ ├── GeneralMatrixVector.h │ │ │ │ ├── GeneralMatrixVector_MKL.h │ │ │ │ ├── Parallelizer.h │ │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ │ ├── SelfadjointMatrixMatrix_MKL.h │ │ │ │ ├── SelfadjointMatrixVector.h │ │ │ │ ├── SelfadjointMatrixVector_MKL.h │ │ │ │ ├── SelfadjointProduct.h │ │ │ │ ├── SelfadjointRank2Update.h │ │ │ │ ├── TriangularMatrixMatrix.h │ │ │ │ ├── TriangularMatrixMatrix_MKL.h │ │ │ │ ├── TriangularMatrixVector.h │ │ │ │ ├── TriangularMatrixVector_MKL.h │ │ │ │ ├── TriangularSolverMatrix.h │ │ │ │ ├── TriangularSolverMatrix_MKL.h │ │ │ │ └── TriangularSolverVector.h │ │ │ └── util │ │ │ │ ├── BlasUtil.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Constants.h │ │ │ │ ├── DisableStupidWarnings.h │ │ │ │ ├── ForwardDeclarations.h │ │ │ │ ├── MKL_support.h │ │ │ │ ├── Macros.h │ │ │ │ ├── Memory.h │ │ │ │ ├── Meta.h │ │ │ │ ├── NonMPL2.h │ │ │ │ ├── ReenableStupidWarnings.h │ │ │ │ ├── StaticAssert.h │ │ │ │ └── XprHelper.h │ │ │ ├── Eigenvalues │ │ │ ├── CMakeLists.txt │ │ │ ├── ComplexEigenSolver.h │ │ │ ├── ComplexSchur.h │ │ │ ├── ComplexSchur_MKL.h │ │ │ ├── EigenSolver.h │ │ │ ├── GeneralizedEigenSolver.h │ │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ │ ├── HessenbergDecomposition.h │ │ │ ├── MatrixBaseEigenvalues.h │ │ │ ├── RealQZ.h │ │ │ ├── RealSchur.h │ │ │ ├── RealSchur_MKL.h │ │ │ ├── SelfAdjointEigenSolver.h │ │ │ ├── SelfAdjointEigenSolver_MKL.h │ │ │ └── Tridiagonalization.h │ │ │ ├── Geometry │ │ │ ├── AlignedBox.h │ │ │ ├── AngleAxis.h │ │ │ ├── CMakeLists.txt │ │ │ ├── EulerAngles.h │ │ │ ├── Homogeneous.h │ │ │ ├── Hyperplane.h │ │ │ ├── OrthoMethods.h │ │ │ ├── ParametrizedLine.h │ │ │ ├── Quaternion.h │ │ │ ├── Rotation2D.h │ │ │ ├── RotationBase.h │ │ │ ├── Scaling.h │ │ │ ├── Transform.h │ │ │ ├── Translation.h │ │ │ ├── Umeyama.h │ │ │ └── arch │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Geometry_SSE.h │ │ │ ├── Householder │ │ │ ├── BlockHouseholder.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Householder.h │ │ │ └── HouseholderSequence.h │ │ │ ├── IterativeLinearSolvers │ │ │ ├── BasicPreconditioners.h │ │ │ ├── BiCGSTAB.h │ │ │ ├── CMakeLists.txt │ │ │ ├── ConjugateGradient.h │ │ │ ├── IncompleteCholesky.h │ │ │ ├── IncompleteLUT.h │ │ │ ├── IterativeSolverBase.h │ │ │ ├── LeastSquareConjugateGradient.h │ │ │ └── SolveWithGuess.h │ │ │ ├── Jacobi │ │ │ ├── CMakeLists.txt │ │ │ └── Jacobi.h │ │ │ ├── LU │ │ │ ├── CMakeLists.txt │ │ │ ├── Determinant.h │ │ │ ├── FullPivLU.h │ │ │ ├── InverseImpl.h │ │ │ ├── PartialPivLU.h │ │ │ ├── PartialPivLU_MKL.h │ │ │ └── arch │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Inverse_SSE.h │ │ │ ├── MetisSupport │ │ │ ├── CMakeLists.txt │ │ │ └── MetisSupport.h │ │ │ ├── OrderingMethods │ │ │ ├── Amd.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Eigen_Colamd.h │ │ │ └── Ordering.h │ │ │ ├── PaStiXSupport │ │ │ ├── CMakeLists.txt │ │ │ └── PaStiXSupport.h │ │ │ ├── PardisoSupport │ │ │ ├── CMakeLists.txt │ │ │ └── PardisoSupport.h │ │ │ ├── QR │ │ │ ├── CMakeLists.txt │ │ │ ├── ColPivHouseholderQR.h │ │ │ ├── ColPivHouseholderQR_MKL.h │ │ │ ├── FullPivHouseholderQR.h │ │ │ ├── HouseholderQR.h │ │ │ └── HouseholderQR_MKL.h │ │ │ ├── SPQRSupport │ │ │ ├── CMakeLists.txt │ │ │ └── SuiteSparseQRSupport.h │ │ │ ├── SVD │ │ │ ├── BDCSVD.h │ │ │ ├── CMakeLists.txt │ │ │ ├── JacobiSVD.h │ │ │ ├── JacobiSVD_MKL.h │ │ │ ├── SVDBase.h │ │ │ └── UpperBidiagonalization.h │ │ │ ├── SparseCholesky │ │ │ ├── CMakeLists.txt │ │ │ ├── SimplicialCholesky.h │ │ │ └── SimplicialCholesky_impl.h │ │ │ ├── SparseCore │ │ │ ├── AmbiVector.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CompressedStorage.h │ │ │ ├── ConservativeSparseSparseProduct.h │ │ │ ├── MappedSparseMatrix.h │ │ │ ├── SparseAssign.h │ │ │ ├── SparseBlock.h │ │ │ ├── SparseColEtree.h │ │ │ ├── SparseCompressedBase.h │ │ │ ├── SparseCwiseBinaryOp.h │ │ │ ├── SparseCwiseUnaryOp.h │ │ │ ├── SparseDenseProduct.h │ │ │ ├── SparseDiagonalProduct.h │ │ │ ├── SparseDot.h │ │ │ ├── SparseFuzzy.h │ │ │ ├── SparseMap.h │ │ │ ├── SparseMatrix.h │ │ │ ├── SparseMatrixBase.h │ │ │ ├── SparsePermutation.h │ │ │ ├── SparseProduct.h │ │ │ ├── SparseRedux.h │ │ │ ├── SparseRef.h │ │ │ ├── SparseSelfAdjointView.h │ │ │ ├── SparseSolverBase.h │ │ │ ├── SparseSparseProductWithPruning.h │ │ │ ├── SparseTranspose.h │ │ │ ├── SparseTriangularView.h │ │ │ ├── SparseUtil.h │ │ │ ├── SparseVector.h │ │ │ ├── SparseView.h │ │ │ └── TriangularSolver.h │ │ │ ├── SparseLU │ │ │ ├── CMakeLists.txt │ │ │ ├── SparseLU.h │ │ │ ├── SparseLUImpl.h │ │ │ ├── SparseLU_Memory.h │ │ │ ├── SparseLU_Structs.h │ │ │ ├── SparseLU_SupernodalMatrix.h │ │ │ ├── SparseLU_Utils.h │ │ │ ├── SparseLU_column_bmod.h │ │ │ ├── SparseLU_column_dfs.h │ │ │ ├── SparseLU_copy_to_ucol.h │ │ │ ├── SparseLU_gemm_kernel.h │ │ │ ├── SparseLU_heap_relax_snode.h │ │ │ ├── SparseLU_kernel_bmod.h │ │ │ ├── SparseLU_panel_bmod.h │ │ │ ├── SparseLU_panel_dfs.h │ │ │ ├── SparseLU_pivotL.h │ │ │ ├── SparseLU_pruneL.h │ │ │ └── SparseLU_relax_snode.h │ │ │ ├── SparseQR │ │ │ ├── CMakeLists.txt │ │ │ └── SparseQR.h │ │ │ ├── StlSupport │ │ │ ├── CMakeLists.txt │ │ │ ├── StdDeque.h │ │ │ ├── StdList.h │ │ │ ├── StdVector.h │ │ │ └── details.h │ │ │ ├── SuperLUSupport │ │ │ ├── CMakeLists.txt │ │ │ └── SuperLUSupport.h │ │ │ ├── UmfPackSupport │ │ │ ├── CMakeLists.txt │ │ │ └── UmfPackSupport.h │ │ │ ├── misc │ │ │ ├── CMakeLists.txt │ │ │ ├── Image.h │ │ │ ├── Kernel.h │ │ │ └── blas.h │ │ │ └── plugins │ │ │ ├── ArrayCwiseBinaryOps.h │ │ │ ├── ArrayCwiseUnaryOps.h │ │ │ ├── BlockMethods.h │ │ │ ├── CMakeLists.txt │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ ├── CommonCwiseUnaryOps.h │ │ │ ├── MatrixCwiseBinaryOps.h │ │ │ └── MatrixCwiseUnaryOps.h │ ├── FreeImage │ │ ├── include │ │ │ └── FreeImage │ │ │ │ └── FreeImage.h │ │ └── lib │ │ │ ├── VS2013 │ │ │ ├── FreeImage.lib │ │ │ └── FreeImaged.lib │ │ │ └── linux │ │ │ ├── libfreeimage-3.18.0.so │ │ │ └── libfreeimage.a │ ├── OpenMesh │ │ ├── LICENSE.txt │ │ ├── include │ │ │ └── OpenMesh │ │ │ │ ├── Core │ │ │ │ ├── Geometry │ │ │ │ │ ├── Config.hh │ │ │ │ │ ├── LoopSchemeMaskT.hh │ │ │ │ │ ├── MathDefs.hh │ │ │ │ │ ├── NormalConeT.cc │ │ │ │ │ ├── NormalConeT.hh │ │ │ │ │ ├── Plane3d.hh │ │ │ │ │ ├── QuadricT.hh │ │ │ │ │ ├── Vector11T.hh │ │ │ │ │ ├── VectorT.hh │ │ │ │ │ └── VectorT_inc.hh │ │ │ │ ├── IO │ │ │ │ │ ├── BinaryHelper.hh │ │ │ │ │ ├── IOInstances.hh │ │ │ │ │ ├── IOManager.hh │ │ │ │ │ ├── MeshIO.hh │ │ │ │ │ ├── OFFFormat.hh │ │ │ │ │ ├── OMFormat.cc │ │ │ │ │ ├── OMFormat.hh │ │ │ │ │ ├── OMFormatT.cc │ │ │ │ │ ├── Options.hh │ │ │ │ │ ├── SR_binary.hh │ │ │ │ │ ├── SR_binary_spec.hh │ │ │ │ │ ├── SR_binary_vector_of_bool.inl │ │ │ │ │ ├── SR_binary_vector_of_fundamentals.inl │ │ │ │ │ ├── SR_binary_vector_of_string.inl │ │ │ │ │ ├── SR_rbo.hh │ │ │ │ │ ├── SR_store.hh │ │ │ │ │ ├── SR_types.hh │ │ │ │ │ ├── StoreRestore.hh │ │ │ │ │ ├── exporter │ │ │ │ │ │ ├── BaseExporter.hh │ │ │ │ │ │ └── ExporterT.hh │ │ │ │ │ ├── importer │ │ │ │ │ │ ├── BaseImporter.hh │ │ │ │ │ │ └── ImporterT.hh │ │ │ │ │ ├── reader │ │ │ │ │ │ ├── BaseReader.hh │ │ │ │ │ │ ├── OBJReader.hh │ │ │ │ │ │ ├── OFFReader.hh │ │ │ │ │ │ ├── OMReader.hh │ │ │ │ │ │ ├── PLYReader.hh │ │ │ │ │ │ └── STLReader.hh │ │ │ │ │ └── writer │ │ │ │ │ │ ├── BaseWriter.hh │ │ │ │ │ │ ├── OBJWriter.hh │ │ │ │ │ │ ├── OFFWriter.hh │ │ │ │ │ │ ├── OMWriter.hh │ │ │ │ │ │ ├── PLYWriter.hh │ │ │ │ │ │ ├── STLWriter.hh │ │ │ │ │ │ └── VTKWriter.hh │ │ │ │ ├── Mesh │ │ │ │ │ ├── ArrayItems.hh │ │ │ │ │ ├── ArrayKernel.hh │ │ │ │ │ ├── ArrayKernelT.cc │ │ │ │ │ ├── AttribKernelT.hh │ │ │ │ │ ├── Attributes.hh │ │ │ │ │ ├── BaseKernel.hh │ │ │ │ │ ├── BaseMesh.hh │ │ │ │ │ ├── Casts.hh │ │ │ │ │ ├── CirculatorsT.hh │ │ │ │ │ ├── FinalMeshItemsT.hh │ │ │ │ │ ├── Handles.hh │ │ │ │ │ ├── IteratorsT.hh │ │ │ │ │ ├── PolyConnectivity.hh │ │ │ │ │ ├── PolyMeshT.cc │ │ │ │ │ ├── PolyMeshT.hh │ │ │ │ │ ├── PolyMesh_ArrayKernelT.hh │ │ │ │ │ ├── Status.hh │ │ │ │ │ ├── Traits.hh │ │ │ │ │ ├── TriConnectivity.hh │ │ │ │ │ ├── TriMeshT.cc │ │ │ │ │ ├── TriMeshT.hh │ │ │ │ │ ├── TriMesh_ArrayKernelT.hh │ │ │ │ │ └── gen │ │ │ │ │ │ ├── circulators_header.hh │ │ │ │ │ │ ├── circulators_template.hh │ │ │ │ │ │ ├── footer.hh │ │ │ │ │ │ ├── iterators_header.hh │ │ │ │ │ │ └── iterators_template.hh │ │ │ │ ├── System │ │ │ │ │ ├── OpenMeshDLLMacros.hh │ │ │ │ │ ├── compiler.hh │ │ │ │ │ ├── config.h │ │ │ │ │ ├── config.hh │ │ │ │ │ ├── mostream.hh │ │ │ │ │ └── omstream.hh │ │ │ │ └── Utils │ │ │ │ │ ├── AutoPropertyHandleT.hh │ │ │ │ │ ├── BaseProperty.hh │ │ │ │ │ ├── Endian.hh │ │ │ │ │ ├── GenProg.hh │ │ │ │ │ ├── Noncopyable.hh │ │ │ │ │ ├── Property.hh │ │ │ │ │ ├── PropertyContainer.hh │ │ │ │ │ ├── PropertyManager.hh │ │ │ │ │ ├── RandomNumberGenerator.hh │ │ │ │ │ ├── SingletonT.cc │ │ │ │ │ ├── SingletonT.hh │ │ │ │ │ ├── color_cast.hh │ │ │ │ │ ├── vector_cast.hh │ │ │ │ │ └── vector_traits.hh │ │ │ │ └── Tools │ │ │ │ ├── Decimater │ │ │ │ ├── BaseDecimaterT.cc │ │ │ │ ├── BaseDecimaterT.hh │ │ │ │ ├── CollapseInfoT.hh │ │ │ │ ├── DecimaterT.cc │ │ │ │ ├── DecimaterT.hh │ │ │ │ ├── McDecimaterT.cc │ │ │ │ ├── McDecimaterT.hh │ │ │ │ ├── MixedDecimaterT.cc │ │ │ │ ├── MixedDecimaterT.hh │ │ │ │ ├── ModAspectRatioT.cc │ │ │ │ ├── ModAspectRatioT.hh │ │ │ │ ├── ModBaseT.hh │ │ │ │ ├── ModEdgeLengthT.cc │ │ │ │ ├── ModEdgeLengthT.hh │ │ │ │ ├── ModHausdorffT.cc │ │ │ │ ├── ModHausdorffT.hh │ │ │ │ ├── ModIndependentSetsT.hh │ │ │ │ ├── ModNormalDeviationT.hh │ │ │ │ ├── ModNormalFlippingT.hh │ │ │ │ ├── ModProgMeshT.cc │ │ │ │ ├── ModProgMeshT.hh │ │ │ │ ├── ModQuadricT.cc │ │ │ │ ├── ModQuadricT.hh │ │ │ │ ├── ModRoundnessT.hh │ │ │ │ └── Observer.hh │ │ │ │ ├── Dualizer │ │ │ │ └── meshDualT.hh │ │ │ │ ├── Kernel_OSG │ │ │ │ ├── ArrayKernelT.hh │ │ │ │ ├── AttribKernelT.hh │ │ │ │ ├── PropertyKernel.hh │ │ │ │ ├── PropertyT.hh │ │ │ │ ├── Traits.hh │ │ │ │ ├── TriMesh_OSGArrayKernelT.hh │ │ │ │ ├── VectorAdapter.hh │ │ │ │ ├── bindT.hh │ │ │ │ └── color_cast.hh │ │ │ │ ├── Smoother │ │ │ │ ├── JacobiLaplaceSmootherT.cc │ │ │ │ ├── JacobiLaplaceSmootherT.hh │ │ │ │ ├── LaplaceSmootherT.cc │ │ │ │ ├── LaplaceSmootherT.hh │ │ │ │ ├── SmootherT.cc │ │ │ │ ├── SmootherT.hh │ │ │ │ └── smooth_mesh.hh │ │ │ │ ├── Subdivider │ │ │ │ ├── Adaptive │ │ │ │ │ └── Composite │ │ │ │ │ │ ├── CompositeT.cc │ │ │ │ │ │ ├── CompositeT.hh │ │ │ │ │ │ ├── CompositeTraits.hh │ │ │ │ │ │ ├── RuleInterfaceT.hh │ │ │ │ │ │ ├── RulesT.cc │ │ │ │ │ │ ├── RulesT.hh │ │ │ │ │ │ └── Traits.hh │ │ │ │ └── Uniform │ │ │ │ │ ├── CatmullClarkT.cc │ │ │ │ │ ├── CatmullClarkT.hh │ │ │ │ │ ├── Composite │ │ │ │ │ ├── CompositeT.cc │ │ │ │ │ ├── CompositeT.hh │ │ │ │ │ └── CompositeTraits.hh │ │ │ │ │ ├── CompositeLoopT.hh │ │ │ │ │ ├── CompositeSqrt3T.hh │ │ │ │ │ ├── LongestEdgeT.hh │ │ │ │ │ ├── LoopT.hh │ │ │ │ │ ├── MidpointT.hh │ │ │ │ │ ├── ModifiedButterFlyT.hh │ │ │ │ │ ├── Sqrt3InterpolatingSubdividerLabsikGreinerT.hh │ │ │ │ │ ├── Sqrt3T.hh │ │ │ │ │ └── SubdividerT.hh │ │ │ │ ├── Utils │ │ │ │ ├── Config.hh │ │ │ │ ├── GLConstAsString.hh │ │ │ │ ├── Gnuplot.cc │ │ │ │ ├── Gnuplot.hh │ │ │ │ ├── HeapT.hh │ │ │ │ ├── MeshCheckerT.cc │ │ │ │ ├── MeshCheckerT.hh │ │ │ │ ├── NumLimitsT.hh │ │ │ │ ├── StripifierT.cc │ │ │ │ ├── StripifierT.hh │ │ │ │ ├── TestingFramework.hh │ │ │ │ ├── Timer.hh │ │ │ │ ├── conio.hh │ │ │ │ └── getopt.h │ │ │ │ └── VDPM │ │ │ │ ├── MeshTraits.hh │ │ │ │ ├── StreamingDef.hh │ │ │ │ ├── VFront.cc │ │ │ │ ├── VFront.hh │ │ │ │ ├── VHierarchy.hh │ │ │ │ ├── VHierarchyNode.hh │ │ │ │ ├── VHierarchyNodeIndex.hh │ │ │ │ ├── VHierarchyWindow.hh │ │ │ │ └── ViewingParameters.hh │ │ └── lib │ │ │ ├── linux │ │ │ ├── libOpenMeshCore.a │ │ │ ├── libOpenMeshCore.so │ │ │ ├── libOpenMeshCore.so.7.1 │ │ │ ├── libOpenMeshTools.a │ │ │ ├── libOpenMeshTools.so │ │ │ └── libOpenMeshTools.so.7.1 │ │ │ └── osx │ │ │ ├── libOpenMeshTools.5.0.dylib │ │ │ └── libOpenMeshTools.dylib │ ├── mLib │ │ ├── .gitignore │ │ ├── LICENSE.txt │ │ ├── Makefile.app │ │ ├── README.txt │ │ ├── TODO.txt │ │ ├── data │ │ │ ├── colormaps │ │ │ │ └── parula.png │ │ │ ├── fonts │ │ │ │ └── bitmapFontA.png │ │ │ └── shaders │ │ │ │ ├── defaultBasic.hlsl │ │ │ │ ├── defaultBasicTexture.hlsl │ │ │ │ ├── defaultCanvas.hlsl │ │ │ │ └── defaultPointCloud.hlsl │ │ ├── include │ │ │ ├── application-base │ │ │ │ ├── applicationWin32.h │ │ │ │ ├── graphicsAsset.h │ │ │ │ ├── graphicsDevice.h │ │ │ │ └── windowWin32.h │ │ │ ├── application-d3d11 │ │ │ │ ├── D3D11AssetRenderer.h │ │ │ │ ├── D3D11Buffer.cpp │ │ │ │ ├── D3D11Buffer.h │ │ │ │ ├── D3D11Canvas2D.h │ │ │ │ ├── D3D11ConstantBuffer.h │ │ │ │ ├── D3D11GeometryShader.h │ │ │ │ ├── D3D11GraphicsDevice.h │ │ │ │ ├── D3D11PixelShader.h │ │ │ │ ├── D3D11PointCloud.h │ │ │ │ ├── D3D11RenderTarget.h │ │ │ │ ├── D3D11ShaderManager.h │ │ │ │ ├── D3D11Texture2D.cpp │ │ │ │ ├── D3D11Texture2D.h │ │ │ │ ├── D3D11Texture3D.cpp │ │ │ │ ├── D3D11Texture3D.h │ │ │ │ ├── D3D11TriMesh.h │ │ │ │ ├── D3D11Utility.h │ │ │ │ └── D3D11VertexShader.h │ │ │ ├── core-base │ │ │ │ ├── baseImage.h │ │ │ │ ├── baseImageHelper.h │ │ │ │ ├── binaryGrid3.h │ │ │ │ ├── common.h │ │ │ │ ├── distanceField3.h │ │ │ │ ├── grid2.cpp │ │ │ │ ├── grid2.h │ │ │ │ ├── grid3.cpp │ │ │ │ ├── grid3.h │ │ │ │ └── multiStream.h │ │ │ ├── core-graphics │ │ │ │ ├── RGBColor.h │ │ │ │ ├── boundingBox2.h │ │ │ │ ├── boundingBox3.h │ │ │ │ ├── camera.h │ │ │ │ ├── camera.inl │ │ │ │ ├── cameraTrackball.h │ │ │ │ ├── colorUtils.h │ │ │ │ ├── cone.h │ │ │ │ ├── cylinder.h │ │ │ │ ├── dist.h │ │ │ │ ├── intersection.h │ │ │ │ ├── line2.h │ │ │ │ ├── lineSegment2.h │ │ │ │ ├── lineSegment3.h │ │ │ │ ├── orientedBoundingBox2.h │ │ │ │ ├── orientedBoundingBox3.h │ │ │ │ ├── plane.h │ │ │ │ ├── polygon.cpp │ │ │ │ ├── polygon.h │ │ │ │ ├── ray.h │ │ │ │ ├── sphere.h │ │ │ │ └── triangle.h │ │ │ ├── core-math │ │ │ │ ├── PCA.cpp │ │ │ │ ├── PCA.h │ │ │ │ ├── blockedPCA.cpp │ │ │ │ ├── blockedPCA.h │ │ │ │ ├── denseMatrix.cpp │ │ │ │ ├── denseMatrix.h │ │ │ │ ├── eigenSolver.cpp │ │ │ │ ├── eigenSolver.h │ │ │ │ ├── kMeansClustering.h │ │ │ │ ├── linearSolver.h │ │ │ │ ├── mathUtil.h │ │ │ │ ├── mathVector.h │ │ │ │ ├── matrix2x2.h │ │ │ │ ├── matrix3x3.h │ │ │ │ ├── matrix4x4.h │ │ │ │ ├── numericalRecipesTemplates.h │ │ │ │ ├── quaternion.h │ │ │ │ ├── rng.h │ │ │ │ ├── sampling.h │ │ │ │ ├── sparseMatrix.cpp │ │ │ │ ├── sparseMatrix.h │ │ │ │ ├── vec1.h │ │ │ │ ├── vec2.h │ │ │ │ ├── vec3.h │ │ │ │ ├── vec4.h │ │ │ │ └── vec6.h │ │ │ ├── core-mesh │ │ │ │ ├── material.h │ │ │ │ ├── meshData.cpp │ │ │ │ ├── meshData.h │ │ │ │ ├── meshIO.cpp │ │ │ │ ├── meshIO.h │ │ │ │ ├── meshShapes.cpp │ │ │ │ ├── meshShapes.h │ │ │ │ ├── meshUtil.h │ │ │ │ ├── plyHeader.h │ │ │ │ ├── pointCloud.cpp │ │ │ │ ├── pointCloud.h │ │ │ │ ├── pointCloudIO.cpp │ │ │ │ ├── pointCloudIO.h │ │ │ │ ├── triMesh.cpp │ │ │ │ ├── triMesh.h │ │ │ │ ├── triMeshAccelerator.h │ │ │ │ ├── triMeshAcceleratorBVH.h │ │ │ │ ├── triMeshAcceleratorBVHMatt.h │ │ │ │ ├── triMeshAcceleratorBruteForce.h │ │ │ │ ├── triMeshCollisionAccelerator.h │ │ │ │ ├── triMeshCollisionAccelerator.inl │ │ │ │ ├── triMeshRayAccelerator.h │ │ │ │ ├── triMeshRayAccelerator.inl │ │ │ │ └── triMeshSampler.h │ │ │ ├── core-multithreading │ │ │ │ ├── taskList.h │ │ │ │ ├── threadPool.h │ │ │ │ └── workerThread.h │ │ │ ├── core-network │ │ │ │ ├── networkClient.h │ │ │ │ └── networkServer.h │ │ │ ├── core-util │ │ │ │ ├── UIConnection.h │ │ │ │ ├── binaryDataBuffer.h │ │ │ │ ├── binaryDataCompressor.h │ │ │ │ ├── binaryDataSerialize.h │ │ │ │ ├── binaryDataStream.h │ │ │ │ ├── colorGradient.h │ │ │ │ ├── commandLineReader.h │ │ │ │ ├── directory.h │ │ │ │ ├── eventMap.h │ │ │ │ ├── flagSet.h │ │ │ │ ├── keycodes.h │ │ │ │ ├── nearestNeighborSearch.h │ │ │ │ ├── parameterFile.h │ │ │ │ ├── pipe.h │ │ │ │ ├── sparseGrid3.h │ │ │ │ ├── stringUtil.h │ │ │ │ ├── stringUtilConvert.h │ │ │ │ ├── textWriter.h │ │ │ │ ├── timer.h │ │ │ │ ├── uniformAccelerator.h │ │ │ │ ├── utility.h │ │ │ │ └── windowsUtil.h │ │ │ ├── ext-boost │ │ │ │ ├── options.h │ │ │ │ └── serialization.h │ │ │ ├── ext-cgal │ │ │ │ └── cgalWrapper.h │ │ │ ├── ext-d3d11font │ │ │ │ └── D3D11Font.h │ │ │ ├── ext-depthcamera │ │ │ │ ├── calibratedSensorData.h │ │ │ │ ├── sensorData.h │ │ │ │ └── sensorData │ │ │ │ │ ├── stb_image.h │ │ │ │ │ ├── stb_image_write.h │ │ │ │ │ ├── uplinksimple.h │ │ │ │ │ ├── uplinksimple_image-codecs.h │ │ │ │ │ ├── uplinksimple_memory.h │ │ │ │ │ ├── uplinksimple_shift2depth.h │ │ │ │ │ └── uplinksimple_windows-image-codecs.h │ │ │ ├── ext-eigen │ │ │ │ ├── eigenSolver.h │ │ │ │ └── eigenUtility.h │ │ │ ├── ext-flann │ │ │ │ └── nearestNeighborSearchFLANN.h │ │ │ ├── ext-freeimage │ │ │ │ ├── freeImageWrapper.h │ │ │ │ └── freeImageWrapperHelper.h │ │ │ ├── ext-lodepng │ │ │ │ ├── imageLoaderLodePNG.h │ │ │ │ └── lodepng.h │ │ │ ├── ext-mbase │ │ │ │ └── mBase.h │ │ │ ├── ext-openmesh │ │ │ │ ├── loader.h │ │ │ │ └── triMesh.h │ │ │ ├── ext-zlib │ │ │ │ └── ZLibWrapper.h │ │ │ ├── mLibBoost.h │ │ │ ├── mLibCGAL.h │ │ │ ├── mLibCore.cpp │ │ │ ├── mLibCore.h │ │ │ ├── mLibD3D11.cpp │ │ │ ├── mLibD3D11.h │ │ │ ├── mLibD3D11Font.h │ │ │ ├── mLibDepthCamera.cpp │ │ │ ├── mLibDepthCamera.h │ │ │ ├── mLibEigen.h │ │ │ ├── mLibFLANN.h │ │ │ ├── mLibFreeImage.h │ │ │ ├── mLibLodePNG.cpp │ │ │ ├── mLibLodePNG.h │ │ │ ├── mLibMBase.h │ │ │ ├── mLibOpenMesh.h │ │ │ ├── mLibZLib.cpp │ │ │ └── mLibZLib.h │ │ └── src │ │ │ ├── application-base │ │ │ ├── applicationWin32.cpp │ │ │ └── windowWin32.cpp │ │ │ ├── application-d3d11 │ │ │ ├── D3D11AssetRenderer.cpp │ │ │ ├── D3D11Canvas2D.cpp │ │ │ ├── D3D11GeometryShader.cpp │ │ │ ├── D3D11GraphicsDevice.cpp │ │ │ ├── D3D11PixelShader.cpp │ │ │ ├── D3D11PointCloud.cpp │ │ │ ├── D3D11RenderTarget.cpp │ │ │ ├── D3D11ShaderManager.cpp │ │ │ ├── D3D11TriMesh.cpp │ │ │ ├── D3D11Utility.cpp │ │ │ └── D3D11VertexShader.cpp │ │ │ ├── core-base │ │ │ └── common.cpp │ │ │ ├── core-graphics │ │ │ └── RGBColor.cpp │ │ │ ├── core-math │ │ │ ├── rng.cpp │ │ │ ├── triangleIntersection.cpp │ │ │ └── triangleIntersectionBackup.cpp │ │ │ ├── core-mesh │ │ │ └── meshUtil.cpp │ │ │ ├── core-multithreading │ │ │ ├── threadPool.cpp │ │ │ └── workerThread.cpp │ │ │ ├── core-util │ │ │ ├── UIConnection.cpp │ │ │ ├── directory.cpp │ │ │ ├── eventMap.cpp │ │ │ ├── pipe.cpp │ │ │ ├── timer.cpp │ │ │ ├── utility.cpp │ │ │ └── windowsUtil.cpp │ │ │ ├── ext-lodepng │ │ │ ├── imageLoaderLodePNG.cpp │ │ │ └── lodepng.cpp │ │ │ └── ext-zlib │ │ │ └── ZLibWrapper.cpp │ └── nanoflann │ │ ├── COPYING │ │ └── include │ │ └── nanoflann.hpp ├── face_fitting │ ├── Makefile │ ├── face_fitting.t │ └── src │ │ ├── CUDAWarpingSolver.cpp │ │ ├── CUDAWarpingSolver.h │ │ ├── CombinedSolver.h │ │ ├── Resource.h │ │ ├── RotationHelper.h │ │ ├── SolverUtil.h │ │ ├── WarpingSolver.cu │ │ ├── WarpingSolverEquations.h │ │ ├── WarpingSolverParameters.h │ │ ├── WarpingSolverState.h │ │ ├── WarpingSolverUtil.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── image_warping │ ├── Makefile │ ├── image_warping.t │ └── src │ │ ├── CUDAWarpingSolver.cpp │ │ ├── CUDAWarpingSolver.h │ │ ├── CombinedSolver.h │ │ ├── Resource.h │ │ ├── SolverUtil.h │ │ ├── WarpingSolver.cu │ │ ├── WarpingSolverEquations.h │ │ ├── WarpingSolverParameters.h │ │ ├── WarpingSolverState.h │ │ ├── WarpingSolverUtil.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── intrinsic_image_decomposition │ ├── Makefile │ ├── intrinsic_image_decomposition.t │ └── src │ │ ├── CombinedSolver.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── optical_flow │ ├── Makefile │ ├── optical_flow.t │ └── src │ │ ├── CombinedSolver.h │ │ ├── ImageHelper.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ └── main.cpp ├── poisson_image_editing │ ├── Makefile │ ├── poisson_image_editing.filters │ ├── poisson_image_editing.t │ └── src │ │ ├── CUDAPatchSolverWarping.cpp │ │ ├── CUDAPatchSolverWarping.h │ │ ├── CUDAWarpingSolver.cpp │ │ ├── CUDAWarpingSolver.h │ │ ├── CombinedSolver.h │ │ ├── EigenSolverPoissonImageEditing.cpp │ │ ├── EigenSolverPoissonImageEditing.h │ │ ├── PatchSolverWarping.cu │ │ ├── PatchSolverWarpingEquations.h │ │ ├── PatchSolverWarpingParameters.h │ │ ├── PatchSolverWarpingState.h │ │ ├── PatchSolverWarpingUtil.h │ │ ├── SolverUtil.h │ │ ├── WarpingSolver.cu │ │ ├── WarpingSolverEquations.h │ │ ├── WarpingSolverParameters.h │ │ ├── WarpingSolverState.h │ │ ├── WarpingSolverUtil.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ ├── main.h │ │ └── resource.h ├── procrustes_alignment │ ├── Makefile │ ├── procrustes_alignment.t │ └── src │ │ ├── CUDAWarpingSolver.cpp │ │ ├── CUDAWarpingSolver.h │ │ ├── CombinedSolver.h │ │ ├── RotationHelper.h │ │ ├── SolverUtil.h │ │ ├── WarpingSolver.cu │ │ ├── WarpingSolverEquations.h │ │ ├── WarpingSolverParameters.h │ │ ├── WarpingSolverState.h │ │ ├── WarpingSolverUtil.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── proximal │ ├── proximal.vcxproj │ ├── proximal.vcxproj.filters │ └── src │ │ └── CombinedSolver.h ├── robust_nonrigid_alignment │ ├── Makefile │ ├── robust_nonrigid_alignment.t │ └── src │ │ ├── CUDATimer.h │ │ ├── CombinedSolver.h │ │ ├── OpenMesh.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── shape_and_shading │ ├── Makefile │ ├── shape_and_shading.t │ └── src │ │ ├── CameraParams.h │ │ ├── CombinedSolver.h │ │ ├── ConvergenceAnalysis.h │ │ ├── SFSSolverInput.h │ │ ├── SimpleBuffer.cpp │ │ ├── SimpleBuffer.h │ │ ├── SolverUtil.h │ │ ├── TerraSolverParameters.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── shape_from_shading │ ├── Makefile │ ├── shape_from_shading.t │ └── src │ │ ├── CUDAImageSolver.cpp │ │ ├── CUDAImageSolver.h │ │ ├── CameraParams.h │ │ ├── CombinedSolver.h │ │ ├── ConvergenceAnalysis.h │ │ ├── SFSSolver.cu │ │ ├── SFSSolverEquations.h │ │ ├── SFSSolverInput.h │ │ ├── SFSSolverParameters.h │ │ ├── SFSSolverState.h │ │ ├── SFSSolverTerms.h │ │ ├── SFSSolverUtil.h │ │ ├── SimpleBuffer.cpp │ │ ├── SimpleBuffer.h │ │ ├── SolverUtil.h │ │ ├── TerraSolverParameters.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ ├── main.cpp │ │ └── main.h ├── shared │ ├── CUDATimer.h │ ├── CombinedSolverBase.h │ ├── CombinedSolverParameters.h │ ├── Config.h │ ├── CudaArray.h │ ├── NamedParameters.h │ ├── OpenMesh.h │ ├── SolverBase.h │ ├── SolverIteration.h │ ├── SolverPerformanceSummary.h │ ├── ThalloGraph.h │ ├── ThalloImage.h │ ├── ThalloSolver.h │ ├── ThalloUtils.h │ ├── cudaUtil.h │ ├── cuda_SimpleMatrixUtil.h │ ├── make_template.inc │ └── tclap │ │ ├── COPYING │ │ └── include │ │ └── tclap │ │ ├── Arg.h │ │ ├── ArgException.h │ │ ├── ArgTraits.h │ │ ├── CmdLine.h │ │ ├── CmdLineInterface.h │ │ ├── CmdLineOutput.h │ │ ├── Constraint.h │ │ ├── DocBookOutput.h │ │ ├── HelpVisitor.h │ │ ├── IgnoreRestVisitor.h │ │ ├── MultiArg.h │ │ ├── MultiSwitchArg.h │ │ ├── OptionalUnlabeledTracker.h │ │ ├── StandardTraits.h │ │ ├── StdOutput.h │ │ ├── SwitchArg.h │ │ ├── UnlabeledMultiArg.h │ │ ├── UnlabeledValueArg.h │ │ ├── ValueArg.h │ │ ├── ValuesConstraint.h │ │ ├── VersionVisitor.h │ │ ├── Visitor.h │ │ ├── XorHandler.h │ │ ├── ZshCompletionOutput.h │ │ └── sstream.h ├── sparse_bundle_fusion │ ├── Makefile │ ├── build │ │ └── CUDASolver │ │ │ └── CUDASolverBundling.d │ └── bundle_fusion_solve.t ├── spatially_varying_deconvolution │ ├── Makefile │ ├── spatially_varying_deconvolution.t │ └── src │ │ ├── CombinedSolver.h │ │ ├── mLibInclude.h │ │ ├── mLibSource.cpp │ │ └── main.cpp └── volumetric_mesh_deformation │ ├── Makefile │ ├── src │ ├── CUDAWarpingSolver.cpp │ ├── CUDAWarpingSolver.h │ ├── CombinedSolver.h │ ├── OpenMesh.h │ ├── RotationHelper.h │ ├── SolverUtil.h │ ├── WarpingSolver.cu │ ├── WarpingSolverEquations.h │ ├── WarpingSolverParameters.h │ ├── WarpingSolverState.h │ ├── WarpingSolverUtil.h │ ├── mLibInclude.h │ ├── mLibSource.cpp │ └── main.cpp │ └── volumetric_mesh_deformation.t └── tests ├── complicated_graph_energy ├── Makefile ├── complicated.t └── main.cpp ├── convolution ├── Makefile ├── convolution.t └── main.cpp ├── create_delete_cycle ├── laplacian.t └── main.cpp ├── cuda_unit_tests ├── _unit_test_helpers.t ├── ballot.t ├── get_peers.t └── reduce_peers.t ├── dense ├── Makefile ├── curveFitting.t ├── curveFitting_dense.t └── main.cpp ├── dense_sparse ├── curveFitting_combined.t └── main.cpp ├── energy_unit_tests ├── compile.t ├── constant_test.t └── laplacian.t ├── expansive_sparse_materialize ├── Makefile ├── expansive_sparse_materialize.t └── main.cpp ├── minimal ├── Makefile ├── gold.png ├── laplacian.t └── main.cpp ├── minimal_2d_graph ├── Makefile ├── laplacian.t └── main.cpp ├── minimal_exclude ├── Makefile ├── main.cpp └── minimal_exclude.t ├── minimal_fitting ├── Makefile ├── main.cpp └── minimal_fitting.t ├── minimal_graph ├── Makefile ├── gold.png ├── laplacian.t └── main.cpp ├── minimal_materialize ├── Makefile ├── main.cpp └── minimal_materialize.t ├── minimal_sparse_materialize ├── Makefile ├── main.cpp └── minimal_sparse_materialize.t ├── multidomain ├── Makefile ├── main.cpp └── multidomain.t └── shared ├── CudaArray.h └── stb_image_write.h /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | API/release/bin/* 3 | API/release/lib/* 4 | 5 | */*/*.d 6 | */*/*.o 7 | */*/*/*.d 8 | */*/*/*.o 9 | 10 | 11 | /API/common/Thallo.dll 12 | /API/common/Thallo.exp 13 | /API/common/Thallo.lib 14 | 15 | /API/Thallo.dll 16 | /API/Thallo.exp 17 | /API/Thallo.lib 18 | 19 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/.gitmodules -------------------------------------------------------------------------------- /API/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all clean purge release 2 | 3 | TERRAHOME ?= ../../terra/ 4 | TERRA ?= ../../terra/bin/terra 5 | 6 | all: release/lib/libThallo.a release/lib/libThalloDev.a 7 | 8 | release/lib/libThallo.a: $(wildcard src/*.t) 9 | @mkdir -p release/lib 10 | $(TERRA) src/createwrapper.t Thallo src thallo release/include/Thallo.h build/wrapper.o true 11 | rm -rf $@ 12 | ar cq $@ build/wrapper.o 13 | 14 | release/lib/libThalloDev.a: $(wildcard src/*.t) 15 | @mkdir -p release/lib 16 | $(TERRA) src/createwrapper.t Thallo src thallo release/include/Thallo.h build/wrapperdev.o false 17 | rm -rf $@ 18 | ar cq $@ build/wrapperdev.o 19 | 20 | clean: 21 | rm -rf build/wrapper.o 22 | rm -rf release/lib/libThallo.a 23 | rm -rf release/lib/libThalloDev.a 24 | rm -rf release/lib/libterra.a -------------------------------------------------------------------------------- /API/build/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/API/build/.gitignore -------------------------------------------------------------------------------- /API/src/autoscheduler.t: -------------------------------------------------------------------------------- 1 | local List = terralib.newlist 2 | local a = {} 3 | 4 | 5 | 6 | return a 7 | 8 | -------------------------------------------------------------------------------- /API/src/maybe_emit.t: -------------------------------------------------------------------------------- 1 | return { 2 | name = "maybe_emit"; --name for debugging 3 | -- list of keywords that will start our expressions 4 | entrypoints = {"maybe_emit"}; 5 | keywords = {}; --list of keywords specific to this language 6 | --called by Terra parser to enter this language 7 | expression = function(self,lex) 8 | lex:expect("maybe_emit") 9 | lex:expect("(") 10 | local pred = lex:luaexpr() 11 | lex:expect(",") 12 | local qt = lex:luaexpr() 13 | lex:expect(")") 14 | return function(environment_function) 15 | local env = environment_function() 16 | if pred(env) then 17 | local snippet = qt(env) 18 | return snippet 19 | end 20 | return quote end 21 | end 22 | end; 23 | } -------------------------------------------------------------------------------- /API/src/precision.t: -------------------------------------------------------------------------------- 1 | -- Switch to double to check for precision issues in the solver 2 | -- using double incurs bandwidth, compute, and atomic performance penalties 3 | if _thallo_double_precision then 4 | thallo_float = double 5 | else 6 | thallo_float = float 7 | end -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = arap_mesh_deformation 2 | OBJS = build/LandMark.o build/LandMarkSet.o build/mLibSource.o build/main.o build/WarpingSolver.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | OBJS += build/CUDAWarpingSolver.o 12 | endif 13 | 14 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 15 | 16 | include ../shared/make_template.inc 17 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/arap_mesh_deformation.t: -------------------------------------------------------------------------------- 1 | N,E = Dims("N","E") 2 | Inputs { 3 | w_fitSqrt = Param(float, 0), 4 | w_regSqrt = Param(float, 1), 5 | Position = Unknown(thallo_float3,{N},2), 6 | Angle = Unknown(thallo_float3,{N},3), 7 | Original = Array(thallo_float3,{N},4), 8 | Constraints = Array(thallo_float3,{N},5), --user constraints 9 | V0 = Sparse({E}, {N}, 6), 10 | V1 = Sparse({E}, {N}, 7) 11 | } 12 | 13 | UsePreconditioner(true) 14 | n,e = N(),E() 15 | v0,v1 = V0(e),V1(e) 16 | local e_fit = Position(n) - Constraints(n) 17 | local valid = greatereq(Constraints(n)(0), -999999.9) 18 | local ARAPCost = (Position(v0) - Position(v1)) - Rotate3D(Angle(v0),Original(v0) - Original(v1)) 19 | r = Residuals { 20 | fit = Select(valid,w_fitSqrt*e_fit,0), 21 | reg = w_regSqrt*ARAPCost 22 | } 23 | -- Default schedule gives good performance -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/CUDAWarpingSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../../shared/cudaUtil.h" 4 | #include "WarpingSolverParameters.h" 5 | #include "WarpingSolverState.h" 6 | #include "../../shared/SolverBase.h" 7 | 8 | class CUDAWarpingSolver : public SolverBase 9 | { 10 | public: 11 | CUDAWarpingSolver(unsigned int N, int* d_numNeighbours, int* d_neighbourIdx, int* d_neighbourOffset); 12 | ~CUDAWarpingSolver(); 13 | 14 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& stats, bool profileSolve, std::vector& iter) override; 15 | 16 | private: 17 | SolverInput m_solverInput; 18 | SolverState m_solverState; 19 | unsigned int m_N; 20 | }; 21 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/LandMark.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/arap_mesh_deformation/src/LandMark.cpp -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/LandMark.h: -------------------------------------------------------------------------------- 1 | #ifndef __LANDMARK__H__ 2 | #define __LANDMARK__H__ 3 | 4 | #include 5 | 6 | class LandMark 7 | { 8 | public: 9 | 10 | LandMark(std::vector& position, unsigned int vertexIndex, float radius) 11 | { 12 | m_position = position; 13 | m_vertexIndex = vertexIndex; 14 | m_radius = radius; 15 | } 16 | 17 | void setPosition(std::vector& position) 18 | { 19 | m_position = position; 20 | } 21 | 22 | std::vector getPosition() const 23 | { 24 | return m_position; 25 | } 26 | 27 | void setVertexIndex(unsigned int vertexIndex) 28 | { 29 | m_vertexIndex = vertexIndex; 30 | } 31 | 32 | unsigned int getVertexIndex() const 33 | { 34 | return m_vertexIndex; 35 | } 36 | 37 | float getRadius() const 38 | { 39 | return m_radius; 40 | } 41 | 42 | ~LandMark() 43 | { 44 | } 45 | 46 | private: 47 | 48 | std::vector m_position; 49 | unsigned int m_vertexIndex; 50 | 51 | float m_radius; 52 | }; 53 | 54 | std::ostream& operator<<(std::ostream &os, const LandMark& landMark) 55 | { 56 | os << landMark.getPosition()[0] << " " << landMark.getPosition()[1] << " " << landMark.getPosition()[2] << " " << landMark.getRadius() << " " << landMark.getVertexIndex(); 57 | 58 | return os; 59 | } 60 | 61 | #endif //__LANDMARK__H__ 62 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/LandMarkSet.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/arap_mesh_deformation/src/LandMarkSet.cpp -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/LandMarkSet.h: -------------------------------------------------------------------------------- 1 | #ifndef __LANDMARKSET__H__ 2 | #define __LANDMARKSET__H__ 3 | 4 | #include "LandMark.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class LandMarkSet : public std::vector 11 | { 12 | public: 13 | 14 | void loadFromFile(const char* filename) 15 | { 16 | this->clear(); 17 | 18 | std::ifstream in(filename, std::fstream::in); 19 | 20 | if(!in.good()) 21 | { 22 | std::cout << "Could not open marker file " << filename << std::endl; 23 | assert(false); 24 | } 25 | 26 | unsigned int nMarkers; 27 | in >> nMarkers; 28 | 29 | for(unsigned int m = 0; m position; position.resize(3); 32 | in >> position[0]; 33 | in >> position[1]; 34 | in >> position[2]; 35 | 36 | float radius; 37 | in >> radius; 38 | 39 | unsigned int vertexIndex; 40 | in >> vertexIndex; 41 | 42 | push_back(LandMark(position, vertexIndex, radius)); 43 | } 44 | 45 | in.close(); 46 | } 47 | }; 48 | 49 | #endif //__LANDMARKSET__H__ 50 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/Resource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | //{{NO_DEPENDENCIES}} 8 | // Microsoft Visual C++ generated include file. 9 | // Used by DepthWithColor-D3D.rc 10 | // 11 | 12 | #define IDS_APP_TITLE 103 13 | 14 | #define IDI_APP 107 15 | #define IDC_STATIC -1 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | 21 | #define _APS_NO_MFC 130 22 | #define _APS_NEXT_RESOURCE_VALUE 129 23 | #define _APS_NEXT_COMMAND_VALUE 32771 24 | #define _APS_NEXT_CONTROL_VALUE 1000 25 | #define _APS_NEXT_SYMED_VALUE 110 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/WarpingSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | float weightFitting; // Fitting weights 9 | float weightRegularizer; // Regularization weight 10 | 11 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 12 | unsigned int nLinIterations; // Steps of the linear solver 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/WarpingSolverUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SolverUtil.h" 4 | 5 | #include "../../shared/cudaUtil.h" 6 | 7 | #define THREADS_PER_BLOCK 512 // keep consistent with the CPU 8 | 9 | #define DR_THREAD_SIZE1_X 32 10 | #define DR_THREAD_SIZE1_Y 8 11 | 12 | __inline__ __device__ float warpReduce(float val) { 13 | int offset = 32 >> 1; 14 | while (offset > 0) { 15 | val = val + __shfl_down(val, offset, 32); 16 | offset = offset >> 1; 17 | } 18 | return val; 19 | } 20 | 21 | extern __shared__ float bucket[]; 22 | 23 | inline __device__ void scanPart1(unsigned int threadIdx, unsigned int blockIdx, unsigned int threadsPerBlock, float* d_output) 24 | { 25 | __syncthreads(); 26 | blockReduce(bucket, threadIdx, threadsPerBlock); 27 | if(threadIdx == 0) d_output[blockIdx] = bucket[0]; 28 | } 29 | 30 | inline __device__ void scanPart2(unsigned int threadIdx, unsigned int threadsPerBlock, unsigned int blocksPerGrid, float* d_tmp) 31 | { 32 | if(threadIdx < blocksPerGrid) bucket[threadIdx] = d_tmp[threadIdx]; 33 | else bucket[threadIdx] = 0.0f; 34 | 35 | __syncthreads(); 36 | blockReduce(bucket, threadIdx, threadsPerBlock); 37 | __syncthreads(); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/arap_mesh_deformation/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Resource.h" 4 | #include "mLibInclude.h" 5 | 6 | #ifndef SAFE_DELETE 7 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 8 | #endif 9 | #ifndef SAFE_DELETE_ARRAY 10 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 11 | #endif 12 | -------------------------------------------------------------------------------- /examples/basic/out.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/basic/out.png -------------------------------------------------------------------------------- /examples/bundle_adjustment/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = bundle_adjustment 2 | OBJS = build/mLibSource.o build/bal_problem.o build/main.o 3 | USES_CERES=1 4 | include ../shared/make_template.inc 5 | 6 | -------------------------------------------------------------------------------- /examples/bundle_adjustment/bundle_adjustment.t: -------------------------------------------------------------------------------- 1 | C, P, O = Dims("C", "P", "O") 2 | Inputs { 3 | cameras = Unknown(thallo_float9,{ C }, 0), 4 | points = Unknown(thallo_float3, { P }, 1), 5 | observations = Array(float2, { O }, 2), 6 | oToC = Sparse({ O }, { C }, 3), 7 | oToP = Sparse({ O }, { P }, 4) 8 | } 9 | UsePreconditioner(true) 10 | local o = O() 11 | local camera, point = cameras(oToC(o)), points(oToP(o)) 12 | -- camera[0,1,2] are the axis-angle rotation 13 | p = AngleAxisRotatePoint(camera:slice(0,3), point) 14 | -- camera[3,4,5] are the translation. 15 | p = p + camera:slice(3,6) 16 | 17 | -- Compute the center of distortion. The sign change comes from 18 | -- the camera model that Noah Snavely's Bundler assumes, whereby 19 | -- the camera coordinate system has a negative z axis. 20 | center_of_distortion = Vector(-p(0) / p(2), -p(1) / p(2)) 21 | 22 | -- Apply second and fourth order radial distortion. 23 | l1 = camera(7) 24 | l2 = camera(8) 25 | r2 = dot(center_of_distortion,center_of_distortion) 26 | distortion = 1.0 + r2 * (l1 + l2 * r2) 27 | 28 | -- Compute final projected point position. 29 | focal = camera(6) 30 | predicted = center_of_distortion * focal * distortion 31 | observed = observations(o) 32 | 33 | --oToC:set_coherent(true) 34 | r = Residuals { snavely_reprojection_error = observed-predicted } 35 | -------------------------------------------------------------------------------- /examples/bundle_adjustment/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/bundle_adjustment/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | #include "mLibInclude.h" 2 | 3 | #include "mLibCore.cpp" 4 | #include "mLibLodePNG.cpp" 5 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = bundle_fusion_solve 2 | EXTRA_SRC = CUDASolver 3 | OBJS = build/CUDASolver/SolverBundling.o build/CUDASolver/CUDASolverBundling.o build/mLibSource.o build/main.o 4 | USES_CERES=1 5 | include ../shared/make_template.inc 6 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/CUDASolver/CUDACameraUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _CUDA_CAMERA_UTIL 3 | #define _CUDA_CAMERA_UTIL 4 | 5 | #include "GlobalDefines.h" 6 | #include 7 | #include 8 | #define HAS_CUTIL 9 | 10 | __inline__ __device__ float2 cameraToDepth(float fx, float fy, float cx, float cy, const float3& pos) 11 | { 12 | return make_float2( 13 | pos.x*fx / pos.z + cx, 14 | pos.y*fy / pos.z + cy); 15 | } 16 | __inline__ __device__ float3 depthToCamera(float fx, float fy, float cx, float cy, const int2& loc, float depth) { 17 | const float x = ((float)loc.x - cx) / fx; 18 | const float y = ((float)loc.y - cy) / fy; 19 | return make_float3(depth*x, depth*y, depth); 20 | } 21 | 22 | #endif //_CUDA_CAMERA_UTIL -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/CUDASolver/CUDASolverBundling.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SolverBundlingState.h" 4 | #include "SolverBundlingParameters.h" 5 | #define HAS_CUTIL 6 | #include "SolverBase.h" 7 | 8 | class CUDASolverBundling : public SolverBase 9 | { 10 | public: 11 | CUDASolverBundling(const SolverInput& input, const SolverState& state, const SolverParameters& parameters); 12 | ~CUDASolverBundling(); 13 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& stats, bool profileSolve, std::vector& iter) override; 14 | protected: 15 | SolverInput m_input; 16 | SolverState m_state; 17 | SolverParameters m_parameters; 18 | SolverStateAnalysis m_solverExtra; 19 | unsigned int THREADS_PER_BLOCK = 512; 20 | }; 21 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/CUDASolver/EntryJ.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | //correspondence_idx -> image_Idx_i,j 4 | struct EntryJ { 5 | unsigned int imgIdx_i; 6 | unsigned int imgIdx_j; 7 | float3 pos_i; 8 | float3 pos_j; 9 | 10 | __host__ __device__ 11 | void setInvalid() { 12 | imgIdx_i = (unsigned int)-1; 13 | imgIdx_j = (unsigned int)-1; 14 | } 15 | __host__ __device__ 16 | bool isValid() const { 17 | return imgIdx_i != (unsigned int)-1; 18 | } 19 | }; -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/CUDASolver/GlobalDefines.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #ifndef _GLOBAL_DEFINES_ 4 | #define _GLOBAL_DEFINES_ 5 | 6 | #define MINF __int_as_float(0xff800000) 7 | 8 | #define MAX_MATCHES_PER_IMAGE_PAIR_RAW 128 9 | #define MAX_MATCHES_PER_IMAGE_PAIR_FILTERED 25 10 | 11 | 12 | #define USE_LIE_SPACE 13 | 14 | #endif //_GLOBAL_DEFINES_ -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/CUDASolver/SolverBundlingParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 9 | unsigned int nLinIterations; // Steps of the linear solver 10 | 11 | float verifyOptDistThresh; // for verifying local 12 | float verifyOptPercentThresh; 13 | 14 | float highResidualThresh; 15 | 16 | // dense depth corr 17 | float denseDistThresh; 18 | float denseNormalThresh; 19 | float denseColorThresh; 20 | float denseColorGradientMin; 21 | float denseDepthMin; 22 | float denseDepthMax; 23 | 24 | bool useDenseDepthAllPairwise; // instead of frame-to-frame 25 | unsigned int denseOverlapCheckSubsampleFactor; 26 | 27 | float weightSparse; 28 | float weightDenseDepth; 29 | float weightDenseColor; 30 | bool useDense; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/CUDASolver/SolverUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_UTIL_ 4 | #define _SOLVER_UTIL_ 5 | 6 | #include 7 | #include 8 | 9 | #define FLOAT_EPSILON 0.000001f 10 | 11 | #ifndef BYTE 12 | #define BYTE unsigned char 13 | #endif 14 | 15 | #define MINF __int_as_float(0xff800000) 16 | 17 | /////////////////////////////////////////////////////////////////////////////// 18 | // Helper 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | __inline__ __device__ void get2DIdx(int idx, unsigned int width, unsigned int height, int& i, int& j) 22 | { 23 | i = idx / width; 24 | j = idx % width; 25 | } 26 | 27 | __inline__ __device__ unsigned int get1DIdx(int i, int j, unsigned int width, unsigned int height) 28 | { 29 | return i*width+j; 30 | } 31 | 32 | __inline__ __device__ bool isInsideImage(int i, int j, unsigned int width, unsigned int height) 33 | { 34 | return (i >= 0 && i < height && j >= 0 && j < width); 35 | } 36 | 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/GL/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 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/cutil_inline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #ifndef _CUTIL_INLINE_H_ 13 | #define _CUTIL_INLINE_H_ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | inline void print_NVCC_min_spec(const char *sSDKsample, const char *sNVCCReq, const char *sDriverReq) 24 | { 25 | printf("CUDA %d.%02d Toolkit built this project.\n", CUDART_VERSION/1000, (CUDART_VERSION%100)); 26 | printf(" [ %s ] requirements:\n", sSDKsample); 27 | printf(" -> CUDA %s Toolkit\n" , sNVCCReq); 28 | printf(" -> %s NVIDIA Display Driver.\n", sDriverReq); 29 | } 30 | 31 | #define ALIGN_OFFSET(offset, alignment) offset = (offset + (alignment-1)) & ~((alignment-1)) 32 | 33 | 34 | #endif // _CUTIL_INLINE_H_ 35 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/cutil_inline_bankchecker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #ifndef _CUTIL_INLINE_BANKCHECKER_H_ 13 | #define _CUTIL_INLINE_BANKCHECKER_H_ 14 | 15 | #define cutilBankChecker(array, idx) array[idx] 16 | 17 | // Interface for bank conflict checker 18 | inline void __cutilBankChecker(unsigned int tidx, unsigned int tidy, unsigned int tidz, 19 | unsigned int bdimx, unsigned int bdimy, unsigned int bdimz, 20 | char *aname, int index, char *file, int line) 21 | { 22 | cutCheckBankAccess( tidx, tidy, tidz, bdimx, bdimy, bdimz, file, line, aname, index); 23 | } 24 | 25 | #endif // _CUTIL_INLINE_BANKCHECKER_H_ 26 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/dynlink/cuda_drvapi_dynlink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | 13 | #ifndef __cuda_drvapi_dynlink_h__ 14 | #define __cuda_drvapi_dynlink_h__ 15 | 16 | #include "cuda_drvapi_dynlink_cuda.h" 17 | 18 | #if defined(CUDA_INIT_D3D9)||defined(CUDA_INIT_D3D10)||defined(CUDA_INIT_D3D11) 19 | #include "cuda_drvapi_dynlink_d3d.h" 20 | #endif 21 | 22 | #ifdef CUDA_INIT_OPENGL 23 | #include "cuda_drvapi_dynlink_gl.h" 24 | #endif 25 | 26 | #endif //__cuda_drvapi_dynlink_h__ 27 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/rendercheck_d3d10.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #pragma once 13 | 14 | #ifndef _RENDERCHECK_D3D10_H_ 15 | #define _RENDERCHECK_D3D10_H_ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | class CheckRenderD3D10 25 | { 26 | public: 27 | 28 | CheckRenderD3D10() {} 29 | 30 | static HRESULT ActiveRenderTargetToPPM(ID3D10Device *pDevice, const char *zFileName); 31 | static HRESULT ResourceToPPM(ID3D10Device*pDevice, ID3D10Resource *pResource, const char *zFileName); 32 | 33 | static bool PPMvsPPM( const char *src_file, const char *ref_file, const char *exec_path, 34 | const float epsilon, const float threshold = 0.0f ); 35 | }; 36 | 37 | #endif -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/rendercheck_d3d11.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | 13 | #pragma once 14 | 15 | #ifndef _RENDERCHECK_D3D11_H_ 16 | #define _RENDERCHECK_D3D11_H_ 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class CheckRenderD3D11 26 | { 27 | public: 28 | 29 | CheckRenderD3D11() {} 30 | 31 | static HRESULT ActiveRenderTargetToPPM(ID3D11Device *pDevice, const char *zFileName); 32 | static HRESULT ResourceToPPM(ID3D11Device *pDevice, ID3D11Resource *pResource, const char *zFileName); 33 | 34 | static bool PPMvsPPM( const char *src_file, const char *ref_file, const char *exec_path, 35 | const float epsilon, const float threshold = 0.0f ); 36 | }; 37 | 38 | #endif -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/rendercheck_d3d9.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #pragma once 13 | 14 | #ifndef _RENDERCHECK_D3D9_H_ 15 | #define _RENDERCHECK_D3D9_H_ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | class CheckRenderD3D9 24 | { 25 | public: 26 | 27 | CheckRenderD3D9() {} 28 | 29 | static HRESULT BackbufferToPPM(IDirect3DDevice9*pDevice, const char *zFileName); 30 | static HRESULT SurfaceToPPM(IDirect3DDevice9*pDevice, IDirect3DSurface9 *pSurface, const char *zFileName); 31 | 32 | static bool PPMvsPPM( const char *src_file, const char *ref_file, const char *exec_path, 33 | const float epsilon, const float threshold = 0.0f ); 34 | }; 35 | 36 | #endif -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/cutil/inc/stopwatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* CUda UTility Library */ 13 | 14 | #ifndef _STOPWATCH_H_ 15 | #define _STOPWATCH_H_ 16 | 17 | // stop watch base class 18 | #include 19 | 20 | // include OS specific policy 21 | #ifdef _WIN32 22 | # include 23 | typedef StopWatchWin OSStopWatch; 24 | #else 25 | # include 26 | typedef StopWatchLinux OSStopWatch; 27 | #endif 28 | 29 | // concrete stop watch type 30 | typedef StopWatchBase StopWatchC; 31 | 32 | namespace StopWatch 33 | { 34 | //! Create a stop watch 35 | const unsigned int create(); 36 | 37 | //! Get a handle to the stop watch with the name \a name 38 | StopWatchC& get( const unsigned int& name); 39 | 40 | // Delete the stop watch with the name \a name 41 | void destroy( const unsigned int& name); 42 | } // end namespace, stopwatch 43 | 44 | #endif // _STOPWATCH_H_ 45 | 46 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/bundle_fusion_solve/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mLibInclude.h" 4 | 5 | #ifndef SAFE_DELETE 6 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 7 | #endif 8 | #ifndef SAFE_DELETE_ARRAY 9 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 10 | #endif 11 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = cotangent_mesh_smoothing 2 | OBJS = build/mLibSource.o build/main.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | endif 12 | 13 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 14 | 15 | include ../shared/make_template.inc 16 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/cotangent_mesh_smoothing.t: -------------------------------------------------------------------------------- 1 | N,E = Dims("N","E") 2 | Inputs { 3 | w_fitSqrt = Param(float, 0), 4 | w_regSqrt = Param(float, 1), 5 | X = Unknown(thallo_float3,{N},2), 6 | A = Array(thallo_float3,{N},3), 7 | V0 = Sparse({E}, {N}, 4), --current vertex 8 | V1 = Sparse({E}, {N}, 5), --neighboring vertex 9 | V2 = Sparse({E}, {N}, 6), --prev neighboring vertex 10 | V3 = Sparse({E}, {N}, 7) --next neighboring vertex 11 | } 12 | UsePreconditioner(true) 13 | 14 | function cot(p0, p1) 15 | local adotb = dot(p0, p1) 16 | local disc = dot(p0, p0)*dot(p1, p1) - adotb*adotb 17 | disc = Select(greater(disc, 0.0), disc, 0.0001) 18 | return dot(p0, p1) / Sqrt(disc) 19 | end 20 | 21 | local n = N() 22 | local e = E() 23 | local v0,v1,v2,v3 = V0(e),V1(e),V2(e),V3(e) 24 | 25 | 26 | local a = normalize(X(v0) - X(v2)) --float3 27 | local b = normalize(X(v1) - X(v2)) --float3 28 | local c = normalize(X(v0) - X(v3)) --float3 29 | local d = normalize(X(v1) - X(v3)) --float3 30 | 31 | --cotangent laplacian; Meyer et al. 03 32 | local w = 0.5*(cot(a,b) + cot(c,d)) 33 | w = Sqrt(Select(greater(w, 0.0), w, 0.0001)) 34 | 35 | r = Residuals { 36 | fit = w_fitSqrt*(X(n) - A(n)), 37 | reg = w_regSqrt*w*(X(v1) - X(v0)) 38 | } 39 | 40 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/src/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | #include "mLibInclude.h" 5 | 6 | #ifndef SAFE_DELETE 7 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 8 | #endif 9 | #ifndef SAFE_DELETE_ARRAY 10 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 11 | #endif 12 | -------------------------------------------------------------------------------- /examples/cotangent_mesh_smoothing/src/resource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | //{{NO_DEPENDENCIES}} 8 | // Microsoft Visual C++ generated include file. 9 | // Used by DepthWithColor-D3D.rc 10 | // 11 | 12 | #define IDS_APP_TITLE 103 13 | 14 | #define IDI_APP 107 15 | #define IDC_STATIC -1 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | 21 | #define _APS_NO_MFC 130 22 | #define _APS_NEXT_RESOURCE_VALUE 129 23 | #define _APS_NEXT_COMMAND_VALUE 32771 24 | #define _APS_NEXT_CONTROL_VALUE 1000 25 | #define _APS_NEXT_SYMED_VALUE 110 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /examples/data/Armadillo20k.mrk: -------------------------------------------------------------------------------- 1 | 28 2 | 18.7303 -17.3705 5.94167 0.0224524 19200 3 | 16.8898 -16.5265 8.50551 0.0224524 6669 4 | 33.0318 -16.48 6.33069 0.0224524 19202 5 | 32.5133 -14.9462 10.633 0.0224524 1620 6 | 31.1448 -15.7292 14.7145 0.0224524 13504 7 | 33.2035 -20.306 10.6175 0.0224524 10442 8 | 33.3688 -22.6486 18.5786 0.0224524 5736 9 | 32.241 -27.3015 8.85074 0.0224524 15077 10 | 28.2035 -26.4012 5.09485 0.0224524 18859 11 | 28.8851 -28.9978 7.08572 0.0224524 537 12 | 33.1053 -26.7982 15.5566 0.0224524 13338 13 | 32.1051 -24.3727 7.21497 0.0224524 6529 14 | 31.6909 -23.1839 22.8574 0.0224524 13707 15 | 14.5896 -25.2694 8.56073 0.0224524 6512 16 | 20.6327 -26.6279 5.98923 0.0224524 19172 17 | 24.64 -28.3218 5.43245 0.0224524 18522 18 | 20.5932 -29.1592 6.63618 0.0224524 534 19 | 17.6988 -28.5014 7.27983 0.0224524 3754 20 | 17.948 -24.2837 5.8385 0.0224524 19179 21 | 12.2403 -25.7253 12.7142 0.0224524 6868 22 | 75.471 108.441 -17.6416 0.0224524 1697 23 | 33.8541 -8.4514 8.86931 0.0224524 6847 24 | 31.3363 -9.12662 14.0834 0.0224524 10891 25 | 32.561 -9.36534 11.7853 0.0224524 3103 26 | 33.2547 -9.52547 10.12 0.0224524 18158 27 | 30.2523 -7.29454 -1.06 0.0224524 14052 28 | 22.9727 -10.7019 -0.696537 0.0224524 14645 29 | 17.9133 -11.9845 3.96076 0.0224524 17399 -------------------------------------------------------------------------------- /examples/data/StandardDeviationExpression.vec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/StandardDeviationExpression.vec -------------------------------------------------------------------------------- /examples/data/StandardDeviationExpressionPCA.vec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/StandardDeviationExpressionPCA.vec -------------------------------------------------------------------------------- /examples/data/StandardDeviationShapePCA.vec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/StandardDeviationShapePCA.vec -------------------------------------------------------------------------------- /examples/data/bal/dubrovnik/listing: -------------------------------------------------------------------------------- 1 | 16 22106 2 | 88 64298 3 | 135 90642 4 | 142 93602 5 | 150 95821 6 | 161 103832 7 | 173 111908 8 | 182 116770 9 | 202 132796 10 | 237 154414 11 | 253 163691 12 | 262 169354 13 | 273 176305 14 | 287 182023 15 | 308 195089 16 | 356 226730 -------------------------------------------------------------------------------- /examples/data/bal/final/listing: -------------------------------------------------------------------------------- 1 | 93 61203 2 | 394 100368 3 | 871 527480 4 | 961 187103 5 | 1936 649673 6 | 3068 310854 7 | 4585 1324582 8 | 13682 4456117 -------------------------------------------------------------------------------- /examples/data/bal/ladybug/listing: -------------------------------------------------------------------------------- 1 | 49 7776 2 | 73 11032 3 | 138 19878 4 | 318 41628 5 | 372 47423 6 | 412 52215 7 | 460 56811 8 | 539 65220 9 | 598 69218 10 | 646 73584 11 | 707 78455 12 | 783 84444 13 | 810 88814 14 | 856 93344 15 | 885 97473 16 | 931 102699 17 | 969 105826 18 | 1031 110968 19 | 1064 113655 20 | 1118 118384 21 | 1152 122269 22 | 1197 126327 23 | 1235 129634 24 | 1266 132593 25 | 1340 137079 26 | 1469 145199 27 | 1514 147317 28 | 1587 150845 29 | 1642 153820 30 | 1695 155710 31 | 1723 156502 -------------------------------------------------------------------------------- /examples/data/bal/trafalgar/listing: -------------------------------------------------------------------------------- 1 | 21 11315 2 | 39 18060 3 | 50 20431 4 | 126 40037 5 | 138 44033 6 | 161 48126 7 | 170 49267 8 | 174 50489 9 | 193 53101 10 | 201 54427 11 | 206 54562 12 | 215 55910 13 | 225 57665 14 | 257 65132 -------------------------------------------------------------------------------- /examples/data/bal/venice/listing: -------------------------------------------------------------------------------- 1 | 52 64053 2 | 89 110973 3 | 245 198739 4 | 427 310384 5 | 744 543562 6 | 951 708276 7 | 1102 780462 8 | 1158 802917 9 | 1184 816583 10 | 1238 843534 11 | 1288 866452 12 | 1350 894716 13 | 1408 912229 14 | 1425 916895 15 | 1473 930345 16 | 1490 935273 17 | 1521 939551 18 | 1544 942409 19 | 1638 976803 20 | 1666 983911 21 | 1672 986962 22 | 1681 983415 23 | 1682 983268 24 | 1684 983269 25 | 1695 984689 26 | 1696 984816 27 | 1706 985529 28 | 1776 993909 29 | 1778 993923 30 | -------------------------------------------------------------------------------- /examples/data/cat512.constraints: -------------------------------------------------------------------------------- 1 | 9 2 | 30 132 59 44 3 | 229 51 157 91 4 | 430 124 379 42 5 | 281 369 326 323 6 | 197 407 163 418 7 | 64 386 26 300 8 | 311 168 253 182 9 | 89 228 56 255 10 | 92 192 84 192 -------------------------------------------------------------------------------- /examples/data/cat512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/cat512.png -------------------------------------------------------------------------------- /examples/data/cat512_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/cat512_mask.png -------------------------------------------------------------------------------- /examples/data/cone.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/cone.ply -------------------------------------------------------------------------------- /examples/data/dogdance0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/dogdance0.png -------------------------------------------------------------------------------- /examples/data/dogdance1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/dogdance1.png -------------------------------------------------------------------------------- /examples/data/g2o/credits.txt: -------------------------------------------------------------------------------- 1 | Downloaded From: https://lucacarlone.mit.edu/datasets/ (2019-01-02) -------------------------------------------------------------------------------- /examples/data/head.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/head.ply -------------------------------------------------------------------------------- /examples/data/poisson0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/poisson0.png -------------------------------------------------------------------------------- /examples/data/poisson1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/poisson1.png -------------------------------------------------------------------------------- /examples/data/poisson_mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/poisson_mask.png -------------------------------------------------------------------------------- /examples/data/raptor_simplify2k.mrk: -------------------------------------------------------------------------------- 1 | 11 2 | 0.36779 -0.364349 0.121115 0.0224524 1685 3 | -0.043133 -0.399196 -0.079334 0.0224524 1075 4 | 0.09436 -0.224016 -0.067638 0.0224524 1309 5 | 0.377645 -0.169483 0.110147 0.0224524 1759 6 | -0.012203 -0.055742 -0.040094 0.0224524 1185 7 | 0.131705 0.098145 0.083467 0.0224524 1380 8 | -0.350475 -0.107187 -0.092363 0.0224524 490 9 | -0.455115 0.027587 0.115542 0.0224524 233 10 | -0.07091 0.566149 -0.014762 0.0224524 293 11 | -0.056467 0.180639 -0.018593 0.0224524 1165 12 | 0.985344 0.157731 0.041427 0.0224524 1998 13 | -------------------------------------------------------------------------------- /examples/data/shape_from_shading/default.SFSSolverParameters: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/shape_from_shading/default.SFSSolverParameters -------------------------------------------------------------------------------- /examples/data/shape_from_shading/default_initialUnknown.imagedump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/shape_from_shading/default_initialUnknown.imagedump -------------------------------------------------------------------------------- /examples/data/shape_from_shading/default_maskEdgeMap.imagedump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/shape_from_shading/default_maskEdgeMap.imagedump -------------------------------------------------------------------------------- /examples/data/shape_from_shading/default_targetDepth.imagedump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/shape_from_shading/default_targetDepth.imagedump -------------------------------------------------------------------------------- /examples/data/shape_from_shading/default_targetIntensity.imagedump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/shape_from_shading/default_targetIntensity.imagedump -------------------------------------------------------------------------------- /examples/data/simple_proximal/K.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/K.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/M.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/M.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/b1.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/b1.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/b2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/b2.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/b3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/b3.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/dx.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/dx.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/dy.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/dy.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/lambda.tif: -------------------------------------------------------------------------------- 1 | II*?? 2 |  S -------------------------------------------------------------------------------- /examples/data/simple_proximal/result.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/result.tif -------------------------------------------------------------------------------- /examples/data/simple_proximal/x0.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/simple_proximal/x0.tif -------------------------------------------------------------------------------- /examples/data/small_armadillo.mrk: -------------------------------------------------------------------------------- 1 | 3 2 | 15.7196 -52.722 12.4209 0.0224524 68 3 | -41.1834 -46.8657 -0.424252 0.0224524 358 4 | 0.0000 50.000 -50.00000 0.0224524 7 -------------------------------------------------------------------------------- /examples/data/small_armadillo.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/small_armadillo.ply -------------------------------------------------------------------------------- /examples/data/sphere.ply: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sphere.ply -------------------------------------------------------------------------------- /examples/data/sv_deconv/K.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/K.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/M.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/M.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/b1.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/b1.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/b2.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/b2.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/b3.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/b3.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/dx.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/dx.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/dy.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/dy.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/lambda.tif: -------------------------------------------------------------------------------- 1 | II*?? 2 |  S -------------------------------------------------------------------------------- /examples/data/sv_deconv/result.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/result.tif -------------------------------------------------------------------------------- /examples/data/sv_deconv/x0.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/sv_deconv/x0.tif -------------------------------------------------------------------------------- /examples/data/ye_high2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/data/ye_high2.png -------------------------------------------------------------------------------- /examples/deconvolution/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = deconvolution 2 | OBJS = build/mLibSource.o build/main.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/FreeImage/lib/osx -Wl,-rpath,../external/FreeImage/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/FreeImage/lib/linux -Wl,-rpath,../external/FreeImage/lib/linux 11 | endif 12 | 13 | LFLAGS += -lfreeimage 14 | 15 | USES_CERES=1 16 | 17 | include ../shared/make_template.inc 18 | 19 | -------------------------------------------------------------------------------- /examples/deconvolution/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/deconvolution/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | #include "mLibInclude.h" 2 | 3 | #include "mLibCore.cpp" 4 | #include "mLibLodePNG.cpp" 5 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = embedded_mesh_deformation 2 | OBJS = build/mLibSource.o build/main.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | endif 12 | 13 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 14 | 15 | include ../shared/make_template.inc 16 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/embedded_mesh_deformation.t: -------------------------------------------------------------------------------- 1 | local N,E = Dim("N",0),Dim("E",1) 2 | Inputs { 3 | w_fitSqrt = Param(float, 0), 4 | w_regSqrt = Param(float, 1), 5 | w_rotSqrt = Param(float, 2), 6 | Offset = Unknown(thallo_float3,{N},3), --vertex.xyz, 7 | RotMatrix = Unknown(thallo_mat3f,{N},4), 8 | UrShape = Array(thallo_float3,{N},5), --urshape: vertex.xyz 9 | Constraints = Array(thallo_float3,{N},6), --constraints 10 | v0 = Sparse({E}, {N}, 7), 11 | v1 = Sparse({E}, {N}, 8) 12 | } 13 | UsePreconditioner(true) 14 | n,e = N(),E() 15 | 16 | --fitting 17 | local e_fit = Offset(n) - Constraints(n) 18 | local valid = greatereq(Constraints(n)(0), -999999.9) 19 | 20 | local regCost = (Offset(v1(e)) - Offset(v0(e))) - 21 | gemv(RotMatrix(v0(e)), (UrShape(v1(e)) - UrShape(v0(e)))) 22 | 23 | --rot 24 | local R = RotMatrix(n) 25 | local c0 = Vector(R(0), R(3), R(6)) 26 | local c1 = Vector(R(1), R(4), R(7)) 27 | local c2 = Vector(R(2), R(5), R(8)) 28 | 29 | r = Residuals { 30 | fit = Select(valid, w_fitSqrt*e_fit, 0), 31 | reg = w_regSqrt*regCost, 32 | rot = { 33 | w_rotSqrt*dot(c0,c1), 34 | w_rotSqrt*dot(c0,c2), 35 | w_rotSqrt*dot(c1,c2), 36 | w_rotSqrt*(dot(c0,c0)-1), 37 | w_rotSqrt*(dot(c1,c1)-1), 38 | w_rotSqrt*(dot(c2,c2)-1) 39 | } 40 | } 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/LandMark.h: -------------------------------------------------------------------------------- 1 | #ifndef __LANDMARK__H__ 2 | #define __LANDMARK__H__ 3 | 4 | #include 5 | 6 | class LandMark 7 | { 8 | public: 9 | 10 | LandMark(std::vector& position, unsigned int vertexIndex, float radius) 11 | { 12 | m_position = position; 13 | m_vertexIndex = vertexIndex; 14 | m_radius = radius; 15 | } 16 | 17 | void setPosition(std::vector& position) 18 | { 19 | m_position = position; 20 | } 21 | 22 | std::vector getPosition() const 23 | { 24 | return m_position; 25 | } 26 | 27 | void setVertexIndex(unsigned int vertexIndex) 28 | { 29 | m_vertexIndex = vertexIndex; 30 | } 31 | 32 | unsigned int getVertexIndex() const 33 | { 34 | return m_vertexIndex; 35 | } 36 | 37 | float getRadius() const 38 | { 39 | return m_radius; 40 | } 41 | 42 | ~LandMark() 43 | { 44 | } 45 | 46 | private: 47 | 48 | std::vector m_position; 49 | unsigned int m_vertexIndex; 50 | 51 | float m_radius; 52 | }; 53 | 54 | std::ostream& operator<<(std::ostream &os, const LandMark& landMark) 55 | { 56 | os << landMark.getPosition()[0] << " " << landMark.getPosition()[1] << " " << landMark.getPosition()[2] << " " << landMark.getRadius() << " " << landMark.getVertexIndex(); 57 | 58 | return os; 59 | } 60 | 61 | #endif //__LANDMARK__H__ 62 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/LandMarkSet.h: -------------------------------------------------------------------------------- 1 | #ifndef __LANDMARKSET__H__ 2 | #define __LANDMARKSET__H__ 3 | 4 | #include "LandMark.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class LandMarkSet : public std::vector 11 | { 12 | public: 13 | 14 | void loadFromFile(const char* filename) 15 | { 16 | this->clear(); 17 | 18 | std::ifstream in(filename, std::fstream::in); 19 | 20 | if(!in.good()) 21 | { 22 | std::cout << "Could not open marker file " << filename << std::endl; 23 | assert(false); 24 | } 25 | 26 | unsigned int nMarkers; 27 | in >> nMarkers; 28 | 29 | for(unsigned int m = 0; m position; position.resize(3); 32 | in >> position[0]; 33 | in >> position[1]; 34 | in >> position[2]; 35 | 36 | float radius; 37 | in >> radius; 38 | 39 | unsigned int vertexIndex; 40 | in >> vertexIndex; 41 | 42 | push_back(LandMark(position, vertexIndex, radius)); 43 | } 44 | 45 | in.close(); 46 | } 47 | }; 48 | 49 | #endif //__LANDMARKSET__H__ 50 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | #include "mLibInclude.h" 5 | 6 | #ifndef SAFE_DELETE 7 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 8 | #endif 9 | #ifndef SAFE_DELETE_ARRAY 10 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 11 | #endif 12 | -------------------------------------------------------------------------------- /examples/embedded_mesh_deformation/src/resource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | //{{NO_DEPENDENCIES}} 8 | // Microsoft Visual C++ generated include file. 9 | // Used by DepthWithColor-D3D.rc 10 | // 11 | 12 | #define IDS_APP_TITLE 103 13 | 14 | #define IDI_APP 107 15 | #define IDC_STATIC -1 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | 21 | #define _APS_NO_MFC 130 22 | #define _APS_NEXT_RESOURCE_VALUE 129 23 | #define _APS_NEXT_COMMAND_VALUE 32771 24 | #define _APS_NEXT_CONTROL_VALUE 1000 25 | #define _APS_NEXT_SYMED_VALUE 110 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Cholesky_Module Cholesky module 16 | * 17 | * 18 | * 19 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 20 | * Those decompositions are also accessible via the following methods: 21 | * - MatrixBase::llt() 22 | * - MatrixBase::ldlt() 23 | * - SelfAdjointView::llt() 24 | * - SelfAdjointView::ldlt() 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | */ 30 | 31 | #include "src/Cholesky/LLT.h" 32 | #include "src/Cholesky/LDLT.h" 33 | #ifdef EIGEN_USE_LAPACKE 34 | #include "src/Cholesky/LLT_MKL.h" 35 | #endif 36 | 37 | #include "src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_CHOLESKY_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /examples/external/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /examples/external/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /examples/external/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 31 | -------------------------------------------------------------------------------- /examples/external/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | 34 | -------------------------------------------------------------------------------- /examples/external/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /examples/external/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /examples/external/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /examples/external/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 9 | #define EIGEN_SPQRSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SuiteSparseQR.hpp" 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup SPQRSupport_Module SuiteSparseQR module 19 | * 20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /examples/external/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #include "SparseCholesky" 29 | #include "SparseLU" 30 | #include "SparseQR" 31 | #include "IterativeLinearSolvers" 32 | 33 | #endif // EIGEN_SPARSE_MODULE_H 34 | 35 | -------------------------------------------------------------------------------- /examples/external/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 EIGEN_COMP_MSVC && EIGEN_OS_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 | -------------------------------------------------------------------------------- /examples/external/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 EIGEN_COMP_MSVC && EIGEN_OS_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 | -------------------------------------------------------------------------------- /examples/external/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 EIGEN_COMP_MSVC && EIGEN_OS_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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | ADD_SUBDIRECTORY(functors) 12 | -------------------------------------------------------------------------------- /examples/external/Eigen/src/Core/DiagonalProduct.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2007-2009 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /examples/external/Eigen/src/Core/arch/AVX/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AVX_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AVX_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AVX COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(AltiVec) 2 | ADD_SUBDIRECTORY(AVX) 3 | ADD_SUBDIRECTORY(CUDA) 4 | ADD_SUBDIRECTORY(Default) 5 | ADD_SUBDIRECTORY(NEON) 6 | ADD_SUBDIRECTORY(SSE) 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /examples/external/Eigen/src/Core/arch/CUDA/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_CUDA_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_CUDA_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/CUDA COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/Eigen/src/Core/functors/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Functor_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Functor_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/functors COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/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 | -------------------------------------------------------------------------------- /examples/external/FreeImage/include/FreeImage/FreeImage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/FreeImage/include/FreeImage/FreeImage.h -------------------------------------------------------------------------------- /examples/external/FreeImage/lib/VS2013/FreeImage.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/FreeImage/lib/VS2013/FreeImage.lib -------------------------------------------------------------------------------- /examples/external/FreeImage/lib/VS2013/FreeImaged.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/FreeImage/lib/VS2013/FreeImaged.lib -------------------------------------------------------------------------------- /examples/external/FreeImage/lib/linux/libfreeimage-3.18.0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/FreeImage/lib/linux/libfreeimage-3.18.0.so -------------------------------------------------------------------------------- /examples/external/FreeImage/lib/linux/libfreeimage.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/FreeImage/lib/linux/libfreeimage.a -------------------------------------------------------------------------------- /examples/external/OpenMesh/include/OpenMesh/Core/Mesh/gen/footer.hh: -------------------------------------------------------------------------------- 1 | //============================================================================= 2 | } // namespace Iterators 3 | } // namespace OpenMesh 4 | //============================================================================= 5 | #endif 6 | //============================================================================= 7 | -------------------------------------------------------------------------------- /examples/external/OpenMesh/include/OpenMesh/Tools/Utils/getopt.h: -------------------------------------------------------------------------------- 1 | #ifndef _GETOPT_H_ 2 | #define _GETOPT_H_ 3 | 4 | #include 5 | #include 6 | 7 | #if defined(_MSC_VER) 8 | #if defined(__cplusplus) 9 | 10 | extern "C" { 11 | 12 | extern OPENMESHDLLEXPORT int opterr; 13 | extern OPENMESHDLLEXPORT int optind; 14 | extern OPENMESHDLLEXPORT int optopt; 15 | extern OPENMESHDLLEXPORT int optreset; 16 | extern OPENMESHDLLEXPORT char *optarg; 17 | 18 | OPENMESHDLLEXPORT extern int getopt(int nargc, char * const *nargv, const char *ostr); 19 | 20 | } 21 | 22 | #endif 23 | 24 | #elif defined __APPLE__ 25 | #include 26 | #else 27 | #include 28 | #endif 29 | 30 | #endif /* _GETOPT_H_ */ 31 | -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/linux/libOpenMeshCore.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/linux/libOpenMeshCore.a -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/linux/libOpenMeshCore.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/linux/libOpenMeshCore.so -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/linux/libOpenMeshCore.so.7.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/linux/libOpenMeshCore.so.7.1 -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/linux/libOpenMeshTools.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/linux/libOpenMeshTools.a -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/linux/libOpenMeshTools.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/linux/libOpenMeshTools.so -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/linux/libOpenMeshTools.so.7.1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/linux/libOpenMeshTools.so.7.1 -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/osx/libOpenMeshTools.5.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/osx/libOpenMeshTools.5.0.dylib -------------------------------------------------------------------------------- /examples/external/OpenMesh/lib/osx/libOpenMeshTools.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/OpenMesh/lib/osx/libOpenMeshTools.dylib -------------------------------------------------------------------------------- /examples/external/mLib/.gitignore: -------------------------------------------------------------------------------- 1 | /test/testWindows/*.opensdf 2 | /test/testWindows/*.sdf 3 | /test/testWindows/x64/Debug/*.log 4 | /test/testWindows/x64/Debug/testCore.tlog/*.tlog 5 | /test/testWindows/x64/Debug/testCore.tlog/*.lastbuildstate 6 | /test/testWindows/x64/Debug/testCore.tlog/* 7 | /test/testWindows/x64/Debug/*.idb 8 | /test/testWindows/x64/Debug/*.pdb 9 | /test/testWindows/ipch/testcore-d7582096/testcore-ada689b3.ipch 10 | /test/testWindows/test.v12.suo 11 | /test/testWindows/x64/Debug/mLibSource.obj 12 | /test/testWindows/x64/Debug/main.obj 13 | /test/testWindows/x64/Debug/testCore.exe 14 | /test/testWindows/x64/Debug/testCore.ilk 15 | /test/testWindows/x64/Debug/testCore.pch 16 | -------------------------------------------------------------------------------- /examples/external/mLib/TODO.txt: -------------------------------------------------------------------------------- 1 | make sure obj mtl writing works 2 | 3 | Update triMeshAcceleratorBVH to parameterize parallel build and possibly support parelll build for midpoint. 4 | OBB2f 5 | parameterize ml::shapes 6 | 7 | Intersections/Collision: 8 | mesh - mesh; ideal std::vector> - std::vector> 9 | BVH: Triangle -> Primitive (to support Vertices) 10 | Mesh - Ray 11 | Mesh - Line 12 | Mesh - OBB (get NR eigenvalue computation into matrix3x3) 13 | 14 | OnMeshLoad: reduces to lower res mesh for collisison (maybe in quadedge)` 15 | 16 | D3D11: Culling + Shading 17 | Shapes: Cylinder, Torus, Sphere 18 | 19 | 20 | Code audit: 21 | 22 | core-base 23 | * common.h -> 24 | * console.h -> now multiStream.h 25 | * baseImage -> 26 | some core functions seem to be missing, like getSubregion 27 | some functions don't do what they sound like, like copyIntoImage should actually be named copyFromImage 28 | I think some functions assume floats and are broken on r8g8b8 images 29 | MImage is fine to keep if it's useful, but feels like we can just handle all this with stream serialization? 30 | * baseImageHelper -> 31 | Some functions here should be moved to a colorUtil namespace 32 | -------------------------------------------------------------------------------- /examples/external/mLib/data/colormaps/parula.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/mLib/data/colormaps/parula.png -------------------------------------------------------------------------------- /examples/external/mLib/data/fonts/bitmapFontA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/mLib/data/fonts/bitmapFontA.png -------------------------------------------------------------------------------- /examples/external/mLib/data/shaders/defaultBasic.hlsl: -------------------------------------------------------------------------------- 1 | 2 | cbuffer ConstantBuffer : register(b0) 3 | { 4 | matrix worldViewProj; 5 | float4 modelColor; 6 | } 7 | 8 | 9 | struct VertexShaderOutput 10 | { 11 | float4 position : SV_POSITION; 12 | float4 color : TEXCOORD0; 13 | }; 14 | 15 | VertexShaderOutput vertexShaderMain( 16 | float4 position : position, 17 | float3 normal : normal, 18 | float4 color : color, 19 | float2 texCoord : texCoord) 20 | { 21 | VertexShaderOutput output; 22 | output.position = mul(position, worldViewProj); 23 | output.color = color; 24 | return output; 25 | } 26 | 27 | float4 pixelShaderMain(VertexShaderOutput input) : SV_Target 28 | { 29 | //return float4(input.color.xyz, 1.0f); 30 | return float4(input.color.xyz * modelColor, 1.0f); 31 | } 32 | -------------------------------------------------------------------------------- /examples/external/mLib/data/shaders/defaultBasicTexture.hlsl: -------------------------------------------------------------------------------- 1 | 2 | cbuffer ConstantBuffer : register(b0) 3 | { 4 | matrix worldViewProj; 5 | float4 modelColor; 6 | } 7 | 8 | Texture2D modelTexture : register(t0); 9 | SamplerState modelSampler : register(s0); 10 | 11 | struct VertexShaderOutput 12 | { 13 | float4 position : SV_POSITION; 14 | float2 texCoord : TEXCOORD0; 15 | float3 normal : NORMAL; 16 | float3 worldPos : WORLDPOS; 17 | }; 18 | 19 | VertexShaderOutput vertexShaderMain(float4 position : position, 20 | float3 normal : normal, 21 | float4 color : color, 22 | float2 texCoord : texCoord) 23 | { 24 | VertexShaderOutput output; 25 | output.position = mul(position, worldViewProj); 26 | output.texCoord = texCoord.xy; 27 | output.normal = normal; 28 | output.worldPos = position.xyz; 29 | return output; 30 | } 31 | 32 | float4 pixelShaderMain(VertexShaderOutput input) : SV_Target 33 | { 34 | float4 texColor = modelTexture.Sample(modelSampler, float2(input.texCoord.x, 1.0 - input.texCoord.y)); 35 | 36 | return float4(modelColor.xyz * texColor.xyz, 1.0f); 37 | } 38 | -------------------------------------------------------------------------------- /examples/external/mLib/data/shaders/defaultPointCloud.hlsl: -------------------------------------------------------------------------------- 1 | 2 | cbuffer ConstantBuffer : register( b0 ) 3 | { 4 | matrix worldViewProj; 5 | matrix world; 6 | float4 lightDir; 7 | float4 eye; 8 | } 9 | 10 | 11 | struct VertexShaderOutput 12 | { 13 | float4 position : SV_POSITION; 14 | float4 color : TEXCOORD0; 15 | float3 normal : TEXCOORD1; 16 | }; 17 | 18 | VertexShaderOutput vertexShaderMain( float4 position : position, 19 | float3 normal : normal, 20 | float4 color : color, 21 | float2 texCoord : texCoord) 22 | { 23 | VertexShaderOutput output; 24 | output.position = mul( position, worldViewProj ); 25 | output.color = color; 26 | output.normal = normal; 27 | return output; 28 | } 29 | 30 | float4 pixelShaderMain( VertexShaderOutput input ) : SV_Target 31 | { 32 | //float3 n = normalize(input.normal) * 0.5 + float3(0.5, 0.5, 0.5); 33 | //return float4( n.x, n.y, n.z, 1.0f ); 34 | return input.color; 35 | } -------------------------------------------------------------------------------- /examples/external/mLib/include/application-base/graphicsAsset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef APPLICATION_BASE_GRAPHICSASSET_H_ 3 | #define APPLICATION_BASE_GRAPHICSASSET_H_ 4 | 5 | namespace ml { 6 | 7 | class GraphicsAsset 8 | { 9 | public: 10 | //! returns the asset name 11 | virtual std::string getName() const { 12 | return typeid(*this).name(); 13 | } 14 | 15 | protected: 16 | //! releases all GPU parts 17 | virtual void releaseGPU() = 0; 18 | //! (re-)creates all GPU parts 19 | virtual void createGPU() = 0; 20 | }; 21 | 22 | } // namespace ml 23 | 24 | #endif // APPLICATION_BASE_GRAPHICSASSET_H_ -------------------------------------------------------------------------------- /examples/external/mLib/include/application-d3d11/D3D11GeometryShader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef APPLICATION_D3D11_D3D11GEOMETRYSHADER_H_ 3 | #define APPLICATION_D3D11_D3D11GEOMETRYSHADER_H_ 4 | 5 | namespace ml { 6 | 7 | class D3D11GeometryShader : public GraphicsAsset 8 | { 9 | public: 10 | D3D11GeometryShader() 11 | { 12 | m_shader = nullptr; 13 | m_blob = nullptr; 14 | m_graphics = nullptr; 15 | } 16 | 17 | ~D3D11GeometryShader() 18 | { 19 | releaseGPU(); 20 | } 21 | 22 | void init( 23 | GraphicsDevice& g, 24 | const std::string& filename, 25 | const std::string& entryPoint = "geometryShaderMain", 26 | const std::string& shaderModel = "gs_4_0", 27 | const std::vector>& shaderMacros = std::vector>()); 28 | 29 | void releaseGPU(); 30 | void createGPU(); 31 | 32 | void bind() const; 33 | 34 | bool isInit() const { 35 | return m_shader != nullptr; 36 | } 37 | private: 38 | D3D11GraphicsDevice *m_graphics; 39 | ID3D11GeometryShader *m_shader; 40 | ID3DBlob *m_blob; 41 | std::string m_filename; 42 | }; 43 | 44 | } // namespace ml 45 | 46 | #endif // APPLICATION_D3D11_D3D11GeometryShader_H_ 47 | -------------------------------------------------------------------------------- /examples/external/mLib/include/application-d3d11/D3D11PixelShader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef APPLICATION_D3D11_D3D11PIXELSHADER_H_ 3 | #define APPLICATION_D3D11_D3D11PIXELSHADER_H_ 4 | 5 | namespace ml { 6 | 7 | class D3D11PixelShader : public GraphicsAsset 8 | { 9 | public: 10 | D3D11PixelShader() 11 | { 12 | m_shader = nullptr; 13 | m_blob = nullptr; 14 | m_graphics = nullptr; 15 | } 16 | 17 | ~D3D11PixelShader() 18 | { 19 | releaseGPU(); 20 | } 21 | 22 | void init( 23 | GraphicsDevice &g, 24 | const std::string &filename, 25 | const std::string& entryPoint = "pixelShaderMain", 26 | const std::string& shaderModel = "ps_4_0", 27 | const std::vector>& shaderMacros = std::vector>()); 28 | 29 | void releaseGPU(); 30 | void createGPU(); 31 | 32 | void bind() const; 33 | 34 | UINT64 hash64(); 35 | 36 | private: 37 | D3D11GraphicsDevice *m_graphics; 38 | ID3D11PixelShader *m_shader; 39 | ID3DBlob *m_blob; 40 | std::string m_filename; 41 | }; 42 | 43 | } // namespace ml 44 | 45 | #endif // APPLICATION_D3D11_D3D11PIXELSHADER_H_ 46 | -------------------------------------------------------------------------------- /examples/external/mLib/include/application-d3d11/D3D11Utility.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef APPLICATION_D3D11_D3D11UTILITY_H_ 3 | #define APPLICATION_D3D11_D3D11UTILITY_H_ 4 | 5 | namespace ml { 6 | 7 | class D3D11Utility 8 | { 9 | public: 10 | static ID3DBlob* CompileShader( 11 | const std::string &filename, 12 | const std::string &entryPoint, 13 | const std::string &shaderModel, 14 | const std::vector>& macros = std::vector>()); 15 | }; 16 | 17 | } // namespace ml 18 | 19 | #endif // APPLICATION_D3D11_D3D11UTILITY_H_ 20 | -------------------------------------------------------------------------------- /examples/external/mLib/include/application-d3d11/D3D11VertexShader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef APPLICATION_D3D11_D3D11VERTEXSHADER_H_ 3 | #define APPLICATION_D3D11_D3D11VERTEXSHADER_H_ 4 | 5 | namespace ml { 6 | 7 | class D3D11VertexShader : public GraphicsAsset 8 | { 9 | public: 10 | D3D11VertexShader() 11 | { 12 | m_shader = nullptr; 13 | m_blob = nullptr; 14 | m_standardLayout = nullptr; 15 | m_graphics = nullptr; 16 | } 17 | ~D3D11VertexShader() 18 | { 19 | SAFE_RELEASE(m_shader); 20 | SAFE_RELEASE(m_blob); 21 | SAFE_RELEASE(m_standardLayout); 22 | } 23 | void init( 24 | GraphicsDevice &g, 25 | const std::string &filename, 26 | const std::string& entryPoint = "vertexShaderMain", 27 | const std::string& shaderModel = "vs_4_0", 28 | const std::vector>& shaderMacros = std::vector>()); 29 | 30 | void releaseGPU(); 31 | void createGPU(); 32 | 33 | void bind() const; 34 | 35 | private: 36 | D3D11GraphicsDevice *m_graphics; 37 | ID3D11VertexShader *m_shader; 38 | ID3DBlob *m_blob; 39 | std::string m_filename; 40 | 41 | ID3D11InputLayout *m_standardLayout; 42 | }; 43 | 44 | } // namespace ml 45 | 46 | #endif // APPLICATION_D3D11_D3D11VERTEXSHADER_H_ 47 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/cone.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/mLib/include/core-graphics/cone.h -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/cylinder.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/mLib/include/core-graphics/cylinder.h -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/line2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_GRAPHICS_LINE2D_H_ 3 | #define CORE_GRAPHICS_LINE2D_H_ 4 | 5 | namespace ml { 6 | 7 | template 8 | class Line2 9 | { 10 | public: 11 | 12 | Line2(const LineSegment2 &segment) 13 | { 14 | m_p0 = segment.p0(); 15 | m_dir = segment.delta(); 16 | } 17 | Line2(const vec2 &p0, const vec2 &p1) 18 | { 19 | m_p0 = p0; 20 | m_dir = p1 - p0; 21 | } 22 | 23 | const vec2& p0() const 24 | { 25 | return m_p0; 26 | } 27 | 28 | const vec2& dir() const 29 | { 30 | return m_dir; 31 | } 32 | 33 | private: 34 | vec2 m_p0; 35 | vec2 m_dir; 36 | }; 37 | 38 | typedef Line2 Line2f; 39 | typedef Line2 Line2d; 40 | 41 | } // namespace ml 42 | 43 | #endif // CORE_GRAPHICS_LINE2D_H_ 44 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/lineSegment2.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_GRAPHICS_LINESEGMENT2_H_ 3 | #define CORE_GRAPHICS_LINESEGMENT2_H_ 4 | 5 | namespace ml { 6 | 7 | template 8 | class LineSegment2 9 | { 10 | public: 11 | 12 | LineSegment2(const vec2 &p0, const vec2 &p1) 13 | { 14 | m_p0 = p0; 15 | m_p1 = p1; 16 | m_delta = m_p1 - m_p0; 17 | } 18 | 19 | const vec2& p0() const 20 | { 21 | return m_p0; 22 | } 23 | 24 | const vec2& p1() const 25 | { 26 | return m_p1; 27 | } 28 | 29 | const vec2& delta() const 30 | { 31 | return m_delta; 32 | } 33 | 34 | private: 35 | vec2 m_p0; 36 | vec2 m_p1; 37 | vec2 m_delta; //p1 - p0 38 | }; 39 | 40 | typedef LineSegment2 LineSegment2f; 41 | typedef LineSegment2 LineSegment2d; 42 | 43 | } // namespace ml 44 | 45 | #endif // CORE_GRAPHICS_LINESEGMENT2D_H_ 46 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/lineSegment3.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_GRAPHICS_LINESEGMENT3_H_ 3 | #define CORE_GRAPHICS_LINESEGMENT3_H_ 4 | 5 | namespace ml { 6 | 7 | template 8 | class LineSegment3 9 | { 10 | public: 11 | 12 | LineSegment3(const vec3 &p0, const vec3 &p1) 13 | { 14 | m_p0 = p0; 15 | m_p1 = p1; 16 | m_delta = m_p1 - m_p0; 17 | } 18 | 19 | const vec3& p0() const 20 | { 21 | return m_p0; 22 | } 23 | 24 | const vec3& p1() const 25 | { 26 | return m_p1; 27 | } 28 | 29 | const vec3& delta() const 30 | { 31 | return m_delta; 32 | } 33 | 34 | private: 35 | vec3 m_p0; 36 | vec3 m_p1; 37 | vec3 m_delta; //p1 - p0 38 | }; 39 | 40 | typedef LineSegment3 LineSegment3f; 41 | typedef LineSegment3 LineSegment3d; 42 | 43 | } // namespace ml 44 | 45 | #endif // CORE_GRAPHICS_LINESEGMENT3D_H_ 46 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/sphere.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/examples/external/mLib/include/core-graphics/sphere.h -------------------------------------------------------------------------------- /examples/external/mLib/include/core-graphics/triangle.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _TRIANGLE_H_ 4 | #define _TRIANGLE_H_ 5 | 6 | namespace ml { 7 | 8 | template 9 | struct Triangle 10 | { 11 | Triangle() {} 12 | Triangle(const vec3 &v0, const vec3 &v1, const vec3 &v2) 13 | { 14 | vertices[0] = v0; 15 | vertices[1] = v1; 16 | vertices[2] = v2; 17 | } 18 | vec3 getNormal() const 19 | { 20 | return ml::math::triangleNormal(vertices[0], vertices[1], vertices[2]); 21 | } 22 | 23 | float getArea() const { 24 | vec3f ab = vertices[1] - vertices[0]; 25 | vec3f ac = vertices[2] - vertices[0]; 26 | float len = ab.length() * ac.length(); 27 | float cosTheta = (ab | ac) / len; 28 | if (fabs(cosTheta + 1) < 0.00001f || fabs(cosTheta - 1) < 0.00001f) { 29 | return 0; 30 | } 31 | float theta = std::acos(cosTheta); 32 | float area (0.5f * len * std::sin(theta)); 33 | MLIB_ASSERT(area > 0); 34 | return area; 35 | } 36 | 37 | vec3 vertices[3]; 38 | 39 | }; 40 | 41 | typedef Triangle Trianglef; 42 | typedef Triangle Triangled; 43 | 44 | } //namespace ml 45 | 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-mesh/meshUtil.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_MESH_MESHUTIL_H_ 2 | #define CORE_MESH_MESHUTIL_H_ 3 | 4 | namespace ml { 5 | namespace meshutil { 6 | 7 | TriMeshf createPointCloudTemplate(const TriMeshf& templateMesh, const std::vector& points, const std::vector& colors = std::vector()); 8 | TriMeshf createUnifiedMesh(const std::vector< std::pair >& meshes); 9 | TriMeshf createUnifiedMesh(const std::vector>& meshes); 10 | TriMeshf createUnifiedMesh(const std::vector& meshes); 11 | 12 | } // namespace meshutil 13 | } // namespace ml 14 | 15 | #endif // CORE_MESH_MESHUTIL_H_ 16 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-multithreading/taskList.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_MULTITHREADING_TASKLIST_H_ 3 | #define CORE_MULTITHREADING_TASKLIST_H_ 4 | 5 | namespace ml 6 | { 7 | 8 | template class TaskList 9 | { 10 | public: 11 | void insert(const T &task) 12 | { 13 | m_mutex.lock(); 14 | m_tasks.push_back(task); 15 | m_mutex.unlock(); 16 | } 17 | 18 | bool done() 19 | { 20 | m_mutex.lock(); 21 | bool result = (m_tasks.size() == 0); 22 | m_mutex.unlock(); 23 | return result; 24 | } 25 | 26 | UINT64 tasksLeft() 27 | { 28 | m_mutex.lock(); 29 | UINT64 result = m_tasks.size(); 30 | m_mutex.unlock(); 31 | return result; 32 | } 33 | 34 | bool getNextTask(T &nextTask) 35 | { 36 | m_mutex.lock(); 37 | if(m_tasks.size() == 0) 38 | { 39 | m_mutex.unlock(); 40 | return false; 41 | } 42 | 43 | nextTask = m_tasks.back(); 44 | m_tasks.pop_back(); 45 | m_mutex.unlock(); 46 | return true; 47 | } 48 | 49 | private: 50 | std::mutex m_mutex; 51 | std::vector m_tasks; 52 | }; 53 | 54 | } // namespace ml 55 | 56 | #endif // CORE_MULTITHREADING_TASKLIST_H_ 57 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-multithreading/threadPool.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_MULTITHREADING_THREADPOOL_H_ 2 | #define CORE_MULTITHREADING_THREADPOOL_H_ 3 | 4 | namespace ml 5 | { 6 | 7 | class ThreadPool 8 | { 9 | public: 10 | ~ThreadPool() {} 11 | 12 | void init(UINT threadCount); 13 | void init(UINT threadCount, const std::vector &threadLocalStorage); 14 | void runTasks(TaskList &tasks, bool useConsole = true); 15 | 16 | private: 17 | std::vector m_threads; 18 | }; 19 | 20 | } // namespace ml 21 | 22 | #endif // CORE_MULTITHREADING_THREADPOOL_H_ 23 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-multithreading/workerThread.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_MULTITHREADING_WORKERTHREAD_H_ 2 | #define CORE_MULTITHREADING_WORKERTHREAD_H_ 3 | 4 | namespace ml 5 | { 6 | 7 | // 8 | // abstract base class for thread local storage 9 | // 10 | class ThreadLocalStorage 11 | { 12 | public: 13 | 14 | }; 15 | 16 | // 17 | // abstract base class for thread tasks 18 | // 19 | class WorkerThreadTask 20 | { 21 | public: 22 | virtual ~WorkerThreadTask() {} 23 | virtual void run(UINT threadIndex, ThreadLocalStorage *threadLocalStorage) = 0; 24 | }; 25 | 26 | class WorkerThread 27 | { 28 | public: 29 | WorkerThread() 30 | { 31 | m_thread = nullptr; 32 | } 33 | ~WorkerThread() 34 | { 35 | //SAFE_DELETE(m_thread); 36 | } 37 | 38 | void init(UINT threadIndex, ThreadLocalStorage *storage); 39 | void processTasks(TaskList &tasks); 40 | 41 | bool done() 42 | { 43 | return m_done; 44 | } 45 | 46 | private: 47 | static void workerThreadEntry( WorkerThread *context ); 48 | void enterThreadTaskLoop(); 49 | 50 | bool m_done; 51 | std::thread *m_thread; 52 | 53 | UINT m_threadIndex; 54 | ThreadLocalStorage *m_storage; 55 | 56 | TaskList *m_tasks; 57 | }; 58 | 59 | } // namespace ml 60 | 61 | #endif // CORE_MULTITHREADING_WORKERTHREAD_H_ 62 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-util/UIConnection.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_UTIL_UICONNECTION_H_ 2 | #define CORE_UTIL_UICONNECTION_H_ 3 | 4 | #ifdef _WIN32 5 | 6 | #include 7 | 8 | namespace ml { 9 | 10 | class UIConnection 11 | { 12 | public: 13 | void init(const std::string &executableFile, const std::string &pipeBaseName); 14 | void readMessages(); 15 | void sendMessage(const std::string &message); 16 | 17 | inline std::vector& messages() 18 | { 19 | return m_messages; 20 | } 21 | private: 22 | std::vector m_messages; 23 | Pipe m_writeToUIPipe; 24 | Pipe m_readFromUIPipe; 25 | }; 26 | 27 | } // namespace ml 28 | 29 | #endif // _WIN32 30 | 31 | #endif // CORE_UTIL_UICONNECTION_H_ 32 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-util/binaryDataSerialize.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_UTIL_BINARYDATASERIALIZE_H_ 3 | #define CORE_UTIL_BINARYDATASERIALIZE_H_ 4 | 5 | #include "binaryDataStream.h" 6 | 7 | namespace ml 8 | { 9 | 10 | template 11 | class BinaryDataSerialize { 12 | public: 13 | unsigned int getSizeInBytes() { 14 | return sizeof(ChildClass); 15 | } 16 | }; 17 | 18 | template 19 | inline BinaryDataStream& operator<< (BinaryDataStream& s, const BinaryDataSerialize& o) { 20 | s.writeData(*(const ChildClass*)&o); //cast it to the child class to get the right size 21 | return s; 22 | } 23 | 24 | template 25 | inline BinaryDataStream& operator>> (BinaryDataStream& s, BinaryDataSerialize &o) { 26 | s.readData(*((ChildClass*)&o)); 27 | return s; 28 | } 29 | 30 | } // namespace ml 31 | 32 | #endif // CORE_UTIL_BINARYDATASERIALIZE_H__ 33 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-util/colorGradient.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef CORE_UTIL_COLORGRADIENT_H_ 4 | #define CORE_UTIL_COLORGRADIENT_H_ 5 | 6 | namespace ml { 7 | 8 | class ColorGradient 9 | { 10 | public: 11 | ColorGradient() {} 12 | ColorGradient(const ColorImageR8G8B8A8 &image, RGBColor leftColor = RGBColor::Black, RGBColor rightColor = RGBColor::White) 13 | { 14 | m_colors.resize(image.getWidth()); 15 | for (unsigned int i = 0; i < image.getWidth(); i++) { 16 | m_colors[i] = image(i,0u); 17 | } 18 | } 19 | 20 | RGBColor value(double x) const 21 | { 22 | if(x < 0.0) return m_leftColor; 23 | if(x > 1.0) return m_rightColor; 24 | double s = x * m_colors.size(); 25 | int f = (int)floor(s); 26 | RGBColor a = m_colors[(UINT)math::clamp(f, 0, (int)m_colors.size() - 1)]; 27 | RGBColor b = m_colors[(UINT)math::clamp(f + 1, 0, (int)m_colors.size() - 1)]; 28 | return RGBColor::interpolate(a, b, (float)(s - f)); 29 | } 30 | 31 | private: 32 | std::vector m_colors; 33 | RGBColor m_leftColor, m_rightColor; 34 | }; 35 | 36 | } // namespace ml 37 | 38 | 39 | #endif // CORE_UTIL_COLORGRADIENT_H_ -------------------------------------------------------------------------------- /examples/external/mLib/include/core-util/eventMap.h: -------------------------------------------------------------------------------- 1 | 2 | namespace ml 3 | { 4 | 5 | class EventMap 6 | { 7 | public: 8 | void registerEvent(const std::string &event, const std::function ¶ms)> &handler); 9 | void dispatchEvents(const std::vector &messages) const; 10 | #ifdef _WIN32 11 | void dispatchEvents(ml::UIConnection &ui) const; 12 | #endif 13 | private: 14 | std::map< std::string, std::function ¶ms)> > _handlers; 15 | }; 16 | 17 | } -------------------------------------------------------------------------------- /examples/external/mLib/include/core-util/pipe.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CORE_UTIL_PIPE_H_ 3 | #define CORE_UTIL_PIPE_H_ 4 | 5 | namespace ml 6 | { 7 | 8 | class Pipe 9 | { 10 | public: 11 | Pipe(); 12 | ~Pipe(); 13 | 14 | // 15 | // Connection 16 | // 17 | void closePipe(); 18 | void createPipe(const std::string &pipeName, bool block); 19 | void connectToLocalPipe(const std::string &pipeName); 20 | void connectToPipe(const std::string &pipeName); 21 | 22 | // 23 | // Messaging 24 | // 25 | bool messagePresent(); 26 | bool readMessage(std::vector &message); 27 | void sendMessage(const BYTE *message, UINT messageLength); 28 | void sendMessage(const std::vector &message); 29 | void sendMessage(const std::string &message); 30 | 31 | // 32 | // Query 33 | // 34 | UINT activeInstances(); 35 | std::string userName(); 36 | bool valid(); 37 | 38 | private: 39 | 40 | #ifdef _WIN32 41 | void* m_handle; 42 | #endif 43 | }; 44 | 45 | } // namespace ml 46 | 47 | #endif // CORE_UTIL_PIPE_H_ 48 | -------------------------------------------------------------------------------- /examples/external/mLib/include/core-util/windowsUtil.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WINDOWS_UTIL_H_ 3 | #define WINDOWS_UTIL_H_ 4 | 5 | #ifdef _WIN32 6 | 7 | namespace ml { 8 | 9 | namespace util { 10 | std::string getLastErrorString(); 11 | //! checks an error and exits 12 | void errorExit(const std::string& functionName); 13 | } 14 | } 15 | 16 | #endif 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /examples/external/mLib/include/ext-boost/options.h: -------------------------------------------------------------------------------- 1 | #ifndef EXT_OPTIONS_H_ 2 | #define EXT_OPTIONS_H_ 3 | 4 | #include 5 | 6 | #endif // EXT_OPTIONS_H_ 7 | -------------------------------------------------------------------------------- /examples/external/mLib/include/ext-lodepng/imageLoaderLodePNG.h: -------------------------------------------------------------------------------- 1 | #ifndef _EXT_LODEPNG_IMAGELOADERLODEPNG_H_ 2 | #define _EXT_LODEPNG_IMAGELOADERLODEPNG_H_ 3 | 4 | namespace ml { 5 | 6 | class LodePNG 7 | { 8 | public: 9 | static ColorImageR8G8B8A8 load(const std::string &filename); 10 | static void save(const ColorImageR8G8B8A8 &image, const std::string &filename, bool saveTransparency = false); 11 | }; 12 | 13 | } // namespace ml 14 | 15 | #endif // _EXT_LODEPNG_IMAGELOADERLODEPNG_H_ 16 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibBoost.h: -------------------------------------------------------------------------------- 1 | #ifndef MLIBBOOST_H_ 2 | #define MLIBBOOST_H_ 3 | 4 | // Get rid of warning due to ambiguity in pre-XP vs XP and later Windows versions 5 | #ifndef _WIN32_WINNT 6 | #define _WIN32_WINNT 0x0501 7 | #endif 8 | 9 | // 10 | // external boost headers 11 | // 12 | #include 13 | 14 | // TODO: Find appropriate set of convenience headers to include here 15 | 16 | // 17 | // ext-boost headers 18 | // 19 | #include "ext-boost/serialization.h" 20 | #include "ext-boost/options.h" 21 | 22 | #endif // MLIBBOOST_H_ 23 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibCGAL.h: -------------------------------------------------------------------------------- 1 | // 2 | // external CGAL headers 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | // 14 | // ext-cgal headers 15 | // 16 | #include "ext-cgal/cgalWrapper.h" 17 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibD3D11.cpp: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // application-base source files 4 | // 5 | #include "../src/application-base/windowWin32.cpp" 6 | #include "../src/application-base/applicationWin32.cpp" 7 | 8 | // 9 | // application-d3d11 source files 10 | // 11 | #include "../src/application-d3d11/D3D11GraphicsDevice.cpp" 12 | #include "../src/application-d3d11/D3D11Utility.cpp" 13 | #include "../src/application-d3d11/D3D11VertexShader.cpp" 14 | #include "../src/application-d3d11/D3D11GeometryShader.cpp" 15 | #include "../src/application-d3d11/D3D11PixelShader.cpp" 16 | #include "../src/application-d3d11/D3D11ShaderManager.cpp" 17 | #include "../src/application-d3d11/D3D11TriMesh.cpp" 18 | #include "../src/application-d3d11/D3D11PointCloud.cpp" 19 | #include "../src/application-d3d11/D3D11RenderTarget.cpp" 20 | #include "../src/application-d3d11/D3D11Canvas2D.cpp" 21 | #include "../src/application-d3d11/D3D11AssetRenderer.cpp" -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibD3D11.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // application-base headers 5 | // 6 | #include "application-base/windowWin32.h" 7 | #include "application-base/graphicsAsset.h" 8 | #include "application-base/graphicsDevice.h" 9 | #include "application-base/applicationWin32.h" 10 | 11 | // 12 | // D3D11 headers 13 | // 14 | #pragma warning ( disable : 4005) 15 | 16 | #include 17 | #include //D3dX is in theory deprecated // see D3D11Utility.cpp, line 84 18 | #include 19 | 20 | // 21 | // application-d3d11 headers 22 | // 23 | #include "application-d3d11/D3D11VertexShader.h" 24 | #include "application-d3d11/D3D11GeometryShader.h" 25 | #include "application-d3d11/D3D11PixelShader.h" 26 | #include "application-d3d11/D3D11ShaderManager.h" 27 | #include "application-d3d11/D3D11GraphicsDevice.h" 28 | #include "application-d3d11/D3D11Utility.h" 29 | #include "application-d3d11/D3D11ConstantBuffer.h" 30 | #include "application-d3d11/D3D11TriMesh.h" 31 | #include "application-d3d11/D3D11PointCloud.h" 32 | #include "application-d3d11/D3D11Texture2D.h" 33 | #include "application-d3d11/D3D11Texture3D.h" 34 | #include "application-d3d11/D3D11Buffer.h" 35 | #include "application-d3d11/D3D11RenderTarget.h" 36 | #include "application-d3d11/D3D11Canvas2D.h" 37 | #include "application-d3d11/D3D11AssetRenderer.h" 38 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibD3D11Font.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ext-eigen headers 4 | // 5 | #include "ext-d3d11font/D3D11Font.h" 6 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibDepthCamera.cpp: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ext-depthcamera headers 4 | // 5 | //#include "ext-depthcamera/calibratedSensorData.h" //this is obsolete 6 | // 7 | 8 | 9 | namespace stb { 10 | #define STB_IMAGE_IMPLEMENTATION 11 | #include "ext-depthcamera/sensorData/stb_image.h" 12 | #undef STB_IMAGE_IMPLEMENTATION 13 | 14 | #define STB_IMAGE_WRITE_IMPLEMENTATION 15 | #include "ext-depthcamera/sensorData/stb_image_write.h" 16 | #undef STB_IMAGE_WRITE_IMPLEMENTATION 17 | } -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibDepthCamera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // 4 | // ext-depthcamera headers 5 | // 6 | #include "ext-depthcamera/calibratedSensorData.h" //this is obsolete 7 | #include "ext-depthcamera/sensorData.h" -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibEigen.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #ifndef _MLIB_EIGEN_H_ 4 | #define _MLIB_EIGEN_H_ 5 | 6 | //#include "Eigen33b1/Sparse" 7 | //#include "Eigen33b1/Eigenvalues" 8 | 9 | #include "Eigen/Sparse" 10 | #include "Eigen/Eigenvalues" 11 | 12 | // 13 | // ext-eigen headers 14 | // 15 | #include "ext-eigen/eigenUtility.h" 16 | #include "ext-eigen/eigenSolver.h" 17 | 18 | #endif // _MLIB_EIGEN_H_ -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibFLANN.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // external flann headers 4 | // 5 | #include "flann/flann.hpp" 6 | 7 | // 8 | // ext-flann headers 9 | // 10 | #include "ext-flann/nearestNeighborSearchFLANN.h" 11 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibFreeImage.h: -------------------------------------------------------------------------------- 1 | // 2 | // external FreeImage headers 3 | // 4 | //#include "FreeImage.h" 5 | #include "FreeImage/FreeImage.h" 6 | //#include 7 | 8 | // 9 | // ext-FreeImage headers 10 | // 11 | #include "ext-freeimage/freeImageWrapper.h" 12 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibLodePNG.cpp: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // external lodepng source 4 | // 5 | #include "../src/ext-lodepng/lodepng.cpp" 6 | 7 | // 8 | // ext-lodepng source files 9 | // 10 | #include "../src/ext-lodepng/imageLoaderLodePNG.cpp" 11 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibLodePNG.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // external lodepng headers 4 | // 5 | #include "ext-lodepng/lodepng.h" 6 | 7 | // 8 | // ext-lodepng headers 9 | // 10 | #include "ext-lodepng/imageLoaderLodePNG.h" 11 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibMBase.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ext-ZLib headers 4 | // 5 | #include "ext-mbase/mBase.h" 6 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibOpenMesh.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | #ifndef INCLUDE_MLIBOPENMESH_H_ 4 | #define INCLUDE_MLIBOPENMESH_H_ 5 | 6 | //// If you link statically against OpenMesh, you have to add 7 | //// the define OM_STATIC_BUILD to your application. This will 8 | //// ensure that readers and writers get initialized correctly. 9 | //#ifndef OM_STATIC_BUILD 10 | //#define OM_STATIC_BUILD 11 | //#endif 12 | 13 | //This is pretty bad design choice to define it here because it will cause different behaviror if math.h was included before... 14 | #ifndef _USE_MATH_DEFINES 15 | #define _USE_MATH_DEFINES 16 | #endif 17 | 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | // 29 | // ext-openmesh headers 30 | // 31 | #include "ext-openmesh/loader.h" 32 | #include "ext-openmesh/triMesh.h" 33 | 34 | #endif // INCLUDE_MLIBOPENMESH_H_ 35 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibZLib.cpp: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // external ZLib headers 4 | // 5 | #include "zlib/zlib.h" 6 | 7 | // 8 | // ext-zlib source files 9 | // 10 | #include "../src/ext-zlib/ZLibWrapper.cpp" 11 | -------------------------------------------------------------------------------- /examples/external/mLib/include/mLibZLib.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // ext-ZLib headers 4 | // 5 | #include "ext-zlib/ZLibWrapper.h" 6 | -------------------------------------------------------------------------------- /examples/external/mLib/src/application-d3d11/D3D11GeometryShader.cpp: -------------------------------------------------------------------------------- 1 | 2 | void ml::D3D11GeometryShader::init( 3 | GraphicsDevice& g, 4 | const std::string& filename, 5 | const std::string& entryPoint, 6 | const std::string& shaderModel, 7 | const std::vector>& shaderMacros) 8 | { 9 | m_graphics = &g.castD3D11(); 10 | 11 | releaseGPU(); 12 | SAFE_RELEASE(m_blob); 13 | 14 | m_filename = filename; 15 | //g.castD3D11().registerAsset(this); 16 | 17 | m_blob = D3D11Utility::CompileShader(m_filename, entryPoint, shaderModel, shaderMacros); 18 | MLIB_ASSERT_STR(m_blob != nullptr, "CompileShader failed"); 19 | 20 | createGPU(); 21 | } 22 | 23 | void ml::D3D11GeometryShader::releaseGPU() 24 | { 25 | SAFE_RELEASE(m_shader); 26 | } 27 | 28 | void ml::D3D11GeometryShader::createGPU() 29 | { 30 | releaseGPU(); 31 | 32 | auto &device = m_graphics->getDevice(); 33 | 34 | D3D_VALIDATE(device.CreateGeometryShader(m_blob->GetBufferPointer(), m_blob->GetBufferSize(), nullptr, &m_shader)); 35 | } 36 | 37 | void ml::D3D11GeometryShader::bind() const 38 | { 39 | m_graphics->getContext().GSSetShader(m_shader, nullptr, 0); 40 | } -------------------------------------------------------------------------------- /examples/external/mLib/src/application-d3d11/D3D11PixelShader.cpp: -------------------------------------------------------------------------------- 1 | 2 | void ml::D3D11PixelShader::init( 3 | GraphicsDevice &g, 4 | const std::string &filename, 5 | const std::string& entryPoint, 6 | const std::string& shaderModel, 7 | const std::vector>& shaderMacros) 8 | { 9 | m_graphics = &g.castD3D11(); 10 | 11 | releaseGPU(); 12 | SAFE_RELEASE(m_blob); 13 | 14 | m_filename = filename; 15 | //g.castD3D11().registerAsset(this); 16 | 17 | m_blob = D3D11Utility::CompileShader(m_filename, entryPoint, shaderModel, shaderMacros); 18 | MLIB_ASSERT_STR(m_blob != nullptr, "CompileShader failed"); 19 | 20 | createGPU(); 21 | } 22 | 23 | void ml::D3D11PixelShader::releaseGPU() 24 | { 25 | SAFE_RELEASE(m_shader); 26 | } 27 | 28 | void ml::D3D11PixelShader::createGPU() 29 | { 30 | releaseGPU(); 31 | 32 | auto &device = m_graphics->getDevice(); 33 | 34 | D3D_VALIDATE(device.CreatePixelShader(m_blob->GetBufferPointer(), m_blob->GetBufferSize(), nullptr, &m_shader)); 35 | } 36 | 37 | void ml::D3D11PixelShader::bind() const 38 | { 39 | m_graphics->getContext().PSSetShader(m_shader, nullptr, 0); 40 | } -------------------------------------------------------------------------------- /examples/external/mLib/src/core-base/common.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | namespace ml 5 | { 6 | 7 | 8 | void warningFunctionMLIB(const std::string &description) 9 | { 10 | std::cout << description << std::endl; 11 | //DEBUG_BREAK; 12 | } 13 | 14 | void errorFunctionMLIB(const std::string &description) 15 | { 16 | std::cout << description << std::endl; 17 | DEBUG_BREAK; 18 | } 19 | 20 | void assertFunctionMLIB(bool statement, const std::string &description) 21 | { 22 | if(!statement) 23 | { 24 | std::cout << description << std::endl; 25 | #ifdef _DEBUG 26 | DEBUG_BREAK; 27 | #endif 28 | } 29 | } 30 | 31 | } // namespace ml 32 | -------------------------------------------------------------------------------- /examples/external/mLib/src/core-multithreading/workerThread.cpp: -------------------------------------------------------------------------------- 1 | 2 | namespace ml 3 | { 4 | 5 | void WorkerThread::init(UINT threadIndex, ThreadLocalStorage *storage) 6 | { 7 | m_threadIndex = threadIndex; 8 | m_storage = storage; 9 | } 10 | 11 | void WorkerThread::processTasks(TaskList &tasks) 12 | { 13 | m_done = false; 14 | m_tasks = &tasks; 15 | m_thread = new std::thread(workerThreadEntry, this); 16 | } 17 | 18 | void WorkerThread::workerThreadEntry( WorkerThread *context ) 19 | { 20 | context->enterThreadTaskLoop(); 21 | } 22 | 23 | void WorkerThread::enterThreadTaskLoop() 24 | { 25 | WorkerThreadTask* curTask; 26 | while(m_tasks->getNextTask(curTask)) 27 | { 28 | curTask->run(m_threadIndex, m_storage); 29 | delete curTask; 30 | } 31 | m_done = true; 32 | } 33 | 34 | } // namespace ml 35 | -------------------------------------------------------------------------------- /examples/external/mLib/src/core-util/eventMap.cpp: -------------------------------------------------------------------------------- 1 | 2 | namespace ml 3 | { 4 | 5 | void EventMap::registerEvent(const std::string &event, const std::function ¶ms)> &handler) 6 | { 7 | _handlers[event] = handler; 8 | } 9 | 10 | void EventMap::dispatchEvents(const vector &messages) const 11 | { 12 | for (const std::string &message : messages) 13 | { 14 | auto parts = ml::util::split(message, ' '); 15 | if (_handlers.count(parts[0]) == 0) 16 | { 17 | std::cout << "No event handler for: " << message << std::endl; 18 | } 19 | else 20 | { 21 | _handlers.find(parts[0])->second(parts); 22 | } 23 | } 24 | } 25 | 26 | #ifdef _WIN32 27 | void EventMap::dispatchEvents(ml::UIConnection &ui) const 28 | { 29 | ui.readMessages(); 30 | dispatchEvents(ui.messages()); 31 | ui.messages().clear(); 32 | } 33 | #endif 34 | 35 | } -------------------------------------------------------------------------------- /examples/external/mLib/src/core-util/timer.cpp: -------------------------------------------------------------------------------- 1 | 2 | namespace ml { 3 | 4 | //! returns the time in seconds 5 | double Timer::getTime() { 6 | #ifdef _WIN32 7 | unsigned __int64 pf; 8 | QueryPerformanceFrequency( (LARGE_INTEGER *)&pf ); 9 | double freq_ = 1.0 / (double)pf; 10 | 11 | unsigned __int64 val; 12 | QueryPerformanceCounter( (LARGE_INTEGER *)&val ); 13 | return (val) * freq_; 14 | #endif //_WIN32 15 | 16 | #ifdef LINUX 17 | struct timeval timevalue; 18 | gettimeofday(&timevalue, nullptr); 19 | return (double)((UINT64)timevalue.tv_sec) + (double)((UINT64)timevalue.tv_usec) / 1000000.0; 20 | #endif //LINUX 21 | } 22 | } // namespace ml -------------------------------------------------------------------------------- /examples/face_fitting/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = face_fitting 2 | OBJS = build/CUDAWarpingSolver.o build/mLibSource.o build/main.o build/WarpingSolver.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | endif 12 | 13 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 14 | 15 | USES_CERES=1 16 | 17 | include ../shared/make_template.inc 18 | -------------------------------------------------------------------------------- /examples/face_fitting/src/CUDAWarpingSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../shared/cudaUtil.h" 6 | #include "WarpingSolverParameters.h" 7 | #include "WarpingSolverState.h" 8 | #include "../../shared/SolverBase.h" 9 | 10 | class CUDAWarpingSolver : public SolverBase 11 | { 12 | public: 13 | CUDAWarpingSolver(unsigned int N, unsigned int M); 14 | ~CUDAWarpingSolver(); 15 | 16 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iter) override; 17 | 18 | private: 19 | SolverInput m_solverInput; 20 | SolverState m_solverState; 21 | unsigned int m_N; 22 | unsigned int m_M; 23 | }; 24 | -------------------------------------------------------------------------------- /examples/face_fitting/src/Resource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | //{{NO_DEPENDENCIES}} 8 | // Microsoft Visual C++ generated include file. 9 | // Used by DepthWithColor-D3D.rc 10 | // 11 | 12 | #define IDS_APP_TITLE 103 13 | 14 | #define IDI_APP 107 15 | #define IDC_STATIC -1 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | 21 | #define _APS_NO_MFC 130 22 | #define _APS_NEXT_RESOURCE_VALUE 129 23 | #define _APS_NEXT_COMMAND_VALUE 32771 24 | #define _APS_NEXT_CONTROL_VALUE 1000 25 | #define _APS_NEXT_SYMED_VALUE 110 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /examples/face_fitting/src/WarpingSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 9 | unsigned int nLinIterations; // Steps of the linear solver 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /examples/face_fitting/src/WarpingSolverUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SolverUtil.h" 4 | 5 | #include "../../shared/cudaUtil.h" 6 | 7 | #define THREADS_PER_BLOCK 512 // keep consistent with the CPU 8 | 9 | #define DR_THREAD_SIZE1_X 32 10 | #define DR_THREAD_SIZE1_Y 8 11 | 12 | __inline__ __device__ float warpReduce(float val) { 13 | int offset = 32 >> 1; 14 | while (offset > 0) { 15 | val = val + __shfl_down(val, offset, 32); 16 | offset = offset >> 1; 17 | } 18 | return val; 19 | } 20 | 21 | extern __shared__ float bucket[]; 22 | 23 | inline __device__ void scanPart1(unsigned int threadIdx, unsigned int blockIdx, unsigned int threadsPerBlock, float* d_output) 24 | { 25 | __syncthreads(); 26 | blockReduce(bucket, threadIdx, threadsPerBlock); 27 | if(threadIdx == 0) d_output[blockIdx] = bucket[0]; 28 | } 29 | 30 | inline __device__ void scanPart2(unsigned int threadIdx, unsigned int threadsPerBlock, unsigned int blocksPerGrid, float* d_tmp) 31 | { 32 | if(threadIdx < blocksPerGrid) bucket[threadIdx] = d_tmp[threadIdx]; 33 | else bucket[threadIdx] = 0.0f; 34 | 35 | __syncthreads(); 36 | blockReduce(bucket, threadIdx, threadsPerBlock); 37 | __syncthreads(); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /examples/face_fitting/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/face_fitting/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/face_fitting/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Resource.h" 4 | #include "mLibInclude.h" 5 | 6 | #ifndef SAFE_DELETE 7 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 8 | #endif 9 | #ifndef SAFE_DELETE_ARRAY 10 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 11 | #endif 12 | -------------------------------------------------------------------------------- /examples/image_warping/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = image_warping 2 | OBJS = build/CUDAWarpingSolver.o build/mLibSource.o build/main.o build/WarpingSolver.o 3 | include ../shared/make_template.inc 4 | -------------------------------------------------------------------------------- /examples/image_warping/src/CUDAWarpingSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../shared/cudaUtil.h" 6 | #include "WarpingSolverParameters.h" 7 | #include "WarpingSolverState.h" 8 | #include "../../shared/SolverBase.h" 9 | 10 | class CUDAWarpingSolver : public SolverBase 11 | { 12 | public: 13 | CUDAWarpingSolver(const std::vector& dims); 14 | ~CUDAWarpingSolver(); 15 | 16 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iters) override; 17 | 18 | private: 19 | 20 | SolverState m_solverState; 21 | std::vector m_dims; 22 | }; 23 | -------------------------------------------------------------------------------- /examples/image_warping/src/Resource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | //{{NO_DEPENDENCIES}} 8 | // Microsoft Visual C++ generated include file. 9 | // Used by DepthWithColor-D3D.rc 10 | // 11 | 12 | #define IDS_APP_TITLE 103 13 | 14 | #define IDI_APP 107 15 | #define IDC_STATIC -1 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | 21 | #define _APS_NO_MFC 130 22 | #define _APS_NEXT_RESOURCE_VALUE 129 23 | #define _APS_NEXT_COMMAND_VALUE 32771 24 | #define _APS_NEXT_CONTROL_VALUE 1000 25 | #define _APS_NEXT_SYMED_VALUE 110 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /examples/image_warping/src/WarpingSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | float weightFitting; // Fitting weights 9 | float weightRegularizer; // Regularization weight 10 | 11 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 12 | unsigned int nLinIterations; // Steps of the linear solver 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /examples/image_warping/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/image_warping/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/image_warping/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | //#include "resource.h" 4 | #include "mLibInclude.h" 5 | 6 | #ifndef SAFE_DELETE 7 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 8 | #endif 9 | #ifndef SAFE_DELETE_ARRAY 10 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /examples/intrinsic_image_decomposition/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = intrinsic_image_decomposition 2 | OBJS = build/mLibSource.o build/main.o 3 | include ../shared/make_template.inc 4 | -------------------------------------------------------------------------------- /examples/intrinsic_image_decomposition/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/intrinsic_image_decomposition/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/intrinsic_image_decomposition/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mLibInclude.h" 4 | 5 | #ifndef SAFE_DELETE 6 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 7 | #endif 8 | #ifndef SAFE_DELETE_ARRAY 9 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 10 | #endif 11 | -------------------------------------------------------------------------------- /examples/optical_flow/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = optical_flow 2 | OBJS = build/mLibSource.o build/main.o 3 | include ../shared/make_template.inc 4 | 5 | -------------------------------------------------------------------------------- /examples/optical_flow/optical_flow.t: -------------------------------------------------------------------------------- 1 | local W,H = Dims("W","H") 2 | Inputs { 3 | w_fitSqrt = Param(float, 0), 4 | w_regSqrt = Param(float, 1), 5 | X = Unknown(thallo_float2,{W,H},2), 6 | I = Array(thallo_float,{W,H},3), 7 | I_hat_im = Array(thallo_float,{W,H},4), 8 | I_hat_dx = Array(thallo_float,{W,H},5), 9 | I_hat_dy = Array(thallo_float,{W,H},6) 10 | } 11 | local I_hat = SampledImage(I_hat_im,I_hat_dx,I_hat_dy) 12 | 13 | 14 | local x = W() 15 | local y = H() 16 | local i,j = x:asvalue(), y:asvalue() 17 | UsePreconditioner(false) 18 | -- fitting 19 | local e_fit = w_fitSqrt*(I(x,y) - I_hat(i + X(x,y)(0),j + X(x,y)(1))) 20 | 21 | reg = {} 22 | -- regularization 23 | for ox,oy in Stencil { {1,0}, {-1,0}, {0,1}, {0,-1} } do 24 | local nx,ny = x+ox,y+oy 25 | local e_reg = w_regSqrt*(X(x,y) - X(nx,ny)) 26 | reg[#reg+1] = Select(InBounds(nx,ny),e_reg,0) 27 | end 28 | 29 | r = Residuals { 30 | fit = e_fit, 31 | reg_px = reg[1], 32 | reg_nx = reg[2], 33 | reg_py = reg[3], 34 | reg_ny = reg[4] 35 | } 36 | --r:merge(r.fit,r.reg):compute_at_output(true) 37 | -------------------------------------------------------------------------------- /examples/optical_flow/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/optical_flow/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = poisson_image_editing 2 | OBJS = build/CUDAPatchSolverWarping.o build/CUDAWarpingSolver.o build/mLibSource.o build/main.o build/PatchSolverWarping.o build/WarpingSolver.o build/EigenSolverPoissonImageEditing.o 3 | include ../shared/make_template.inc 4 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/poisson_image_editing.t: -------------------------------------------------------------------------------- 1 | local W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(thallo_float4, { W, H }, 0), --unknown, initialized to base image 4 | T = Array(thallo_float4,{W,H},1), -- inserted image 5 | M = Array(thallo_float, {W,H},2) -- mask, excludes parts of base image 6 | } 7 | UsePreconditioner(false) 8 | local x,y = W(),H() 9 | X:Exclude(neq(M(x,y),0)) 10 | reg = {} 11 | for dx,dy in Stencil { {1,0}, {-1,0}, {0,1}, {0, -1} } do 12 | local ox,oy = x+dx,y+dy 13 | local e = (X(x,y) - X(ox,oy)) - (T(x,y) - T(ox,oy)) 14 | reg[#reg+1] = Select(InBounds(ox, oy),Select(eq(M(x,y),0), e, 0),0) 15 | end 16 | r = Residuals { 17 | reg_px = reg[1], 18 | reg_nx = reg[2], 19 | reg_py = reg[3], 20 | reg_ny = reg[4] 21 | } 22 | --r.reg:compute_at_output(true) 23 | --r.reg.JtF:compute_at_output(true) -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/CUDAPatchSolverWarping.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../shared/cudaUtil.h" 5 | #include "PatchSolverWarpingState.h" 6 | #include "../../shared/SolverBase.h" 7 | 8 | class CUDAPatchSolverWarping : public SolverBase 9 | { 10 | public: 11 | CUDAPatchSolverWarping(const std::vector& dims); 12 | ~CUDAPatchSolverWarping(); 13 | 14 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iters) override; 15 | 16 | private: 17 | 18 | PatchSolverState m_solverState; 19 | std::vector m_dims; 20 | }; 21 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/CUDAWarpingSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../shared/cudaUtil.h" 6 | #include "WarpingSolverParameters.h" 7 | #include "WarpingSolverState.h" 8 | #include "../../shared/SolverBase.h" 9 | 10 | class CUDAWarpingSolver : public SolverBase 11 | { 12 | public: 13 | CUDAWarpingSolver(const std::vector& dims); 14 | ~CUDAWarpingSolver(); 15 | 16 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iters) override; 17 | 18 | private: 19 | 20 | SolverState m_solverState; 21 | std::vector m_dims; 22 | }; 23 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/EigenSolverPoissonImageEditing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../../shared/SolverBase.h" 3 | class EigenSolverPoissonImageEditing : public SolverBase { 4 | 5 | public: 6 | EigenSolverPoissonImageEditing(const std::vector& dims) : m_dims(dims) {} 7 | 8 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iters) override; 9 | 10 | private: 11 | std::vector m_dims; 12 | }; 13 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/PatchSolverWarpingParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _PATCH_SOLVER_PARAMETERS_ 4 | #define _PATCH_SOLVER_PARAMETERS_ 5 | 6 | struct PatchSolverParameters 7 | { 8 | float weightFitting; // Fitting weights 9 | float weightRegularizer; // Regularization weight 10 | 11 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 12 | unsigned int nLinearIterations; // Steps of the linear solver 13 | unsigned int nPatchIterations; // Steps on linear step on block level 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/PatchSolverWarpingState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _PATCH_SOLVER_STATE_ 4 | #define _PATCH_SOLVER_STATE_ 5 | 6 | #include 7 | 8 | struct PatchSolverInput 9 | { 10 | // Size of optimization domain 11 | unsigned int N; // Number of variables 12 | 13 | unsigned int width; // Image width 14 | unsigned int height; // Image height 15 | }; 16 | 17 | struct PatchSolverState 18 | { 19 | // State of the GN Solver 20 | float4* d_x; 21 | float4* d_target; 22 | float* d_mask; 23 | 24 | float* d_sumResidual; 25 | 26 | __host__ float getSumResidual() const { 27 | float residual; 28 | cudaMemcpy(&residual, d_sumResidual, sizeof(float), cudaMemcpyDeviceToHost); 29 | return residual; 30 | } 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/WarpingSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 9 | unsigned int nLinIterations; // Steps of the linear solver 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/WarpingSolverState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_STATE_ 4 | #define _SOLVER_STATE_ 5 | 6 | #include 7 | 8 | #ifndef MINF 9 | #ifdef __CUDACC__ 10 | #define MINF __int_as_float(0xff800000) 11 | #else 12 | #define MINF (std::numeric_limits::infinity()) 13 | #endif 14 | #endif 15 | 16 | //#define Stereo_ENABLED 17 | #define LE_THREAD_SIZE 16 18 | 19 | struct SolverInput 20 | { 21 | // Size of optimization domain 22 | unsigned int N; // Number of variables 23 | 24 | unsigned int width; // Image width 25 | unsigned int height; // Image height 26 | }; 27 | 28 | 29 | 30 | struct SolverState 31 | { 32 | // State of the GN Solver 33 | float4* d_delta; 34 | float4* d_x; 35 | float4* d_target; 36 | float* d_mask; 37 | 38 | float4* d_r; 39 | float4* d_z; 40 | float4* d_p; 41 | 42 | float4* d_Ap_X; 43 | 44 | float* d_scanAlpha; 45 | float* d_scanBeta; 46 | float* d_rDotzOld; 47 | 48 | float4* d_precondioner; 49 | 50 | float* d_sumResidual; 51 | 52 | __host__ float getSumResidual() const { 53 | float residual; 54 | cudaMemcpy(&residual, d_sumResidual, sizeof(float), cudaMemcpyDeviceToHost); 55 | return residual; 56 | } 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "resource.h" 4 | #include "mLibInclude.h" 5 | 6 | #ifndef SAFE_DELETE 7 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 8 | #endif 9 | #ifndef SAFE_DELETE_ARRAY 10 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 11 | #endif 12 | -------------------------------------------------------------------------------- /examples/poisson_image_editing/src/resource.h: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | //------------------------------------------------------------------------------ 6 | 7 | //{{NO_DEPENDENCIES}} 8 | // Microsoft Visual C++ generated include file. 9 | // Used by DepthWithColor-D3D.rc 10 | // 11 | 12 | #define IDS_APP_TITLE 103 13 | 14 | #define IDI_APP 107 15 | #define IDC_STATIC -1 16 | // Next default values for new objects 17 | // 18 | #ifdef APSTUDIO_INVOKED 19 | #ifndef APSTUDIO_READONLY_SYMBOLS 20 | 21 | #define _APS_NO_MFC 130 22 | #define _APS_NEXT_RESOURCE_VALUE 129 23 | #define _APS_NEXT_COMMAND_VALUE 32771 24 | #define _APS_NEXT_CONTROL_VALUE 1000 25 | #define _APS_NEXT_SYMED_VALUE 110 26 | #endif 27 | #endif 28 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = procrustes_alignment 2 | OBJS = build/CUDAWarpingSolver.o build/mLibSource.o build/main.o build/WarpingSolver.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | endif 12 | 13 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 14 | 15 | USES_CERES=1 16 | 17 | 18 | 19 | include ../shared/make_template.inc 20 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/procrustes_alignment.t: -------------------------------------------------------------------------------- 1 | local N,U = Dims("N","U") 2 | Inputs { 3 | Translation = Unknown(thallo_float3,{U},0), 4 | Angle = Unknown(thallo_float3,{U},1), 5 | Mesh = Array(thallo_float3,{N},2), --original position 6 | Target = Array(thallo_float3,{N},3) 7 | } 8 | UsePreconditioner(true) 9 | n,u = N(),U() 10 | local valid = greatereq(Target(n)(0), -999999.9) 11 | E_fit = Select(valid,Rotate3D(Angle(u),Mesh(n)) + Translation(u) - Target(n),0) 12 | r = Residuals { fit = E_fit } 13 | r.fit.JtJ:set_materialize(true) -------------------------------------------------------------------------------- /examples/procrustes_alignment/src/CUDAWarpingSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../shared/cudaUtil.h" 6 | #include "WarpingSolverParameters.h" 7 | #include "WarpingSolverState.h" 8 | #include "../../shared/SolverBase.h" 9 | 10 | class CUDAWarpingSolver : public SolverBase 11 | { 12 | public: 13 | CUDAWarpingSolver(unsigned int N); 14 | ~CUDAWarpingSolver(); 15 | 16 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& stats, bool profileSolve, std::vector& iter) override; 17 | 18 | private: 19 | SolverInput m_solverInput; 20 | SolverState m_solverState; 21 | unsigned int m_N; 22 | }; 23 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/src/WarpingSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 9 | unsigned int nLinIterations; // Steps of the linear solver 10 | }; 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/src/WarpingSolverUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SolverUtil.h" 4 | 5 | #include "../../shared/cudaUtil.h" 6 | 7 | #define THREADS_PER_BLOCK 512 // keep consistent with the CPU 8 | 9 | #define DR_THREAD_SIZE1_X 32 10 | #define DR_THREAD_SIZE1_Y 8 11 | 12 | __inline__ __device__ float warpReduce(float val) { 13 | int offset = 32 >> 1; 14 | while (offset > 0) { 15 | val = val + __shfl_down(val, offset, 32); 16 | offset = offset >> 1; 17 | } 18 | return val; 19 | } 20 | 21 | extern __shared__ float bucket[]; 22 | 23 | inline __device__ void scanPart1(unsigned int threadIdx, unsigned int blockIdx, unsigned int threadsPerBlock, float* d_output) 24 | { 25 | __syncthreads(); 26 | blockReduce(bucket, threadIdx, threadsPerBlock); 27 | if(threadIdx == 0) d_output[blockIdx] = bucket[0]; 28 | } 29 | 30 | inline __device__ void scanPart2(unsigned int threadIdx, unsigned int threadsPerBlock, unsigned int blocksPerGrid, float* d_tmp) 31 | { 32 | if(threadIdx < blocksPerGrid) bucket[threadIdx] = d_tmp[threadIdx]; 33 | else bucket[threadIdx] = 0.0f; 34 | 35 | __syncthreads(); 36 | blockReduce(bucket, threadIdx, threadsPerBlock); 37 | __syncthreads(); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/procrustes_alignment/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mLibInclude.h" 4 | 5 | #ifndef SAFE_DELETE 6 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 7 | #endif 8 | #ifndef SAFE_DELETE_ARRAY 9 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 10 | #endif 11 | -------------------------------------------------------------------------------- /examples/robust_nonrigid_alignment/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = robust_nonrigid_alignment 2 | OBJS = build/mLibSource.o build/main.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | endif 12 | 13 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 14 | 15 | include ../shared/make_template.inc 16 | -------------------------------------------------------------------------------- /examples/robust_nonrigid_alignment/robust_nonrigid_alignment.t: -------------------------------------------------------------------------------- 1 | local N,E = Dims("N","E") 2 | Inputs { 3 | w_fitSqrt = Param(float, 0), 4 | w_regSqrt = Param(float, 1), 5 | Offset = Unknown(thallo_float3,{N},2), 6 | Angle = Unknown(thallo_float3,{N},3), 7 | RobustWeights = Unknown(thallo_float,{N},4), 8 | UrShape = Array(thallo_float3, {N},5), --urshape: vertex.xyz 9 | Constraints = Array(thallo_float3,{N},6), --constraints 10 | ConstraintNormals = Array(thallo_float3,{N},7), 11 | v0 = Sparse({E}, {N}, 8), 12 | v1 = Sparse({E}, {N}, 9) 13 | } 14 | w_confSqrt = 0.1 15 | UsePreconditioner(true) 16 | 17 | local n = N() 18 | local e = E() 19 | 20 | local robustWeight = RobustWeights(n) 21 | --fitting 22 | local e_fit = robustWeight*ConstraintNormals(n):dot(Offset(n) - Constraints(n)) 23 | local validConstraint = greatereq(Constraints(n), -999999.9) 24 | 25 | 26 | --RobustWeight Penalty 27 | local e_conf = 1-(robustWeight*robustWeight) 28 | e_conf = Select(validConstraint, e_conf, 0.0) 29 | 30 | 31 | --regularization 32 | local ARAPCost = (Offset(v0(e)) - Offset(v1(e))) - Rotate3D(Angle(v0(e)),UrShape(v0(e)) - UrShape(v1(e))) 33 | 34 | r = Residuals { 35 | fit = w_fitSqrt*Select(validConstraint, e_fit, 0.0), 36 | conf = w_confSqrt*e_conf, 37 | reg = w_regSqrt*ARAPCost 38 | } -------------------------------------------------------------------------------- /examples/robust_nonrigid_alignment/src/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/robust_nonrigid_alignment/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | using namespace ml; 20 | -------------------------------------------------------------------------------- /examples/robust_nonrigid_alignment/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/robust_nonrigid_alignment/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mLibInclude.h" 4 | 5 | #ifndef SAFE_DELETE 6 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 7 | #endif 8 | #ifndef SAFE_DELETE_ARRAY 9 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 10 | #endif 11 | -------------------------------------------------------------------------------- /examples/shape_and_shading/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = shape_and_shading 2 | OBJS = build/mLibSource.o build/main.o build/SimpleBuffer.o build/CeresImageSolver.o 3 | 4 | 5 | UNAME := $(shell uname) 6 | ifeq ($(UNAME), Darwin) 7 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 8 | endif 9 | 10 | ifeq ($(UNAME), Linux) 11 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 12 | endif 13 | 14 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 15 | 16 | USES_CERES=1 17 | include ../shared/make_template.inc 18 | -------------------------------------------------------------------------------- /examples/shape_and_shading/src/CameraParams.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CAMERA_PARAMS_ 4 | #define _CAMERA_PARAMS_ 5 | 6 | struct CameraParams 7 | { 8 | float fx; 9 | float fy; 10 | float ux; 11 | float uy; 12 | }; 13 | 14 | #endif -------------------------------------------------------------------------------- /examples/shape_and_shading/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/shape_and_shading/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/shape_and_shading/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mLibInclude.h" 4 | 5 | #ifndef SAFE_DELETE 6 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 7 | #endif 8 | #ifndef SAFE_DELETE_ARRAY 9 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 10 | #endif 11 | -------------------------------------------------------------------------------- /examples/shape_from_shading/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = shape_from_shading 2 | OBJS = build/CUDAImageSolver.o build/mLibSource.o build/main.o build/SFSSolver.o build/SimpleBuffer.o build/CeresImageSolver.o 3 | 4 | 5 | UNAME := $(shell uname) 6 | ifeq ($(UNAME), Darwin) 7 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 8 | endif 9 | 10 | ifeq ($(UNAME), Linux) 11 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 12 | endif 13 | 14 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 15 | 16 | USES_CERES=1 17 | include ../shared/make_template.inc 18 | -------------------------------------------------------------------------------- /examples/shape_from_shading/src/CUDAImageSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../../shared/cudaUtil.h" 6 | #include "SFSSolverParameters.h" 7 | #include "SFSSolverState.h" 8 | #include "../../shared/SolverBase.h" 9 | 10 | #include 11 | #include "SimpleBuffer.h" 12 | #include "SFSSolverInput.h" 13 | class CUDAImageSolver : public SolverBase 14 | { 15 | public: 16 | CUDAImageSolver(const std::vector& dims); 17 | ~CUDAImageSolver(); 18 | 19 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iters) override; 20 | 21 | private: 22 | 23 | SolverState m_solverState; 24 | std::vector m_dims; 25 | }; 26 | -------------------------------------------------------------------------------- /examples/shape_from_shading/src/CameraParams.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _CAMERA_PARAMS_ 4 | #define _CAMERA_PARAMS_ 5 | 6 | struct CameraParams 7 | { 8 | float fx; 9 | float fy; 10 | float ux; 11 | float uy; 12 | }; 13 | 14 | #endif -------------------------------------------------------------------------------- /examples/shape_from_shading/src/SFSSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | float weightFitting; // Is initialized by the solver! 9 | 10 | float weightRegularizer; // Regularization weight 11 | float weightPrior; // Prior weight 12 | 13 | float weightShading; // Shading weight 14 | float weightShadingStart; // Starting value for incremental relaxation 15 | float weightShadingIncrement; // Update factor 16 | 17 | float weightBoundary; // Boundary weight 18 | 19 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 20 | unsigned int nLinIterations; // Steps of the linear solver 21 | // Unused for non-patch solver 22 | unsigned int nPatchIterations; // Steps on linear step on block level 23 | }; 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /examples/shape_from_shading/src/SFSSolverTerms.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef SolverTerms_h 3 | #define SolverTerms_h 4 | 5 | #define USE_MASK_REFINE 6 | 7 | #define USE_DEPTH_CONSTRAINT 1 8 | #define USE_REGULARIZATION 1 9 | #define USE_SHADING_CONSTRAINT 1 10 | #define USE_TEMPORAL_CONSTRAINT 0 11 | #define USE_PRECONDITIONER 0 12 | 13 | #define USE_PRECOMPUTE 1 14 | 15 | #define USE_PROPER_REGULARIZATION_BOUNDARY 1 16 | 17 | #endif -------------------------------------------------------------------------------- /examples/shape_from_shading/src/SimpleBuffer.h: -------------------------------------------------------------------------------- 1 | #ifndef SimpleBuffer_h 2 | #define SimpleBuffer_h 3 | #include 4 | #include 5 | class SimpleBuffer { 6 | public: 7 | enum DataType { FLOAT = 0, UCHAR = 1 }; 8 | static size_t datatypeToSize(SimpleBuffer::DataType dt) { 9 | return (dt == DataType::FLOAT) ? sizeof(float) : sizeof(unsigned char); 10 | } 11 | protected: 12 | bool m_onGPU; 13 | int m_width; 14 | int m_height; 15 | int m_channelCount; 16 | DataType m_dataType; 17 | void* m_data; 18 | 19 | public: 20 | SimpleBuffer(std::string filename, bool onGPU, bool clampInfinity = true); 21 | SimpleBuffer(const SimpleBuffer& other, bool onGPU); 22 | 23 | int width() const { 24 | return m_width; 25 | } 26 | int height() const { 27 | return m_height; 28 | } 29 | void* data() const { 30 | return m_data; 31 | } 32 | 33 | DataType type() const { 34 | return m_dataType; 35 | } 36 | 37 | void save(std::string filename) const; 38 | void savePNG(std::string filenameBase, float depthScale) const; 39 | void savePLYPoints(std::string filename) const; 40 | void savePLYMesh(std::string filename) const; 41 | ~SimpleBuffer(); 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /examples/shape_from_shading/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/shape_from_shading/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/shape_from_shading/src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "mLibInclude.h" 4 | 5 | #ifndef SAFE_DELETE 6 | #define SAFE_DELETE(p) { if (p) { delete (p); (p)=NULL; } } 7 | #endif 8 | #ifndef SAFE_DELETE_ARRAY 9 | #define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p)=NULL; } } 10 | #endif 11 | -------------------------------------------------------------------------------- /examples/shared/CombinedSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct CombinedSolverParameters { 4 | bool useCUDA = false; 5 | bool useThallo = true; 6 | bool useThalloLM = false; 7 | bool earlyOut = false; 8 | unsigned int numIter = 1; 9 | unsigned int nonLinearIter = 3; 10 | unsigned int linearIter = 200; 11 | unsigned int patchIter = 32; 12 | bool invasiveTiming = false; 13 | bool profileSolve = true; 14 | bool thalloDoublePrecision = false; 15 | int autoschedulerSetting = 1; 16 | std::string thallofile; 17 | bool thalloCPU = false; 18 | }; -------------------------------------------------------------------------------- /examples/shared/Config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef USE_CERES 3 | #define USE_CERES 1 4 | #endif 5 | -------------------------------------------------------------------------------- /examples/shared/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/shared/SolverBase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "SolverIteration.h" 3 | #include "NamedParameters.h" 4 | #include "SolverPerformanceSummary.h" 5 | 6 | class SolverBase { 7 | public: 8 | SolverBase() {} 9 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iter) { 10 | fprintf(stderr, "No solve implemented\n"); 11 | return m_finalCost; 12 | } 13 | double finalCost() const { 14 | return m_finalCost; 15 | } 16 | SolverPerformanceSummary getSummaryStatistics() const { 17 | return m_summaryStats; 18 | } 19 | protected: 20 | double m_finalCost = nan(""); 21 | SolverPerformanceSummary m_summaryStats = {}; 22 | }; -------------------------------------------------------------------------------- /examples/shared/SolverPerformanceSummary.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | // "Coincidentally" identical layout to Thallo version of this data. 3 | struct SolverPerformanceEntry { 4 | unsigned int count = 0; 5 | double minMS = 0.0; 6 | double maxMS = 0.0; 7 | double meanMS = 0.0; 8 | double stddevMS = 0.0; 9 | SolverPerformanceEntry() {} 10 | SolverPerformanceEntry(double t) :count(1), minMS(t), maxMS(t), meanMS(t), stddevMS(0.0){} 11 | }; 12 | 13 | struct SolverPerformanceSummary { 14 | // Performance Statistics for full solves 15 | SolverPerformanceEntry total; 16 | // Performance Statistics for individual nonlinear iterations, 17 | // This is broken up into three rough categories below 18 | SolverPerformanceEntry nonlinearIteration; 19 | SolverPerformanceEntry nonlinearSetup; 20 | SolverPerformanceEntry linearSolve; 21 | SolverPerformanceEntry nonlinearResolve; 22 | 23 | }; -------------------------------------------------------------------------------- /examples/shared/tclap/COPYING: -------------------------------------------------------------------------------- 1 | 2 | 3 | Copyright (c) 2003 Michael E. Smoot 4 | Copyright (c) 2004 Daniel Aarno 5 | Copyright (c) 2017 Google Inc. 6 | 7 | Permission is hereby granted, free of charge, to any person 8 | obtaining a copy of this software and associated documentation 9 | files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 22 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 23 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | 27 | 28 | -------------------------------------------------------------------------------- /examples/sparse_bundle_fusion/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = sparse_bundle_fusion 2 | EXTRA_SRC = CUDASolver 3 | OBJS = build/CUDASolver/SolverBundling.o build/CUDASolver/CUDASolverBundling.o build/mLibSource.o build/main.o 4 | SRC=../bundle_fusion_solve/src 5 | include ../shared/make_template.inc 6 | -------------------------------------------------------------------------------- /examples/sparse_bundle_fusion/bundle_fusion_solve.t: -------------------------------------------------------------------------------- 1 | local W,H,T,CorrDim = Dims("W","H","T","CorrDim") 2 | Inputs { 3 | CamTranslation = Unknown(thallo_float3,{T},0), 4 | CamRotation = Unknown(thallo_float3,{T},1), 5 | Pos_j = Array( float3, {CorrDim},2), 6 | Pos_i = Array( float3, {CorrDim},3), 7 | weightSparse = Param(float, 4), 8 | corr_i = Sparse({CorrDim}, {T}, 5), 9 | corr_j = Sparse({CorrDim}, {T}, 6) 10 | } 11 | 12 | --UsePreconditioner(true) 13 | 14 | local t = T() 15 | local transform_t = function(t) return PoseToMatrix(CamRotation(t), CamTranslation(t)) end 16 | 17 | -- Sparse Residual 18 | local c = CorrDim() 19 | local i,j = corr_i(c),corr_j(c) 20 | 21 | TI = transform_t(i) 22 | TJ = transform_t(j) 23 | 24 | TI = transform_t(t):get(i) 25 | 26 | r = rigid_trans(TI,Pos_i(c)) - rigid_trans(TJ,Pos_j(c)); 27 | res = ad.Vector(r(0), r(1), r(2)) 28 | 29 | r = Residuals { 30 | sparse = Sqrt(weightSparse)*res 31 | } 32 | 33 | corr_i:set_coherent(true) 34 | corr_j:set_coherent(true) 35 | 36 | --r.sparse.JtJ:set_materialize(true) 37 | --r.sparse.Jp:set_materialize(true) -------------------------------------------------------------------------------- /examples/spatially_varying_deconvolution/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = spatially_varying_deconvolution 2 | OBJS = build/mLibSource.o build/main.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/FreeImage/lib/osx -Wl,-rpath,../external/FreeImage/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/FreeImage/lib/linux -Wl,-rpath,../external/FreeImage/lib/linux 11 | endif 12 | 13 | LFLAGS += -lfreeimage 14 | 15 | 16 | include ../shared/make_template.inc 17 | 18 | -------------------------------------------------------------------------------- /examples/spatially_varying_deconvolution/spatially_varying_deconvolution.t: -------------------------------------------------------------------------------- 1 | W,H,Kd,Kc = Dims("W","H","Kd","Kc") 2 | Inputs { 3 | sqrt_l1 = Param(float, 0), 4 | sqrt_l2 = Param(float, 1), 5 | X = Unknown(float,{W,H},2), 6 | M = Array(float,{W,H},3), 7 | b_1 = Array(float,{W,H},4), 8 | b_2 = Array(float,{W,H},5), 9 | b_3 = Array(float,{W,H},6), 10 | K = Array(float,{Kd,Kd,Kc},7), 11 | S = Sparse({W,H},{Kc},8) 12 | } 13 | 14 | k_0=Kd() 15 | k_1=Kd() 16 | x=W() 17 | y=H() 18 | --x,y,k_0,k_1 = W(), H(), Kd(), Kd() 19 | c = S(x,y) 20 | 21 | k_half = 8 22 | kx = Sum({k_0,k_1}, K(k_0,k_1,c)*X(x-k_0+k_half, y-k_1+k_half)) 23 | 24 | Dxx = X(x, y) - X(x-1, y) 25 | Dyx = X(x, y) - X(x, y-1) 26 | 27 | E_conv = sqrt_l1 * ( (M(x,y) * kx) - b_1(x,y)) 28 | E_dx = sqrt_l2 * (Select(InBounds(x-1),Dxx,0) - b_2(x,y)) 29 | E_dy = sqrt_l2 * (Select(InBounds(y-1),Dyx,0) - b_3(x,y)) 30 | 31 | r = Residuals { 32 | conv=E_conv, 33 | dx=E_dx, 34 | dy=E_dy 35 | } 36 | 37 | r.conv.Jp:set_materialize(true) -------------------------------------------------------------------------------- /examples/spatially_varying_deconvolution/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // mLib config options 4 | // 5 | 6 | #ifdef _DEBUG 7 | #define MLIB_ERROR_CHECK 8 | #define MLIB_BOUNDS_CHECK 9 | //#define _IDL0 10 | #endif // _DEBUG 11 | 12 | // 13 | // mLib includes 14 | // 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | using namespace ml; 21 | -------------------------------------------------------------------------------- /examples/spatially_varying_deconvolution/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | #include "mLibInclude.h" 2 | 3 | #include "mLibCore.cpp" 4 | #include "mLibLodePNG.cpp" 5 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = volumetric_mesh_deformation 2 | OBJS = build/CUDAWarpingSolver.o build/WarpingSolver.o build/mLibSource.o build/main.o 3 | 4 | UNAME := $(shell uname) 5 | ifeq ($(UNAME), Darwin) 6 | LFLAGS += -L../external/OpenMesh/lib/osx -Wl,-rpath,../external/OpenMesh/lib/osx 7 | endif 8 | 9 | ifeq ($(UNAME), Linux) 10 | LFLAGS += -L../external/OpenMesh/lib/linux -Wl,-rpath,../external/OpenMesh/lib/linux 11 | endif 12 | 13 | LFLAGS += -lOpenMeshCore -lOpenMeshTools 14 | include ../shared/make_template.inc 15 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/CUDAWarpingSolver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "../../shared/cudaUtil.h" 5 | #include "WarpingSolverParameters.h" 6 | #include "WarpingSolverState.h" 7 | #include "../../shared/ThalloSolver.h" 8 | #include 9 | 10 | class CUDAWarpingSolver : public SolverBase 11 | { 12 | public: 13 | CUDAWarpingSolver(const std::vector& dims); 14 | ~CUDAWarpingSolver(); 15 | 16 | virtual double solve(const NamedParameters& solverParameters, const NamedParameters& problemParameters, SolverPerformanceSummary& perfStats, bool profileSolve, std::vector& iters) override; 17 | 18 | private: 19 | 20 | SolverState m_solverState; 21 | std::vector m_dims; 22 | }; 23 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/OpenMesh.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Includes OpenMesh 4 | #ifndef NOMINMAX 5 | #define NOMINMAX 6 | #endif 7 | #define _USE_MATH_DEFINES 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace OpenMesh; 15 | 16 | struct Traits : DefaultTraits 17 | { 18 | typedef OpenMesh::Vec3f Point; 19 | typedef OpenMesh::Vec3f Normal; 20 | typedef OpenMesh::Vec3uc Color; 21 | typedef float Scalar; 22 | 23 | VertexTraits 24 | { 25 | public: 26 | 27 | VertexT() : m_constrained(false) 28 | { 29 | } 30 | 31 | bool m_constrained; 32 | }; 33 | 34 | VertexAttributes(Attributes::Status| Attributes::Normal | Attributes::Color); 35 | FaceAttributes(Attributes::Status); 36 | EdgeAttributes(Attributes::Status); 37 | }; 38 | 39 | typedef TriMesh_ArrayKernelT SimpleMesh; 40 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/WarpingSolverParameters.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_PARAMETERS_ 4 | #define _SOLVER_PARAMETERS_ 5 | 6 | struct SolverParameters 7 | { 8 | float weightFitting; // Fitting weights 9 | float weightRegularizer; // Regularization weight 10 | 11 | unsigned int nNonLinearIterations; // Steps of the non-linear solver 12 | unsigned int nLinIterations; // Steps of the linear solver 13 | }; 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/WarpingSolverState.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SOLVER_STATE_ 4 | #define _SOLVER_STATE_ 5 | 6 | #include 7 | 8 | #ifndef MINF 9 | #ifdef __CUDACC__ 10 | #define MINF __int_as_float(0xff800000) 11 | #else 12 | #define MINF (std::numeric_limits::infinity()) 13 | #endif 14 | #endif 15 | 16 | #define LE_THREAD_SIZE 16 17 | 18 | struct SolverInput 19 | { 20 | int3 dims; 21 | unsigned int N; // Number of variables 22 | }; 23 | 24 | struct SolverState 25 | { 26 | // State of the GN Solver 27 | float3* d_delta; 28 | float3* d_deltaA; 29 | 30 | float3* d_x; 31 | float3* d_a; 32 | 33 | float3* d_target; 34 | float3* d_urshape; 35 | 36 | float3* d_r; 37 | float3* d_rA; 38 | 39 | float3* d_z; 40 | float3* d_zA; 41 | 42 | float3* d_p; 43 | float3* d_pA; 44 | 45 | float3* d_Ap_X; 46 | float3* d_Ap_A; 47 | 48 | float* d_scanAlpha; 49 | float* d_scanBeta; 50 | float* d_rDotzOld; 51 | 52 | float3* d_precondioner; 53 | float3* d_precondionerA; 54 | 55 | float* d_sumResidual; 56 | 57 | __host__ float getSumResidual() const { 58 | float residual; 59 | cudaMemcpy(&residual, d_sumResidual, sizeof(float), cudaMemcpyDeviceToHost); 60 | return residual; 61 | } 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/WarpingSolverUtil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "SolverUtil.h" 4 | 5 | #include "../../shared/cudaUtil.h" 6 | 7 | #define THREADS_PER_BLOCK 512 // keep consistent with the CPU 8 | 9 | #define DR_THREAD_SIZE1_X 32 10 | #define DR_THREAD_SIZE1_Y 8 11 | 12 | __inline__ __device__ float warpReduce(float val) { 13 | int offset = 32 >> 1; 14 | while (offset > 0) { 15 | val = val + __shfl_down(val, offset, 32); 16 | offset = offset >> 1; 17 | } 18 | return val; 19 | } 20 | 21 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/mLibInclude.h: -------------------------------------------------------------------------------- 1 | // 2 | // mLib config options 3 | // 4 | #pragma once 5 | #ifdef _DEBUG 6 | #define MLIB_ERROR_CHECK 7 | #define MLIB_BOUNDS_CHECK 8 | //#define _IDL0 9 | #endif // _DEBUG 10 | 11 | #include 12 | #include 13 | 14 | 15 | using namespace ml; 16 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/src/mLibSource.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "mLibInclude.h" 3 | 4 | #include "mLibCore.cpp" 5 | #include "mLibLodePNG.cpp" 6 | -------------------------------------------------------------------------------- /examples/volumetric_mesh_deformation/volumetric_mesh_deformation.t: -------------------------------------------------------------------------------- 1 | local W,H,D = Dims("W","H","D") 2 | Inputs { 3 | Offset = Unknown(thallo_float3,{W,H,D},0), 4 | Angle = Unknown(thallo_float3,{W,H,D},1), 5 | UrShape = Array(thallo_float3,{W,H,D},2), --original position: vertex.xyz 6 | Constraints = Array(thallo_float3,{W,H,D},3), --user constraints 7 | w_fitSqrt = Param(float, 4), 8 | w_regSqrt = Param(float, 5) 9 | } 10 | UsePreconditioner(true) 11 | local w,h,d = W(),H(),D() 12 | --fitting 13 | local e_fit = Offset(w,h,d) - Constraints(w,h,d) 14 | local valid = greatereq(Constraints(w,h,d), -999999.9) 15 | reg = {} 16 | for i,j,k in Stencil { {1,0,0}, {-1,0,0}, {0,1,0}, {0,-1,0}, {0,0,1}, {0,0,-1}} do 17 | local ow,oh,od = w+i,h+j,d+k 18 | local ARAPCost = (Offset(w,h,d) - Offset(ow,oh,od)) - Rotate3D(Angle(w,h,d),UrShape(w,h,d) - UrShape(ow,oh,od)) 19 | local ARAPCostF = Select(InBounds(w,h,d), Select(InBounds(ow,oh,od), ARAPCost, 0.0), 0.0) 20 | reg[#reg+1] = w_regSqrt*ARAPCostF 21 | end 22 | r = Residuals { 23 | fit = Select(valid,w_fitSqrt*e_fit,0), 24 | reg = reg 25 | } -------------------------------------------------------------------------------- /tests/complicated_graph_energy/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_graph 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/complicated_graph_energy/complicated.t: -------------------------------------------------------------------------------- 1 | local X,E = Dims("X", "E") 2 | Inputs { 3 | U = Unknown(float2, {X}, 0), 4 | Cor = Array(float2, {X}, 1) 5 | A = Sparse({E}, {X}, 3) 6 | B = Sparse({E}, {X}, 4) 7 | } 8 | x,e = X(), E() 9 | 10 | local C = Cor(A(e)) 11 | local UA = U(A(e)) 12 | local UB = U(B(e)) 13 | 14 | local wA = UA(0) * C(0) + C(0) 15 | local wB = UB(0) * C(1) + UB(1) 16 | 17 | r = Residuals { 18 | r0 = wA - wB 19 | r1 = U(x) * Cor(x) 20 | } 21 | -------------------------------------------------------------------------------- /tests/convolution/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = convolution 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/convolution/convolution.t: -------------------------------------------------------------------------------- 1 | N,K = Dims("N","K") 2 | Inputs { 3 | C = Unknown(float,{K},0), 4 | R = Array(float,{N},1), 5 | T = Array(float,{N}, 2) 6 | } 7 | n,k = N(),K() 8 | 9 | local result = Sum({k},R(n-k+2)*C(k)) 10 | local e_fit = T(n)-result 11 | 12 | e_fit = Select(InBoundsExpanded(n,2), e_fit, 0.0) 13 | 14 | r = Residuals {conv = e_fit} 15 | 16 | r.conv.Jp:set_materialize(true) -------------------------------------------------------------------------------- /tests/create_delete_cycle/laplacian.t: -------------------------------------------------------------------------------- 1 | W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(float,{W,H},0), 4 | A = Array(float,{W,H},1) 5 | } 6 | w_fit = .2 7 | x,y = W(), H() 8 | r = Residuals { 9 | fit = w_fit*(X(x,y) - A(x,y)), 10 | reg = { 11 | (X(x,y) - X(x+1,y)), 12 | (X(x,y) - X(x,y+1)) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/cuda_unit_tests/_unit_test_helpers.t: -------------------------------------------------------------------------------- 1 | package.terrapath = package.terrapath .. ';../../API/src/?.t' 2 | if not terralib.cudacompile then 3 | print("CUDA not enabled, not performing test...") 4 | return 5 | end 6 | local cu = require("cuda_util") 7 | local C = cu.C 8 | 9 | function cu.wrap_reduction_kernel(kernel) 10 | return terra() 11 | var N = 32 12 | var d_data : &int 13 | C.cudaMalloc([&&opaque](&d_data),sizeof(int)) 14 | C.cudaMemset(d_data,0,sizeof(int)) 15 | var launch = terralib.CUDAParams { 1,1,1, N,1,1, 0, nil } 16 | kernel(&launch,d_data) 17 | var result = -1 18 | C.cudaMemcpy(&result,d_data,sizeof(int),2) 19 | return result 20 | end 21 | end 22 | 23 | function cu.wrap_float_warp_kernel(kernel) 24 | return terra(location : int32) 25 | var N = 32 26 | var d_data : &float 27 | var size = sizeof(float)*N 28 | C.cudaMalloc([&&opaque](&d_data),size) 29 | C.cudaMemset(d_data,0,size) 30 | var launch = terralib.CUDAParams { 1,1,1, N,1,1, 0, nil } 31 | kernel(&launch,d_data) 32 | var result : float[32] 33 | for i=0,32 do result[i] = 0 end 34 | C.cudaMemcpy(&result,d_data,size,2) 35 | return result[location] 36 | end 37 | end 38 | 39 | 40 | return cu -------------------------------------------------------------------------------- /tests/cuda_unit_tests/ballot.t: -------------------------------------------------------------------------------- 1 | local cu = require("_unit_test_helpers") 2 | local terra ballot_kernel(result : &int) 3 | var t = cu.linearThreadId() 4 | t = cu.ballot([int](t)) 5 | cu.printf("%d: 0x%08x\n",cu.linearThreadId(), t) 6 | terralib.asm(terralib.types.unit,"red.global.max.u32 [$0], $1;","l,r",true,result,t) 7 | end 8 | local R = terralib.cudacompile({ ballot_kernel = ballot_kernel },true) 9 | local launcher = cu.wrap_reduction_kernel(R.ballot_kernel) 10 | local result = launcher() 11 | assert(result == -2) -------------------------------------------------------------------------------- /tests/cuda_unit_tests/get_peers.t: -------------------------------------------------------------------------------- 1 | local cu = require("_unit_test_helpers") 2 | local terra kernel(result : &int) 3 | var t = cu.linearThreadId() 4 | t = cu.get_peers([int](t) % 4) 5 | printf("%d: 0x%08x\n",cu.linearThreadId(), t) 6 | t = t and 0x000000FF 7 | terralib.asm(terralib.types.unit,"red.global.add.u32 [$0], $1;","l,r",true,result,t) 8 | end 9 | local R = terralib.cudacompile({ kernel = kernel },true) 10 | local launcher = cu.wrap_reduction_kernel(R.kernel) 11 | local result = launcher() 12 | assert(result == 255*32/4) -------------------------------------------------------------------------------- /tests/cuda_unit_tests/reduce_peers.t: -------------------------------------------------------------------------------- 1 | local cu = require("_unit_test_helpers") 2 | local terra kernel(result : &float) 3 | var t = cu.linearThreadId() 4 | var peers = cu.get_peers([int](t) % 4) 5 | printf("%d: 0x%08x\n",cu.linearThreadId(), peers) 6 | cu.reduce_peersf(result + (t%4), [float](t), peers) 7 | end 8 | local R = terralib.cudacompile({ kernel = kernel },true) 9 | local launcher = cu.wrap_float_warp_kernel(R.kernel) 10 | local results = {} 11 | for i=0,3 do results[i] = launcher(i) end 12 | for i=0,3 do 13 | print(tostring(i)..": "..tostring(results[i])) 14 | assert(results[i] == 112 + 8*i) 15 | end -------------------------------------------------------------------------------- /tests/dense/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = dense 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/dense/curveFitting.t: -------------------------------------------------------------------------------- 1 | N,U,E = Dims("N","U","E") 2 | Inputs { 3 | funcParams = Unknown(thallo_float2, {U}, 0), 4 | data = Array(thallo_float2, {N}, 1), 5 | D = Sparse({E}, {N}, 2), 6 | P = Sparse({E}, {U}, 3) 7 | } 8 | UsePreconditioner(true) 9 | 10 | local e = E() 11 | x,y = data(D(e))(0),data(D(e))(1) 12 | a,b = funcParams(P(e))(0),funcParams(P(e))(1) 13 | Residuals{ fit = y - (a*cos(b*x) + b*sin(a*x)) } 14 | -------------------------------------------------------------------------------- /tests/dense/curveFitting_dense.t: -------------------------------------------------------------------------------- 1 | N,U = Dims("N","U") 2 | Inputs { 3 | funcParams = Unknown(thallo_float2, {U}, 0), 4 | data = Image(thallo_float2, {N}, 1) 5 | } 6 | UsePreconditioner(true) 7 | 8 | local n = N() 9 | local u = U() 10 | x,y = data(n)(0),data(n)(1) 11 | a,b = funcParams(u)(0),funcParams(u)(1) 12 | Residuals{ fit = y - (a*cos(b*x) + b*sin(a*x)) } 13 | -------------------------------------------------------------------------------- /tests/dense_sparse/curveFitting_combined.t: -------------------------------------------------------------------------------- 1 | N,U,E = Dims("N","U","E") 2 | Inputs { 3 | funcParams = Unknown(thallo_float2, {U}, 0), 4 | data = Array(thallo_float2, {N}, 1), 5 | D = Sparse({E}, {N}, 2), 6 | P = Sparse({E}, {U}, 3) 7 | } 8 | UsePreconditioner(true) 9 | 10 | e,n,u = E(),N(),U() 11 | 12 | y = data(n)(1) 13 | b = funcParams(u)(1) 14 | aFun = function(id) 15 | local sqA = funcParams(id)(0) 16 | return sqrt(sqA) 17 | end 18 | local x = function(id) 19 | local sqrtX = data(id)(0) 20 | return sqrtX*sqrtX 21 | end 22 | 23 | local xx = x(n):get(n) 24 | local aa = aFun(u):get(u) 25 | --Energy( 26 | 27 | y = data(D(e))(1) 28 | b = funcParams(P(e))(1) 29 | local xx = x(D(e)) 30 | local aa = a(P(e)) 31 | 32 | Reesiduals { 33 | dense = y - (aa*cos(b*xx) + b*sin(aa*xx)), 34 | sparse = y - (aa*cos(b*xx) + b*sin(aa*xx)) 35 | } -------------------------------------------------------------------------------- /tests/energy_unit_tests/compile.t: -------------------------------------------------------------------------------- 1 | package.terrapath = package.terrapath .. ';../../API/src/?.t' 2 | local filename = arg[1] 3 | print(filename) 4 | -- _thallo_verbosity = 2 5 | _thallo_threads_per_block = 256 6 | _thallo_timing_level = 1 7 | _thallo_double_precision = false 8 | _thallo_verbosity = 2 9 | local thallo = require("thallo") 10 | thallo.dimensions = {[0] = 32,32,32,32,32,32,32,32,32} 11 | thallo.problemkind = "gauss_newton" 12 | local tbl = thallo.problemSpecFromFile(filename) 13 | local result = thallo.compilePlan(tbl,thallo.problemkind) 14 | print(result) -------------------------------------------------------------------------------- /tests/energy_unit_tests/constant_test.t: -------------------------------------------------------------------------------- 1 | N,U,E = Dims("N","U","E") 2 | Inputs { 3 | funcParams = Unknown(thallo_float2, {U}, 0), 4 | data = Array(thallo_float2, {N}, 1), 5 | D = Sparse({E}, {N}, 2), 6 | P = Sparse({E}, {U}, 3) 7 | } 8 | --UsePreconditioner(true) 9 | e,n,u = E(),N(),U() 10 | 11 | local x = function(n) return data(n)(0) end 12 | local a = function(u) return funcParams(u)(0) end 13 | 14 | x = x(D(e)) 15 | a = a(u):get(P(e)) 16 | 17 | y = data(D(e))(1) 18 | b = funcParams(P(e))(1) 19 | r = Residuals { sparse = Constant(b)*y - b*x } 20 | 21 | r.fit.JtJp:set_materialize() 22 | -------------------------------------------------------------------------------- /tests/energy_unit_tests/laplacian.t: -------------------------------------------------------------------------------- 1 | W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(float,{W,H},0), 4 | A = Array(float,{W,H},1) 5 | } 6 | w_fit = .2 7 | x,y = W(), H() 8 | r = Residuals { 9 | fit = w_fit*(X(x,y) - A(x,y)), 10 | reg = { 11 | (X(x,y) - X(x+1,y)), 12 | (X(x,y) - X(x,y+1)) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/expansive_sparse_materialize/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_sparse_materialize 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/expansive_sparse_materialize/expansive_sparse_materialize.t: -------------------------------------------------------------------------------- 1 | local N,E = Dims("N","E") 2 | Inputs { 3 | X = Unknown(float3,{N},0), 4 | A = Array(float3,{N},1), 5 | v0 = Sparse({E}, {N}, 2), 6 | v1 = Sparse({E}, {N}, 3) 7 | } 8 | local n,e = N(), E() 9 | 10 | local function weird(x) 11 | return Vector(x, x, x, x, x, x, x, x, x, x, x, x) 12 | end 13 | 14 | local weirdest = weird(sin(X(n)(0)+X(n)(1)+X(n)(2))) 15 | 16 | local val = weirdest:get(v0(e)) - weirdest:get(v1(e)) 17 | --local val = weird(X(v0(e))) - weird(X(v1(e))) 18 | local final_val = val 19 | final_val = val:get(e) 20 | r = Residuals { 21 | fit = X(n) - A(n), --fitting 22 | reg = final_val--regularization 23 | } 24 | weirdest:set_gradient_materialize(false) 25 | val:set_gradient_materialize(true) 26 | weirdest:set_materialize(true) 27 | val:set_materialize(false) -------------------------------------------------------------------------------- /tests/minimal/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal/gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/tests/minimal/gold.png -------------------------------------------------------------------------------- /tests/minimal/laplacian.t: -------------------------------------------------------------------------------- 1 | W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(float,{W,H},0), 4 | A = Array(float,{W,H},1) 5 | } 6 | w_fit = .2 7 | x,y = W(), H() 8 | r = Residuals { 9 | fit = w_fit*(X(x,y) - A(x,y)), 10 | reg = { 11 | Select(InBounds(x+1,y+1),(X(x,y) - X(x+1,y)),0), 12 | Select(InBounds(x,y+1),(X(x,y) - X(x,y+1)),0) 13 | } 14 | } 15 | 16 | r.fit.J:set_materialize(true) 17 | r.fit.JtJ:set_materialize(true) 18 | 19 | r.reg.J:set_materialize(true) 20 | r.reg.JtJ:set_materialize(true) 21 | -------------------------------------------------------------------------------- /tests/minimal_2d_graph/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_2d_graph 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal_2d_graph/laplacian.t: -------------------------------------------------------------------------------- 1 | W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(float,{W,H},0), 4 | A = Array(float,{W,H},1), 5 | Xn = Sparse({W,H},{W},2), 6 | Yn = Sparse({W,H},{H},3) 7 | } 8 | w_fit = .2 9 | x,y = W(), H() 10 | print(x) 11 | xn = Xn(x,y) 12 | yn = Yn(x,y) 13 | r = Residuals { 14 | fit = w_fit*(X(x,y) - A(x,y)), 15 | reg = { 16 | (X(x,y) - X(xn,y)), 17 | (X(x,y) - X(x,yn)) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tests/minimal_exclude/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_exclude 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal_exclude/minimal_exclude.t: -------------------------------------------------------------------------------- 1 | W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(float,{W,H},0), 4 | A = Array(float,{W,H},1) 5 | } 6 | w_fit = .2 7 | x,y = W(), H() 8 | r = Residuals { 9 | fit = w_fit*(X(x,y) - A(x,y)), 10 | reg = { 11 | (X(x,y) - X(x+1,y)), 12 | (X(x,y) - X(x,y+1)) 13 | } 14 | } -------------------------------------------------------------------------------- /tests/minimal_fitting/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_fitting 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal_fitting/minimal_fitting.t: -------------------------------------------------------------------------------- 1 | N,M = Dims("N","M") 2 | Inputs { 3 | W = Unknown(float,{M},0), 4 | S = Array(float,{N,M},1), 5 | T = Array(float,{N}, 2) 6 | } 7 | n,m = N(),M() 8 | 9 | local result = Sum({m},S(n,m)*W(m)) 10 | 11 | r = Residuals { fit = T(n)-result } 12 | r.fit.Jp:set_materialize() -------------------------------------------------------------------------------- /tests/minimal_graph/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_graph 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal_graph/gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thallolang/thallo/22cfbc4b4fb44e24b56acbeae0739e6cfe178dfd/tests/minimal_graph/gold.png -------------------------------------------------------------------------------- /tests/minimal_graph/laplacian.t: -------------------------------------------------------------------------------- 1 | local N,E = Dims("N","E") 2 | Inputs { 3 | X = Unknown(float,{N},0), 4 | A = Array(float,{N},1), 5 | v0 = Sparse({E}, {N}, 2), 6 | v1 = Sparse({E}, {N}, 3) 7 | } 8 | w_fit = .5 9 | 10 | n,e = N(), E() 11 | r = Residuals { 12 | fit = w_fit*(X(n) - A(n)), --fitting 13 | reg = X(v0(e)) - X(v1(e))--regularization 14 | } 15 | --[[ 16 | r.reg.J:set_materialize(true) 17 | r.reg.JtJ:set_materialize(true) 18 | --]] 19 | r.fit.J:set_materialize(true) 20 | r.fit.JtJ:set_materialize(true) 21 | -------------------------------------------------------------------------------- /tests/minimal_materialize/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_materialize 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal_materialize/minimal_materialize.t: -------------------------------------------------------------------------------- 1 | W,H = Dims("W","H") 2 | Inputs { 3 | X = Unknown(float,{W,H},0), 4 | A = Array(float,{W,H},1) 5 | } 6 | x,y = W(),H() 7 | 8 | v = X(x,y) - X(x+1,y) 9 | v = Select(InBounds(x+1,y), v, 0.0) 10 | local reg = v:get(x,y) 11 | --local reg = v - (X(x,y+1) - X(x+1,y+1)) 12 | 13 | r = Residuals { 14 | fit = (X(x,y) - A(x,y)), 15 | reg = reg 16 | } -------------------------------------------------------------------------------- /tests/minimal_sparse_materialize/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = minimal_sparse_materialize 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/minimal_sparse_materialize/minimal_sparse_materialize.t: -------------------------------------------------------------------------------- 1 | local N,E = Dims("N","E") 2 | Inputs { 3 | X = Unknown(float,{N},0), 4 | A = Array(float,{N},1), 5 | v0 = Sparse({E}, {N}, 2), 6 | v1 = Sparse({E}, {N}, 3) 7 | } 8 | local n,e = N(), E() 9 | 10 | local function weird(x) 11 | return sin(x) 12 | end 13 | 14 | local weirdest = weird(X(n)) 15 | 16 | local val = weirdest:get(v0(e)) - weirdest:get(v1(e)) 17 | --local val = weird(X(v0(e))) - weird(X(v1(e))) 18 | val = val:get(e) 19 | r = Residuals { 20 | fit = X(n) - A(n), --fitting 21 | reg = val--regularization 22 | } 23 | -------------------------------------------------------------------------------- /tests/multidomain/Makefile: -------------------------------------------------------------------------------- 1 | EXECUTABLE = dense 2 | OBJS = build/main.o 3 | SRC = . 4 | include ../../examples/shared/make_template.inc 5 | -------------------------------------------------------------------------------- /tests/multidomain/multidomain.t: -------------------------------------------------------------------------------- 1 | N,U = Dims("N","U") 2 | Inputs { 3 | offset = Unknown(thallo_float, {U}, 0), 4 | pts = Unknown(thallo_float, {N}, 1), 5 | target = Array(thallo_float, {N}, 2) 6 | } 7 | n,u = N(),U() 8 | x,x_0 = pts(n), target(n) 9 | Residuals{ 10 | fit = offset(u) + x - x_0, 11 | reg = x 12 | } 13 | --------------------------------------------------------------------------------