├── .gitignore ├── .mailmap ├── .travis.yml ├── LICENSE-MIT ├── LICENSE.Apache-2.0 ├── README.md ├── RELEASE_HISTORY.txt ├── TODO.todo ├── external ├── GetFullPath.m ├── Hungarian.m ├── README.md ├── affine_fit.m ├── cbrewer.m ├── cmyk2rgb.m ├── colorbrewer.mat ├── combn.m ├── cprintf.m ├── dijk.m ├── dpsimplify.m ├── exactgeodesic.m ├── exactgeodesic │ ├── create_flat_triangular_mesh.m │ ├── create_hedgehog_mesh.m │ ├── create_subdivision_pattern.m │ ├── example1.m │ ├── example2.m │ ├── example3.m │ ├── example4.m │ ├── example5.m │ ├── extract_coordinates_from_path.m │ ├── geodesic_convert_surface_points.m │ ├── geodesic_create_surface_point.m │ ├── geodesic_debug.dll │ ├── geodesic_delete.m │ ├── geodesic_distance_and_source.m │ ├── geodesic_matlab_api.h │ ├── geodesic_new_algorithm.m │ ├── geodesic_new_mesh.m │ ├── geodesic_propagate.m │ ├── geodesic_release.dll │ ├── geodesic_release.dylib │ ├── geodesic_trace_back.m │ ├── license.txt │ ├── readme.txt │ └── src │ │ ├── compileMacOSX.sh │ │ ├── example0.cpp │ │ ├── example1.cpp │ │ ├── flat_triangular_mesh.txt │ │ ├── geodesic.dylib │ │ ├── geodesic_algorithm_base.h │ │ ├── geodesic_algorithm_dijkstra.h │ │ ├── geodesic_algorithm_dijkstra_alternative.h │ │ ├── geodesic_algorithm_exact.h │ │ ├── geodesic_algorithm_exact_elements.h │ │ ├── geodesic_algorithm_graph_base.h │ │ ├── geodesic_algorithm_subdivision.h │ │ ├── geodesic_constants_and_simple_functions.h │ │ ├── geodesic_matlab_api.cpp │ │ ├── geodesic_matlab_api.h │ │ ├── geodesic_memory.h │ │ ├── geodesic_mesh.h │ │ ├── geodesic_mesh_elements.h │ │ ├── hedgehog_mesh.txt │ │ └── readme.txt ├── geodome.m ├── hex2rgb.m ├── hilbert2.m ├── hilbert3.m ├── icosahedron.m ├── inferno.m ├── interpolate_cbrewer.m ├── inv2.m ├── inv3.m ├── isocontour.m ├── lineSegmentIntersect.m ├── luq.m ├── magma.m ├── mask2poly.m ├── msm_to_hb.m ├── myaa.m ├── newquaternion.m ├── patcht.m ├── plasma.m ├── plot_brewer_cmap.m ├── preserve_history.m ├── progressbar.m ├── quaternionrotate.m ├── read_ply.m ├── rgb2cmyk.m ├── rgb2hex.m ├── saveTightFigure.m ├── spnull.m ├── spspaces.m ├── ssim.m ├── ssim_index.m ├── tabcomplete.m ├── tilefigs.m ├── timeit.m ├── toolbox_fast_marching │ ├── batch_landmarks_error.m │ ├── batch_propagation_mesh.m │ ├── batch_shape_meshing.m │ ├── callback_active_contour.m │ ├── compile_mex.m │ ├── compute_alpha_map.m │ ├── compute_bending_invariant.m │ ├── compute_distance_landmark.m │ ├── compute_eccentricity_transform.m │ ├── compute_edge_energy.m │ ├── compute_geodesic.m │ ├── compute_geodesic_mesh.m │ ├── compute_heuristic_landmark.m │ ├── compute_heuristic_multiresolution.m │ ├── compute_levelset_shape.m │ ├── compute_saddle_points.m │ ├── compute_shape_boundary.m │ ├── compute_voronoi_triangulation.m │ ├── compute_voronoi_triangulation_mesh.m │ ├── content.m │ ├── convert_distance_color.m │ ├── data │ │ ├── apple.gif │ │ ├── brain.png │ │ ├── camel.gif │ │ ├── cavern.png │ │ ├── chan-vese.jpg │ │ ├── chicken.gif │ │ ├── giraffe.gif │ │ ├── image01.tiff │ │ ├── mm.png │ │ ├── mountain.png │ │ ├── road2.png │ │ ├── room.png │ │ ├── room1.png │ │ └── stephanodiscusniagarae.jpg │ ├── display_eccentricity.m │ ├── display_segmentation.m │ ├── divgrad.m │ ├── eucdist2.dll │ ├── eucdist2.m │ ├── eucdist2.mexglx │ ├── generate_constrained_map.m │ ├── html │ │ ├── content.html │ │ ├── content.png │ │ ├── content_01.png │ │ ├── content_02.png │ │ ├── content_03.png │ │ ├── content_04.png │ │ ├── content_05.png │ │ ├── content_06.png │ │ ├── content_07.png │ │ ├── content_08.png │ │ ├── content_09.png │ │ ├── content_10.png │ │ ├── content_11.png │ │ ├── gpeyre.xsl │ │ └── style.css │ ├── license.txt │ ├── load_potential_map.m │ ├── mesh.poly │ ├── mex │ │ ├── anisotropic-fm-feth │ │ │ ├── fm.h │ │ │ ├── fm2dAniso.cpp │ │ │ ├── fm2dAniso.h │ │ │ ├── fm2dAniso.mexmaci │ │ │ └── testFM2dAniso.m │ │ ├── backup │ │ │ ├── perform_front_propagation_2d.cpp │ │ │ ├── perform_front_propagation_3d - copie.cpp │ │ │ ├── perform_front_propagation_3d_old.cpp │ │ │ └── perform_front_propagation_anisotropic.cpp │ │ ├── config.h │ │ ├── eucdist2.c │ │ ├── fheap │ │ │ ├── fib.cpp │ │ │ ├── fib.h │ │ │ ├── fibpriv.h │ │ │ ├── fibtest.c │ │ │ ├── fibtest2.c │ │ │ ├── tt.c │ │ │ └── use.c │ │ ├── gw │ │ │ ├── gw.sln │ │ │ ├── gw.suo │ │ │ ├── gw_core │ │ │ │ ├── GW_Config.cpp │ │ │ │ ├── GW_Config.h │ │ │ │ ├── GW_Face.cpp │ │ │ │ ├── GW_Face.h │ │ │ │ ├── GW_Face.inl │ │ │ │ ├── GW_FaceIterator.cpp │ │ │ │ ├── GW_FaceIterator.h │ │ │ │ ├── GW_MathsWrapper.h │ │ │ │ ├── GW_Mesh.cpp │ │ │ │ ├── GW_Mesh.h │ │ │ │ ├── GW_Mesh.inl │ │ │ │ ├── GW_PolygonIntersector.h │ │ │ │ ├── GW_ProgressBar.h │ │ │ │ ├── GW_Serializable.h │ │ │ │ ├── GW_SmartCounter.cpp │ │ │ │ ├── GW_SmartCounter.h │ │ │ │ ├── GW_SmartCounter.inl │ │ │ │ ├── GW_Vertex.cpp │ │ │ │ ├── GW_Vertex.h │ │ │ │ ├── GW_Vertex.inl │ │ │ │ ├── GW_VertexIterator.cpp │ │ │ │ ├── GW_VertexIterator.h │ │ │ │ ├── gw_core.vcproj │ │ │ │ ├── stdafx.cpp │ │ │ │ └── stdafx.h │ │ │ ├── gw_geodesic │ │ │ │ ├── GW_GeodesicFace.cpp │ │ │ │ ├── GW_GeodesicFace.h │ │ │ │ ├── GW_GeodesicFace.inl │ │ │ │ ├── GW_GeodesicMesh.cpp │ │ │ │ ├── GW_GeodesicMesh.h │ │ │ │ ├── GW_GeodesicMesh.inl │ │ │ │ ├── GW_GeodesicPath.cpp │ │ │ │ ├── GW_GeodesicPath.h │ │ │ │ ├── GW_GeodesicPath.inl │ │ │ │ ├── GW_GeodesicPoint.cpp │ │ │ │ ├── GW_GeodesicPoint.h │ │ │ │ ├── GW_GeodesicPoint.inl │ │ │ │ ├── GW_GeodesicVertex.cpp │ │ │ │ ├── GW_GeodesicVertex.h │ │ │ │ ├── GW_GeodesicVertex.inl │ │ │ │ ├── GW_GeometryAtlas.cpp │ │ │ │ ├── GW_GeometryAtlas.h │ │ │ │ ├── GW_GeometryAtlas.inl │ │ │ │ ├── GW_GeometryCell.cpp │ │ │ │ ├── GW_GeometryCell.h │ │ │ │ ├── GW_GeometryCell.inl │ │ │ │ ├── GW_Parameterization.cpp │ │ │ │ ├── GW_Parameterization.h │ │ │ │ ├── GW_Parameterization.inl │ │ │ │ ├── GW_TriangularInterpolation.cpp │ │ │ │ ├── GW_TriangularInterpolation.h │ │ │ │ ├── GW_TriangularInterpolation.inl │ │ │ │ ├── GW_TriangularInterpolation_ABC.h │ │ │ │ ├── GW_TriangularInterpolation_Cubic.cpp │ │ │ │ ├── GW_TriangularInterpolation_Cubic.h │ │ │ │ ├── GW_TriangularInterpolation_Cubic.inl │ │ │ │ ├── GW_TriangularInterpolation_Linear.cpp │ │ │ │ ├── GW_TriangularInterpolation_Linear.h │ │ │ │ ├── GW_TriangularInterpolation_Linear.inl │ │ │ │ ├── GW_TriangularInterpolation_Quadratic.cpp │ │ │ │ ├── GW_TriangularInterpolation_Quadratic.h │ │ │ │ ├── GW_TriangularInterpolation_Quadratic.inl │ │ │ │ ├── GW_VoronoiMesh.cpp │ │ │ │ ├── GW_VoronoiMesh.h │ │ │ │ ├── GW_VoronoiMesh.inl │ │ │ │ ├── GW_VoronoiVertex.cpp │ │ │ │ ├── GW_VoronoiVertex.h │ │ │ │ ├── GW_VoronoiVertex.inl │ │ │ │ ├── gw_geodesic.vcproj │ │ │ │ ├── stdafx.cpp │ │ │ │ └── stdafx.h │ │ │ ├── gw_maths │ │ │ │ ├── GW_Maths.h │ │ │ │ ├── GW_MathsConfig.h │ │ │ │ ├── GW_Matrix2x2.h │ │ │ │ ├── GW_Matrix3x3.h │ │ │ │ ├── GW_Matrix4x4.h │ │ │ │ ├── GW_MatrixNxP.h │ │ │ │ ├── GW_MatrixStatic.h │ │ │ │ ├── GW_Quaternion.h │ │ │ │ ├── GW_SparseMatrix.h │ │ │ │ ├── GW_Vector2D.h │ │ │ │ ├── GW_Vector3D.h │ │ │ │ ├── GW_Vector4D.h │ │ │ │ ├── GW_VectorND.h │ │ │ │ ├── GW_VectorStatic.h │ │ │ │ ├── gw_complex.h │ │ │ │ ├── test │ │ │ │ │ ├── main.cpp │ │ │ │ │ └── test.vcproj │ │ │ │ └── tnt │ │ │ │ │ ├── jama_cholesky.h │ │ │ │ │ ├── jama_eig.h │ │ │ │ │ ├── jama_lu.h │ │ │ │ │ ├── jama_qr.h │ │ │ │ │ ├── jama_svd.h │ │ │ │ │ ├── tnt.h │ │ │ │ │ ├── tnt_array1d.h │ │ │ │ │ ├── tnt_array1d_utils.h │ │ │ │ │ ├── tnt_array2d.h │ │ │ │ │ ├── tnt_array2d_utils.h │ │ │ │ │ ├── tnt_array3d.h │ │ │ │ │ ├── tnt_array3d_utils.h │ │ │ │ │ ├── tnt_cmat.h │ │ │ │ │ ├── tnt_fortran_array1d.h │ │ │ │ │ ├── tnt_fortran_array1d_utils.h │ │ │ │ │ ├── tnt_fortran_array2d.h │ │ │ │ │ ├── tnt_fortran_array2d_utils.h │ │ │ │ │ ├── tnt_fortran_array3d.h │ │ │ │ │ ├── tnt_fortran_array3d_utils.h │ │ │ │ │ ├── tnt_math_utils.h │ │ │ │ │ ├── tnt_sparse_matrix_csr.h │ │ │ │ │ ├── tnt_stopwatch.h │ │ │ │ │ ├── tnt_subscript.h │ │ │ │ │ ├── tnt_vec.h │ │ │ │ │ └── tnt_version.h │ │ │ └── gw_toolkit │ │ │ │ ├── GW_ASELoader.cpp │ │ │ │ ├── GW_ASELoader.h │ │ │ │ ├── GW_BasicDisplayer.cpp │ │ │ │ ├── GW_BasicDisplayer.h │ │ │ │ ├── GW_BasicDisplayer.inl │ │ │ │ ├── GW_CSVLoader.h │ │ │ │ ├── GW_GeodesicDisplayer.cpp │ │ │ │ ├── GW_GeodesicDisplayer.h │ │ │ │ ├── GW_GeodesicDisplayer.inl │ │ │ │ ├── GW_InputOutput.cpp │ │ │ │ ├── GW_InputOutput.h │ │ │ │ ├── GW_OBJLoader.cpp │ │ │ │ ├── GW_OBJLoader.h │ │ │ │ ├── GW_OFFLoader.cpp │ │ │ │ ├── GW_OFFLoader.h │ │ │ │ ├── GW_OpenGLHelper.h │ │ │ │ ├── GW_PLYLoader.cpp │ │ │ │ ├── GW_PLYLoader.h │ │ │ │ ├── GW_Toolkit.cpp │ │ │ │ ├── GW_Toolkit.h │ │ │ │ ├── GW_VRMLLoader.cpp │ │ │ │ ├── GW_VRMLLoader.h │ │ │ │ ├── gw_toolkit.vcproj │ │ │ │ ├── ply │ │ │ │ ├── ply.c │ │ │ │ ├── ply.h │ │ │ │ ├── ply_docs │ │ │ │ ├── plyfile.cpp │ │ │ │ └── plytest.c │ │ │ │ ├── stdafx.cpp │ │ │ │ ├── stdafx.h │ │ │ │ ├── trackball.cpp │ │ │ │ └── trackball.h │ │ ├── perform_circular_front_propagation_2d.cpp │ │ ├── perform_circular_front_propagation_2d.def │ │ ├── perform_circular_front_propagation_2d.vcproj │ │ ├── perform_front_propagation.sln │ │ ├── perform_front_propagation_2d.cpp │ │ ├── perform_front_propagation_2d.def │ │ ├── perform_front_propagation_2d.h │ │ ├── perform_front_propagation_2d.vcproj │ │ ├── perform_front_propagation_2d_mex.cpp │ │ ├── perform_front_propagation_3d.cpp │ │ ├── perform_front_propagation_3d.def │ │ ├── perform_front_propagation_3d.h │ │ ├── perform_front_propagation_3d.vcproj │ │ ├── perform_front_propagation_3d_mex.cpp │ │ ├── perform_front_propagation_anisotropic.cpp │ │ ├── perform_front_propagation_mesh.cpp │ │ ├── perform_front_propagation_mesh.def │ │ ├── perform_front_propagation_mesh.vcproj │ │ └── skeleton.cpp │ ├── perform_active_contour.m │ ├── perform_circular_fast_marching_2d.m │ ├── perform_farthest_landmark_sampling.m │ ├── perform_farthest_point_sampling.m │ ├── perform_farthest_point_sampling_boundary.m │ ├── perform_farthest_point_sampling_mesh.m │ ├── perform_fast_marching.m │ ├── perform_fast_marching_mesh.m │ ├── perform_fast_marching_old.m │ ├── perform_fmstar_2d.m │ ├── perform_fmstar_3d.m │ ├── perform_front_propagation_2d.m │ ├── perform_front_propagation_2d_slow.m │ ├── perform_geodesic_interpolation.m │ ├── perform_lloyd_mesh.m │ ├── perform_redistancing.m │ ├── pick_curves.m │ ├── pick_start_end_point.m │ ├── plot_constrained_path_planing.m │ ├── plot_fast_marching_2d.m │ ├── plot_fast_marching_3d.m │ ├── plot_fast_marching_mesh.m │ ├── plot_volumetric_data.m │ ├── publish_html.m │ ├── readme │ ├── skeleton.dll │ ├── tests │ │ ├── test_active_contour.m │ │ ├── test_anisotropic.m │ │ ├── test_anisotropic_feth.m │ │ ├── test_anisotropic_fm.m │ │ ├── test_anisotropic_fm_old.m │ │ ├── test_bending_invariants.m │ │ ├── test_bug.m │ │ ├── test_circular.m │ │ ├── test_circular_fast_marching_2d.m │ │ ├── test_circular_prior.m │ │ ├── test_constrained_map.m │ │ ├── test_distance_approximation.m │ │ ├── test_distance_compression.m │ │ ├── test_eccentricity.m │ │ ├── test_eucldist.m │ │ ├── test_farthest_sampling_2d.m │ │ ├── test_farthest_sampling_3d.m │ │ ├── test_farthest_sampling_mesh.m │ │ ├── test_farthest_sampling_shape.m │ │ ├── test_fast_marching_2d.m │ │ ├── test_fast_marching_3d.m │ │ ├── test_fmstar_2d.m │ │ ├── test_fmstar_3d.m │ │ ├── test_fmstar_error.m │ │ ├── test_fmstar_landmark.m │ │ ├── test_fmstar_path_planing.m │ │ ├── test_fmstar_weight_2d.m │ │ ├── test_geodesic_interpolation.m │ │ ├── test_geodesic_vs_euclidean.m │ │ ├── test_heuristic_mesh.m │ │ ├── test_influence.m │ │ ├── test_landmark.m │ │ ├── test_landmark_error.m │ │ ├── test_multiple_paths_2d.m │ │ ├── test_multiple_paths_3d.m │ │ ├── test_path_planing.m │ │ ├── test_propagation_2d.m │ │ ├── test_propagation_mesh.m │ │ ├── test_propagation_shape.m │ │ ├── test_redistancing.m │ │ ├── test_segmentation.m │ │ ├── test_skeleton.m │ │ ├── test_vol3d.m │ │ ├── test_voronoi_segmentation.m │ │ └── test_voronoi_triangulation.m │ ├── toolbox │ │ ├── check_face_vertex.m │ │ ├── clamp.m │ │ ├── compute_cuvilinear_abscice.m │ │ ├── compute_distance_to_points.m │ │ ├── compute_edge_face_ring.m │ │ ├── compute_edges.m │ │ ├── compute_gaussian_filter.m │ │ ├── compute_grad.m │ │ ├── compute_vertex_ring.m │ │ ├── crop.m │ │ ├── getoptions.m │ │ ├── imageplot.m │ │ ├── load_image.m │ │ ├── mmax.m │ │ ├── nb_dims.m │ │ ├── num2string_fixeddigit.m │ │ ├── perform_blurring.m │ │ ├── perform_conjugate_gradient.m │ │ ├── perform_contour_extraction.m │ │ ├── perform_convolution.m │ │ ├── perform_curve_extraction.m │ │ ├── perform_curve_resampling.m │ │ ├── perform_histogram_equalization.m │ │ ├── perform_image_resize.m │ │ ├── perform_tensor_recomp.m │ │ ├── perform_vf_normalization.m │ │ ├── plot_mesh.m │ │ ├── prod_vf_sf.m │ │ ├── progressbar.m │ │ ├── read_mesh.m │ │ ├── read_off.m │ │ ├── rescale.m │ │ └── triangulation2adjacency.m │ ├── toolbox_fast_marching.m │ └── vol3d.m ├── viridis.m ├── vrml.m └── write_ply.m ├── gptoolbox-logo.pdf ├── imageprocessing ├── denoise.m ├── depth_darken.m ├── dith.m ├── get_scribbles.m ├── get_spray_painting.m ├── gp_bwboundaries.m ├── gp_bwlabel.m ├── gray2rgb.m ├── gray_bars.m ├── hatch.m ├── image_laplacian.m ├── imclose_sphere.m ├── imcurves.m ├── imdarken.m ├── imdir.m ├── imgrid.m ├── iminpaint.m ├── imtrim.m ├── imupsample.m ├── imwrite_gif.m ├── levin.m ├── lin2oklab.m ├── lischinski.m ├── median_filter.m ├── oklab2lin.m ├── oklab2rgb.m ├── okloop.m ├── over.m ├── packpng.m ├── photoshop_imresize.m ├── photoshop_imshow.m ├── randdither.m ├── random_color.m ├── rgb2oklab.m ├── roifillpyramid.m ├── sliding_comparison.m ├── text_to_image.m ├── unique_images.m ├── unpackpng.m ├── vhs.m └── writeGIF.m ├── images ├── baboon.jpg ├── david.png ├── dorgan-brothers.jpg ├── gorilla-yawning-fake-depth.jpg ├── gorilla-yawning.png ├── gorilla-yawning.psd ├── gptoolbox-bounce.gif ├── half-black-half-white-square.png ├── hans-hass.jpg ├── imdata.m ├── max-schmeling-landscape.png ├── max-schmeling.jpg ├── nuclear-blast-observers.png ├── nuclear-blast.png └── otto-freundlich.jpg ├── matrix ├── LBFGS.m ├── admm.m ├── affine_null_space.m ├── backtracking_line_search.m ├── bin_packing.m ├── copysign.m ├── cs_jacobian.m ├── cspy.m ├── debug_sparse.m ├── default_mosek_param.m ├── default_quadprog_param.m ├── diag_blk_inv.m ├── eigen_format.m ├── fd_jacobian.m ├── full_sparse.m ├── functionSignatures.json ├── graph_coloring.m ├── interleave_rows.m ├── kroneye.m ├── l12_min.m ├── lexmin.m ├── line_search.m ├── linsolve_with_fixed.m ├── lu_lagrange.m ├── matrixnormalize.m ├── maxnz.m ├── merl_quadprog.m ├── min_quad_with_fixed.m ├── min_quad_with_fixed_active_set.m ├── minnz.m ├── nmultichoosek.m ├── normalizerow.m ├── normrow.m ├── pagepinv.m ├── pso.m ├── quadprog_box.m ├── rand_rotation.m ├── randcycle.m ├── readDMAT.m ├── repdiag.m ├── repdiag_matrix.m ├── sample_discrete.m ├── schur_complement.m ├── sparse_eigs.m ├── spinv.m └── writeDMAT.m ├── mesh ├── TriScatteredInterpVector.m ├── add_isolines.m ├── add_lights.m ├── add_shadow.m ├── adjacency_dihedral_angle_matrix.m ├── adjacency_edge_cost_matrix.m ├── adjacency_incident_angle_matrix.m ├── adjacency_list.m ├── adjacency_matrix.m ├── all_pairs_distances.m ├── alpha_complex.m ├── animated_tetramesh.m ├── animated_trisurf.m ├── annulus.m ├── apply_ambient_occlusion.m ├── apply_matcap.m ├── apply_texture_map.m ├── arap.m ├── arap_dof.m ├── arap_energy.m ├── arap_gradient.m ├── arap_hessian.m ├── arap_linear_block.m ├── arap_rhs.m ├── arc_to_cubics.m ├── avgedge.m ├── axisangle2matrix.m ├── axisangle2quat.m ├── axisanglebetween.m ├── bad_quad_mesh_from_quadtree.m ├── bake_onto_vertices.m ├── barycenter.m ├── barycentric_coordinates.m ├── beach_ball.m ├── bernstein_eval.m ├── betti.m ├── bfs_orient.m ├── biharmonic_bounded.m ├── biharmonic_coordinates.m ├── biharmonic_distance.m ├── biharmonic_embedding.m ├── bone_forest.m ├── bone_heat.m ├── bone_offsets.m ├── bone_parents.m ├── bone_visible.m ├── boundary_conditions.m ├── boundary_faces.m ├── bounding_box.m ├── box_each_element.m ├── box_height_field.m ├── buckliball.m ├── bwmesh.m ├── bwstencil.m ├── cage2tet.m ├── capsule.m ├── catOBJs.m ├── cat_meshes.m ├── catmull_clark.m ├── catmull_rom_eval.m ├── cdt.m ├── centroid.m ├── circular_arc_to_cubics.m ├── circumradius.m ├── clean_dir.m ├── clean_mesh.m ├── clean_tetgen_mesh.m ├── closing.m ├── collapse_close_points.m ├── combine.m ├── composite_harmonic_mapping.m ├── composite_mvc.m ├── conformalized_mean_curvature_flow.m ├── conic.m ├── conncomp.m ├── connectedComponent.m ├── connectedComponentV.m ├── connected_components.m ├── conservative_edge_matching.m ├── contour_edges.m ├── convexness.m ├── cookie_cutter.m ├── coordinate_constraint.m ├── cotangent.m ├── cotmatrix.m ├── cotmatrix3.m ├── cotmatrix_embedded.m ├── cotmatrix_intrinsic.m ├── covariance_scatter_matrix.m ├── create_irregular_grid.m ├── create_irregular_grid_with_min_angle.m ├── create_regular_grid.m ├── crouzeix_raviart_cotmatrix.m ├── crouzeix_raviart_grad.m ├── crouzeix_raviart_massmatrix.m ├── crust.m ├── cube.m ├── cubic_arc_length.m ├── cubic_cubic_integrated_distance.m ├── cubic_cubic_intersect.m ├── cubic_eval.m ├── cubic_flat_eval.m ├── cubic_is_flat.m ├── cubic_roots.m ├── cubic_simplify.m ├── cubic_split.m ├── cubic_subdivide.m ├── cubic_tangent.m ├── cubic_uniformly_sample.m ├── cubic_vertex_removal.m ├── cubic_winding_number.m ├── curvature.m ├── curve_smooth.m ├── cut_edges.m ├── cylinder_mesh.m ├── deform.m ├── deform_skeleton.m ├── delaunay_neighbors.m ├── delaunayize.m ├── delta_mush.m ├── df_build.m ├── df_build_fast.m ├── df_query.m ├── dihedral_angles.m ├── dijkstra_shepard.m ├── dirac_eigs.m ├── dirac_operator.m ├── discrete_curvatures.m ├── discrete_gaussian_curvature.m ├── discrete_mean_curvature.m ├── distribute_on_ground.m ├── div.m ├── div3.m ├── div_intrinsic.m ├── divmatrix.m ├── doublearea.m ├── doublearea_intrinsic.m ├── draw_boxes.m ├── dual.m ├── dual_subdivide.m ├── dualquatlbs.m ├── eat_comments.m ├── edge_cylinders.m ├── edge_flaps.m ├── edge_lengths.m ├── edge_triangle_adjacency.m ├── edges.m ├── edges_to_path.m ├── ellipse_to_spline.m ├── emboss.m ├── encage.m ├── engraving.m ├── equilateral_tiling.m ├── expand_axis.m ├── explode_tetramesh.m ├── exterior_edges.m ├── exterior_skinning_modes.m ├── extrude.m ├── faces_first.m ├── faces_in_polygon.m ├── facet_adjacency_matrix.m ├── facet_laplacian.m ├── falpha.m ├── false_barycentric.m ├── farthest_points.m ├── fast_mass_springs.m ├── fd_bilinear_coefficients.m ├── fd_grad.m ├── fd_laplacian.m ├── fd_plot_stencil.m ├── fd_trilinear_coefficients.m ├── fibonacci_sphere_sampling.m ├── fill_holes.m ├── find_ears.m ├── fit_rigid.m ├── fit_rotation.m ├── fit_rotations.m ├── fixNEIGH.m ├── flatten_splines.m ├── flip_ears.m ├── flip_edges.m ├── flipped_tet_orders.m ├── forward_kinematics.m ├── fphong.m ├── fsoft.m ├── functionSignatures.json ├── gauss_legendre_quadrature.m ├── gauss_map.m ├── geomedian.m ├── get_control_points.m ├── get_pencil_curve.m ├── get_pencil_curves.m ├── getlayers.m ├── getlayershe.m ├── glue_reverse.m ├── grad.m ├── grad3.m ├── grad_intrinsic.m ├── green_coordinates.m ├── group_sum_matrix.m ├── half_space_intersect.m ├── harmonic.m ├── hausdorff.m ├── hcp_lattice.m ├── hds.m ├── heat_geodesic.m ├── heat_map.m ├── hessian_squared.m ├── hks.m ├── icp_legacy.m ├── image_mesh.m ├── in_element.m ├── in_elements.m ├── in_mesh.m ├── in_quadtree.m ├── incenter.m ├── inequality_constraints_from_graphs.m ├── inertia_tensor.m ├── inflate.m ├── initialize_quadtree.m ├── input_medit.m ├── internalangles.m ├── internalangles_intrinsic.m ├── intrinsic_delaunay_cotmatrix.m ├── is_acute.m ├── is_boundary_facet.m ├── is_delaunay.m ├── is_extrinsic_delaunay.m ├── is_intrinsic_delaunay.m ├── is_planar.m ├── is_self_intersecting.m ├── is_vertex_nonmanifold.m ├── isolines_map.m ├── isometric_curve_flow.m ├── iterative_laplacian_mesh_editing.m ├── joints.m ├── kharmonic.m ├── laplacian_editing_system.m ├── laplacian_mesh_editing.m ├── laplacian_smooth.m ├── lapsmoothF.m ├── lazy_cage.m ├── lbs.m ├── lbs_matrix.m ├── limit_faces.m ├── linear_elasticity.m ├── linear_elasticity_stiffness.m ├── linear_sweep.m ├── lloyd_sphere.m ├── load_mesh.m ├── local_max.m ├── local_min.m ├── loop.m ├── loop_exact_eval.m ├── lscm.m ├── manifold_patches.m ├── mark_extrema.m ├── massmatrix.m ├── massmatrix3.m ├── massmatrix_embedded.m ├── massmatrix_intrinsic.m ├── material_boundary_facets.m ├── mean_value_laplacian.m ├── mesh_boolean_winding_number.m ├── metropolis_hastings.m ├── minimal_bounding_sphere.m ├── minimal_bounding_sphere_welzl.m ├── minkowski_sum.m ├── moebius_strip.m ├── monotonic_biharmonic.m ├── monotonicity_matrix.m ├── moveEV.m ├── moveFV.m ├── moveVF.m ├── murali_funkhouser.m ├── mvc.m ├── natural_neighbor.m ├── near_mesh.m ├── neumannmatrix.m ├── nonmanifold_edges.m ├── normal_derivative.m ├── normals.m ├── octahedron.m ├── offset_curve.m ├── oloid.m ├── on_boundary.m ├── orbifold.m ├── ordered_outline.m ├── orient_outward.m ├── orthocenter.m ├── outline.m ├── outline_loop.m ├── parse_path.m ├── parse_svg_transform.m ├── partition.m ├── per_corner_normals.m ├── per_edge_normals.m ├── per_vertex_frames.m ├── per_vertex_normals.m ├── perform_edge_collapse.m ├── planar_patches.m ├── planarize.m ├── plane_project.m ├── plot_cubic.m ├── plot_directed_edges.m ├── plot_edges.m ├── plot_spline.m ├── plot_taper.m ├── plt.m ├── png2mesh.m ├── png2objandtga.m ├── png2poly.m ├── point_cubic_squared_distance.m ├── point_inside_polygon.m ├── point_spline_signed_distance.m ├── point_spline_squared_distance.m ├── point_visible.m ├── poly2VEH.m ├── poly2mesh.m ├── poly_to_spline.m ├── polygonize.m ├── polygons_to_triangles.m ├── prebiharmonic.m ├── project_point_to_line_segment.m ├── project_to_lines.m ├── prolongation.m ├── pseudoedge_dof.m ├── quad_facet_adjacency_matrix.m ├── quad_upsample.m ├── quadratic_eval.m ├── quadratic_to_cubic.m ├── quadrature_points.m ├── quadtree_gradient.m ├── quadtree_laplacian.m ├── quat2mat.m ├── quatbetween.m ├── quatslerp.m ├── quattrans2udq.m ├── qvr.m ├── randball.m ├── random_lines.m ├── random_points_on_mesh.m ├── randsphere.m ├── rasterize.m ├── ray_polygon_intersect.m ├── read3DS.m ├── readAdobeMSH.m ├── readBDL.m ├── readBF.m ├── readEDGE.m ├── readELE.m ├── readFACE.m ├── readIPI.m ├── readLOG.m ├── readMESH.m ├── readNEIGH.m ├── readNODE.m ├── readOBJ.m ├── readOBJ_sequence.m ├── readOBJfast.m ├── readOFF.m ├── readPLY.m ├── readPOLY_pyramid.m ├── readPOLY_triangle.m ├── readSDF.m ├── readSEL.m ├── readSTL.m ├── readSVG.m ├── readSVG_cubics.m ├── readSVOX.m ├── readTET.m ├── readTGF.m ├── readVOX.m ├── readWRL.m ├── region_boundary_conditions.m ├── regular_tetrahedral_mesh.m ├── relative_coordinates.m ├── relative_dirac_operator.m ├── remesh_at_handles.m ├── remesh_at_points.m ├── remesh_level_set.m ├── remesh_max.m ├── remesh_planar_patches.m ├── remove_degenerate_faces.m ├── remove_duplicate_simplices.m ├── remove_duplicate_vertices.m ├── remove_small_components.m ├── remove_unreferenced.m ├── repmesh.m ├── resample_polygon.m ├── rest_on_ground.m ├── retarget.m ├── reuleaux_triangle.m ├── revolve.m ├── rhombicosidodecahedron.m ├── rodrigues.m ├── rotate_about.m ├── sample_edges.m ├── sample_interior.m ├── schwarz_lantern.m ├── screw.m ├── sct.m ├── segment_segment_squared_distance.m ├── select_region.m ├── self_collision_barrier.m ├── self_collision_barrier_cap_sym.m ├── self_collision_barrier_line_sym.m ├── shader.m ├── sharp_edges.m ├── shell.m ├── shepard.m ├── showvoronoi.m ├── signed_distance_direction.m ├── simplify_complex.m ├── skeleton_extraction.m ├── skinning_transformations.m ├── slerp.m ├── slice_isolines.m ├── slice_tets.m ├── slice_triangles.m ├── smith_and_schaefer.m ├── snap_points.m ├── snap_points_to_close_edges.m ├── snf.m ├── solid.m ├── solid_angle.m ├── spherical_subdivision.m ├── sphericon.m ├── spiral_mesh.m ├── spline_G1_subspace.m ├── spline_arc_lengths.m ├── spline_area.m ├── spline_cage.m ├── spline_spline_chamfer.m ├── spline_to_poly.m ├── spline_uniformly_sample.m ├── spline_upsample.m ├── spline_winding_number.m ├── split_backfacing.m ├── split_edges.m ├── sqrt3.m ├── stable_camva.m ├── stacktimes.m ├── stadium.m ├── stam_order.m ├── statistics.m ├── stiff_points_lbs.m ├── stretch_bones_lbs.m ├── stvk_modal_derivatives.m ├── subdivided_sphere.m ├── super_fibonacci.m ├── surf_to_mesh.m ├── surface_graph.m ├── symmetric_dirichlet.m ├── symmetric_dirichlet_sym.m ├── takeo_arap.m ├── takeo_asap.m ├── tangent_to_object_normal_map.m ├── text_to_mesh.m ├── texture_coords.m ├── torus.m ├── total_signed_curvature.m ├── total_signed_occurrences.m ├── tri2tet.m ├── tri2tgf.m ├── triangle_strip.m ├── triangle_triangle_adjacency.m ├── triangles_from_edges.m ├── triangles_from_strip.m ├── triangulate_curves.m ├── triangulate_interior.m ├── triangulate_poly_pyramid.m ├── tricontour.m ├── triinterp.m ├── trim_with_spline.m ├── tsurf.m ├── tsurf_cad.m ├── tt.m ├── tube.m ├── tutte.m ├── txt.m ├── udq2quattrans.m ├── unbake_normal_map.m ├── uniformly_sample.m ├── uniformly_sample_edges.m ├── uninterp.m ├── union2tet.m ├── untangle.m ├── unzip_corners.m ├── upsample.m ├── vector_area_matrix.m ├── vertex_triangle_adjacency.m ├── volume.m ├── volume_intrinsic.m ├── voronoi_tetgen.m ├── voxel_grid.m ├── voxel_surface.m ├── voxelize.m ├── vtxpolyfit.m ├── vv.m ├── wachspress_laplacian.m ├── wedding_cake.m ├── winding_number_clean.m ├── wireframe.m ├── wks.m ├── write3DS.m ├── writeBB.m ├── writeBDL.m ├── writeBF.m ├── writeDAE.m ├── writeELE.m ├── writeGLTF.m ├── writeMDD.m ├── writeMESH.m ├── writeMSH.m ├── writeNODE.m ├── writeOBJ.m ├── writeOFF.m ├── writePLY.m ├── writePOLY_pyramid.m ├── writePOLY_tetgen.m ├── writePOLY_triangle.m ├── writeSEL.m ├── writeSMF.m ├── writeSTL.m ├── writeSVG.m ├── writeSVG_cubics.m ├── writeTGF.m ├── writeWIRE.m ├── write_tsurf_to_gltf.m └── write_tsurf_to_obj_and_png.m ├── mex ├── CGAL_typedefs.h ├── CMakeLists.txt ├── README.md ├── aabb.cpp ├── ambient_occlusion.cpp ├── ambient_occlusion.m ├── angle_derivatives.cpp ├── blue_noise.cpp ├── blue_noise.m ├── bone_visible.cpp ├── bone_visible_embree.cpp ├── box_intersect.cpp ├── box_intersect.m ├── box_up.h ├── cmake │ ├── DownloadProject.CMakeLists.cmake.in │ ├── FindELTOPO.cmake │ ├── FindMATLAB.cmake │ └── libigl.cmake ├── collapse_small_triangles.cpp ├── collapse_small_triangles.m ├── decimate_libigl.cpp ├── decimate_libigl.m ├── dual_laplacian.cpp ├── dual_laplacian.m ├── eltopo.cpp ├── eltopo.m ├── exact_geodesic.cpp ├── exact_geodesic.m ├── example.cpp ├── fast_sparse.cpp ├── fast_sparse.m ├── fit_cubic_bezier.cpp ├── fit_cubic_bezier.m ├── fit_rotations_mex.cpp ├── fit_rotations_mex.m ├── form_factor.cpp ├── form_factor.m ├── functionSignatures.json ├── gptoolbox_mexopts.m ├── icp.cpp ├── impaste.cpp ├── impaste.m ├── in_element_aabb.cpp ├── in_element_aabb.m ├── intersect_other.cpp ├── intersect_other.m ├── isolines.cpp ├── isolines.m ├── mesh_boolean.cpp ├── mesh_boolean.m ├── outer_hull.cpp ├── outer_hull.m ├── paste.h ├── paste.mm ├── point_mesh_squared_distance.cpp ├── point_mesh_squared_distance.m ├── principal_curvature.cpp ├── principal_curvature.m ├── psd_project_rows.cpp ├── psd_project_rows.m ├── ray_mesh_intersect.cpp ├── ray_mesh_intersect.h ├── ray_mesh_intersect.m ├── readMSH.cpp ├── readMSH.m ├── read_mesh_from_xml.cpp ├── read_mesh_from_xml.m ├── read_triangle_mesh.cpp ├── refine_triangulation.cpp ├── reorient_facets.cpp ├── reorient_facets.m ├── segment_graph.cpp ├── segment_graph.m ├── segment_list.h ├── segment_segment_intersection.cpp ├── selfintersect.cpp ├── selfintersect.m ├── signed_distance.cpp ├── signed_distance.m ├── signed_distance_isosurface.cpp ├── signed_distance_isosurface.m ├── simplify_polyhedron.cpp ├── slim.cpp ├── slim.m ├── snap_rounding.cpp ├── snap_rounding.m ├── solid_angle.cpp ├── split_nonmanifold.cpp ├── split_nonmanifold.m ├── tetrahedralize.cpp ├── tetrahedralize.m ├── triangulate.cpp ├── triangulate.m ├── trim_with_solid.cpp ├── trim_with_solid.m ├── upper_envelope.cpp ├── upper_envelope.m ├── vcpkg.json ├── winding_number.cpp ├── winding_number.m ├── winding_number │ ├── parse_rhs.cpp │ ├── parse_rhs.h │ ├── prepare_lhs.cpp │ ├── prepare_lhs.h │ ├── triangle_tree.cpp │ └── triangle_tree.h ├── winding_number_ray.h ├── wire_mesh.cpp └── wire_mesh.m ├── python └── pysparse.m ├── quat └── quatmultiply.m ├── style.md ├── utility ├── NoCTranspose.m ├── PriorityQueue.m ├── README.md ├── add_gptoolbox_tab_completion.m ├── autohelp.m ├── base64decode.m ├── base64encode.m ├── blue.m ├── cache.m ├── cache_test.m ├── clear_class.m ├── create_cache.m ├── dark_mode.m ├── dec2bin_logical.m ├── depends.m ├── derekblue.m ├── enable_toolbox.m ├── figgif.m ├── figmp4.m ├── figpng.m ├── find_cache.m ├── finish.m ├── gold.m ├── gptoolbox_version.m ├── html_color.m ├── is_writable.m ├── last_command.m ├── lipmanya.m ├── orange.m ├── pink.m ├── pride.m ├── report_mosek_error.m ├── startup.m ├── teal.m ├── tempprefix.m ├── turbo.m ├── uiopen.m └── zoe.m └── wrappers ├── find_first_path.m ├── medit.m ├── meshfix.m ├── meshfix_components.m ├── nested_cages.m ├── path_to_convert.m ├── path_to_eltopo.m ├── path_to_libigl.m ├── path_to_medit.m ├── path_to_meshfix.m ├── path_to_qslim.m ├── path_to_tetgen.m ├── path_to_triangle.m ├── plane_drop.m ├── qslim.m ├── readSCISIM.m ├── tetgen.m ├── texture_map.m └── triangle.m /.gitignore: -------------------------------------------------------------------------------- 1 | # use glob syntax. 2 | syntax: glob 3 | *.o 4 | *.*.swp 5 | *.a 6 | *~ 7 | .DS_Store 8 | *.mexmaci64 9 | *.mexmaca64 10 | *.mexw64 11 | *.mexa64 12 | *.cache.mat 13 | quat/* 14 | quat.zip 15 | mex/build* 16 | *.*.swo 17 | mex/external 18 | mesh/cubic_vertex_removal_g.m 19 | mesh/cubic_vertex_removal_polyfun.m 20 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # 2 | # This list is used by git-shortlog to fix a few botched name translations 3 | # in the libigl archive, either because the author's full name was messed up 4 | # and/or not always written the same way, making contributions from the 5 | # same person appearing not to be so. 6 | # 7 | Alec Jacobson Alec Jacobson (jalec 8 | Alec Jacobson jalec 9 | Alec Jacobson Alec Jacobson 10 | Alec Jacobson ajx 11 | Alec Jacobson mangledorf 12 | Daniele Panozzo Daniele Panozzo 13 | Daniele Panozzo dpanozzo 14 | Olga Diamanti dolga 15 | -------------------------------------------------------------------------------- /RELEASE_HISTORY.txt: -------------------------------------------------------------------------------- 1 | 0.1.1 Cleaned up organization, removed some useless functions, added external 2 | fast marching geodesic distance dependency. 3 | -------------------------------------------------------------------------------- /TODO.todo: -------------------------------------------------------------------------------- 1 | # New Entries up here 2 | - merge normalsvertex, per_vertex_normals and have optional for angle vs. area 3 | vs. uniform weighting 4 | -------------------------------------------------------------------------------- /external/README.md: -------------------------------------------------------------------------------- 1 | This directory contains matlab functions written by others, which may be under 2 | their own licenses. 3 | 4 | To reduce clutter, licenses are listed in the comments beneath single file 5 | programs. 6 | 7 | Filenames should be original. If prototypes or filenames are strange, write a 8 | wrapper and place in ../matrix, ../mesh, etc. where appropriate. 9 | 10 | Some files are patched to work correctly or have more features, so careful when 11 | updating: use diff. 12 | 13 | -------------------------------------------------------------------------------- /external/cmyk2rgb.m: -------------------------------------------------------------------------------- 1 | function rgb = cmyk2rgb(cmyk) 2 | rgb = applycform(cmyk,makecform('cmyk2srgb')); 3 | end 4 | -------------------------------------------------------------------------------- /external/colorbrewer.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/colorbrewer.mat -------------------------------------------------------------------------------- /external/cprintf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/cprintf.m -------------------------------------------------------------------------------- /external/exactgeodesic/create_hedgehog_mesh.m: -------------------------------------------------------------------------------- 1 | %"smoothness" should be specified between 0(smooth, convex mesh) and 1 (a lot of sharp features) 2 | %"waist" should be between 0 and 1; 0 means spherical mesh 3 | function [p,tri] = create_hedgehog_mesh(N, smoothness, waist) 4 | 5 | p = rand(N,3) - 0.5; 6 | for i=1:N; 7 | p(i,:) = p(i,:)/norm(p(i,:)); 8 | end; 9 | 10 | tri = convhulln(p); 11 | 12 | if nargin < 2 13 | smoothness = 0; 14 | end 15 | 16 | if nargin < 3 17 | waist = 0; 18 | end 19 | 20 | for i=1:N; 21 | scale = 1 + smoothness*(0.5-rand); 22 | p(i,:) = p(i,:)*scale; % add radial noise 23 | if max(abs(p(i,:))) > 1 24 | p(i,:) = p(i,:)/max(abs(p(i,:))); 25 | end 26 | 27 | scale = abs(p(i,1))*waist + (1 - waist); 28 | p(i,2:3) = p(i,2:3)*scale; % add "waist" on x-axis 29 | end; 30 | -------------------------------------------------------------------------------- /external/exactgeodesic/extract_coordinates_from_path.m: -------------------------------------------------------------------------------- 1 | function [x,y,z] = extract_coordinates_from_path(path) 2 | 3 | %this elegant way is incompatible with the older versions of matlab 4 | % x = cellfun(@(p) p.x, path); %the simplest way to extract coordinates from the path 5 | % y = cellfun(@(p) p.y, path); %if it looks complicated, you can use "for" similar to example1.m 6 | % z = cellfun(@(p) p.z, path); 7 | 8 | x = zeros(length(path),1); 9 | y = x; 10 | z = y; 11 | 12 | for i=1:length(path) 13 | x(i) = path{i}.x; 14 | y(i) = path{i}.y; 15 | z(i) = path{i}.z; 16 | end; 17 | 18 | -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_create_surface_point.m: -------------------------------------------------------------------------------- 1 | function p = geodesic_create_surface_point(type,id,x,y,z) 2 | 3 | p.type = type; 4 | p.id = id; 5 | 6 | if nargin == 3 7 | p.x = x(1); 8 | p.y = x(2); 9 | p.z = x(3); 10 | else 11 | p.x = x; 12 | p.y = y; 13 | p.z = z; 14 | end 15 | -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_debug.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/exactgeodesic/geodesic_debug.dll -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_delete.m: -------------------------------------------------------------------------------- 1 | % delete mesh, algorithm, or everything at once 2 | % Danil Kirsanov, 09/2007 3 | 4 | function object = geodesic_delete(object) 5 | 6 | global geodesic_library; 7 | if ~libisloaded(geodesic_library) %everything is already cleared 8 | object = []; 9 | return; 10 | end 11 | 12 | if nargin == 0 % the simplest way to delete everything is to unload the library 13 | unloadlibrary(geodesic_library); 14 | else 15 | if libisloaded(geodesic_library) 16 | if strcmp(object.object_type, 'mesh') 17 | calllib(geodesic_library, 'delete_mesh', object.id); % delete mesh and corresponding algorithms 18 | else 19 | calllib(geodesic_library, 'delete_algorithm', object.id); % delete a single algorithm 20 | end 21 | end 22 | end 23 | object = []; 24 | -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_new_algorithm.m: -------------------------------------------------------------------------------- 1 | function algorithm = geodesic_new_algorithm(mesh, type, subdivision) 2 | 3 | global geodesic_library; 4 | 5 | algorithm = []; 6 | if ~libisloaded(geodesic_library) 7 | disp('error: geodesic library is not loaded'); 8 | return; 9 | end 10 | 11 | if nargin == 2 12 | subdivision = 0; 13 | end 14 | 15 | if strcmp(type, 'subdivision') & subdivision == 0 16 | type = 'dijkstra'; 17 | end; 18 | 19 | algorithm_types = {'exact', 'subdivision', 'dijkstra'}; 20 | type_id = find(strcmp(type, algorithm_types)); 21 | if isempty(type_id) 22 | disp('error: algorithm type is incorrect'); 23 | return; 24 | end 25 | type_id = type_id - 1; 26 | 27 | algorithm.id = calllib(geodesic_library, 'new_algorithm', mesh.id, type_id, subdivision); 28 | algorithm.type = type; 29 | algorithm.object_type = 'algorithm'; -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_propagate.m: -------------------------------------------------------------------------------- 1 | function geodesic_propagate(algorithm, source_points, stop_points, max_distance) 2 | 3 | global geodesic_library; 4 | 5 | if nargin < 4 6 | max_distance = 1e100; 7 | end 8 | 9 | if nargin < 3 10 | stop_points = []; 11 | end 12 | 13 | if ~libisloaded(geodesic_library) 14 | disp('error: geodesic library is not loaded'); 15 | return; 16 | end 17 | 18 | sources = geodesic_convert_surface_points(source_points); 19 | stops = geodesic_convert_surface_points(stop_points); 20 | 21 | calllib(geodesic_library, 'propagate', algorithm.id, ... 22 | sources, length(sources)/5, stops, length(stops)/5, max_distance); 23 | -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_release.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/exactgeodesic/geodesic_release.dll -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_release.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/exactgeodesic/geodesic_release.dylib -------------------------------------------------------------------------------- /external/exactgeodesic/geodesic_trace_back.m: -------------------------------------------------------------------------------- 1 | function path = geodesic_trace_back(algorithm, destination) 2 | 3 | global geodesic_library; 4 | 5 | tmp{1} = destination; 6 | d = geodesic_convert_surface_points(tmp); 7 | 8 | tmp = libpointer('doublePtrPtr'); 9 | [path_length, tmp, path_double] = calllib(geodesic_library, 'trace_back', algorithm.id, d, tmp); 10 | 11 | setdatatype(path_double, 'doublePtr', path_length*5); 12 | path = geodesic_convert_surface_points(path_double.Value); -------------------------------------------------------------------------------- /external/exactgeodesic/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/exactgeodesic/readme.txt -------------------------------------------------------------------------------- /external/exactgeodesic/src/compileMacOSX.sh: -------------------------------------------------------------------------------- 1 | g++ -dynamiclib -I/opt/local/include/ geodesic_matlab_api.cpp -O3 -DNDEBUG -o geodesic.dylib 2 | -------------------------------------------------------------------------------- /external/exactgeodesic/src/geodesic.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/exactgeodesic/src/geodesic.dylib -------------------------------------------------------------------------------- /external/exactgeodesic/src/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/exactgeodesic/src/readme.txt -------------------------------------------------------------------------------- /external/newquaternion.m: -------------------------------------------------------------------------------- 1 | % NEWQUATERNION - Construct quaternion 2 | % 3 | % Q = newquaternion(theta, axis) 4 | % 5 | % Arguments: theta - angle of rotation 6 | % axis - 3-vector defining axis of rotation 7 | % Returns: Q - a quaternion in the form [w xi yj zk] 8 | % 9 | % See Also: QUATERNION2MATRIX, MATRIX2QUATERNION, QUATERNIONROTATE 10 | 11 | % Copyright (c) 2008 Peter Kovesi 12 | % School of Computer Science & Software Engineering 13 | % The University of Western Australia 14 | % pk at csse uwa edu au 15 | % http://www.csse.uwa.edu.au/ 16 | 17 | function Q = newquaternion(theta, axis) 18 | 19 | axis = axis(:)/norm(axis(:)); 20 | Q = zeros(4,1); 21 | Q(1) = cos(theta/2); 22 | Q(2:4) = sin(theta/2)*axis; 23 | 24 | -------------------------------------------------------------------------------- /external/rgb2cmyk.m: -------------------------------------------------------------------------------- 1 | function cmyk = rgb2cmyk(rgb) 2 | cmyk = applycform(rgb,makecform('srgb2cmyk')); 3 | end 4 | 5 | -------------------------------------------------------------------------------- /external/spnull.m: -------------------------------------------------------------------------------- 1 | function N = spnull(S, tol) 2 | % spnull returns computes the sparse Null basis of a matrix 3 | % 4 | % N = sparseNull(S, tol) 5 | % 6 | % Computes a basis of the null space for a sparse matrix. For sparse 7 | % matrixes this is much faster than using null. It does however have lower 8 | % numerical accuracy. N is itself sparse and not orthonormal. So in this 9 | % way it is like using N = null(S, 'r'), except of course much faster. 10 | % 11 | % Jan Schellenberger 10/20/2009 12 | % based on this: 13 | % http://www.mathworks.com/matlabcentral/fileexchange/11120-null-space-of-a-sparse-matrix 14 | if nargin <2 15 | tol = 1e-9; 16 | end 17 | [SpLeft, SpRight] = spspaces(S,2, tol); 18 | N = SpRight{1}(:,SpRight{3}); 19 | N(abs(N) < tol) = 0; 20 | end 21 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/batch_landmarks_error.m: -------------------------------------------------------------------------------- 1 | % batch test 2 | clear; 3 | name_list = {'constant','mountain','road2'}; 4 | 5 | for i=1:length(name_list) 6 | name = name_list{i}; 7 | % test_landmark_error; 8 | test_distance_approximation; 9 | end -------------------------------------------------------------------------------- /external/toolbox_fast_marching/batch_propagation_mesh.m: -------------------------------------------------------------------------------- 1 | name_list = {'bunny','elephant-50kv','david50kf','david_head','hand'}; 2 | 3 | for nstart=[1 10 20 50 100] 4 | for iname = 1:length(name_list) 5 | name = name_list{iname}; 6 | disp(['----> Processing mesh ' name ' - ' num2str(nstart) '.']); 7 | test_propagation_mesh; 8 | end 9 | end -------------------------------------------------------------------------------- /external/toolbox_fast_marching/batch_shape_meshing.m: -------------------------------------------------------------------------------- 1 | for use_adaptive=0:1 2 | for p = [200 400 1000] 3 | test_shape_meshing; 4 | end 5 | end -------------------------------------------------------------------------------- /external/toolbox_fast_marching/callback_active_contour.m: -------------------------------------------------------------------------------- 1 | function y = callback_active_contour(x, options) 2 | 3 | % callback_active_contour - callback for conjugate gradient 4 | % 5 | % y = callback_active_contour(x, options); 6 | % 7 | % Copytight (c) 2007 Gabriel Peyre 8 | 9 | % norm of gradient 10 | dt = options.dt; 11 | n = options.n; 12 | d = options.d; 13 | x = reshape(x,n,n); 14 | y = divgrad( divgrad(x,options)./repmat(d,[1 1 2]),options ); 15 | if isempty(options.E) 16 | y = x(:) - dt * d(:) .* y(:); 17 | else 18 | y = x(:) - dt * options.E(:) .* d(:) .* y(:); 19 | end -------------------------------------------------------------------------------- /external/toolbox_fast_marching/compute_distance_landmark.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/compute_distance_landmark.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/compute_edge_energy.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/compute_edge_energy.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/compute_geodesic.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/compute_geodesic.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/compute_heuristic_landmark.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/compute_heuristic_landmark.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/convert_distance_color.m: -------------------------------------------------------------------------------- 1 | function v = convert_distance_color(D,M) 2 | 3 | % convert_distance_color - convert a distance function to a color image 4 | % 5 | % A = convert_distance_color(D,M); 6 | % 7 | % M is optional: background image. 8 | % 9 | % Very useful to save a result of distance computation to an image file 10 | % with nice colors. 11 | % 12 | % Copyright (c) 2007 Gabriel Peyre 13 | 14 | n = size(D,1); 15 | if nargin<2 16 | M = ones(n); 17 | end 18 | 19 | c = jet(256); 20 | U = D; U(U==Inf) = min(U(U~=Inf)); 21 | I = floor(255*rescale(U))+1; 22 | v = c(I(:),:); v = reshape(v, [n n 3]); 23 | A = repmat(rescale(M), [1 1 3]); 24 | B = repmat(D, [1 1 3]); 25 | v(B==Inf) = A(B==Inf); -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/apple.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/apple.gif -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/brain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/brain.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/camel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/camel.gif -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/cavern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/cavern.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/chan-vese.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/chan-vese.jpg -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/chicken.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/chicken.gif -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/giraffe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/giraffe.gif -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/image01.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/image01.tiff -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/mm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/mm.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/mountain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/mountain.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/road2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/road2.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/room.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/room.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/room1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/room1.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/data/stephanodiscusniagarae.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/data/stephanodiscusniagarae.jpg -------------------------------------------------------------------------------- /external/toolbox_fast_marching/display_eccentricity.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/display_eccentricity.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/eucdist2.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/eucdist2.dll -------------------------------------------------------------------------------- /external/toolbox_fast_marching/eucdist2.m: -------------------------------------------------------------------------------- 1 | function varargout = eucdist2(varargin) 2 | %EUCDIST2 Compute 2-D Euclidean distance transform. 3 | % D = EUCDIST2(BW) computes the Euclidean distance transform on the input 4 | % binary image BW, which must be 2-D. Specifically, it computes the 5 | % distance to the nearest nonzero-valued pixel. 6 | % 7 | % [D,L] = EUCDIST2(BW) returns a linear index array L representing a 8 | % nearest-neighbor map. L(r,c) is the linear index of the nonzero-valued 9 | % element of BW closest to (r,c). 10 | % 11 | % See also BWDIST. 12 | 13 | % Copyright 1993-2003 The MathWorks, Inc. 14 | % $Revision: 1.6.4.2 $ $Date: 2003/08/01 18:11:05 $ 15 | 16 | %#mex 17 | 18 | error('Images:eucdist2:missingMEXFile', 'Missing MEX-file: %s', mfilename); 19 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/eucdist2.mexglx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/eucdist2.mexglx -------------------------------------------------------------------------------- /external/toolbox_fast_marching/generate_constrained_map.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/generate_constrained_map.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_01.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_02.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_03.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_04.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_05.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_06.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_07.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_08.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_09.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_10.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/html/content_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/html/content_11.png -------------------------------------------------------------------------------- /external/toolbox_fast_marching/load_potential_map.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/load_potential_map.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/anisotropic-fm-feth/fm2dAniso.mexmaci: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/anisotropic-fm-feth/fm2dAniso.mexmaci -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/backup/perform_front_propagation_2d.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/backup/perform_front_propagation_2d.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/backup/perform_front_propagation_3d - copie.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/backup/perform_front_propagation_3d - copie.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/backup/perform_front_propagation_3d_old.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/backup/perform_front_propagation_3d_old.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/config.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw.suo -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Config.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Config.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Config.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Face.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Face.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Face.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Face.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Face.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Face.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_FaceIterator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_FaceIterator.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_FaceIterator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_FaceIterator.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_MathsWrapper.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_MathsWrapper.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Mesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Mesh.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Mesh.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Mesh.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Mesh.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Mesh.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_PolygonIntersector.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_PolygonIntersector.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_ProgressBar.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_ProgressBar.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Serializable.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Serializable.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_SmartCounter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_SmartCounter.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_SmartCounter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_SmartCounter.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_SmartCounter.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_SmartCounter.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Vertex.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Vertex.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Vertex.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Vertex.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_Vertex.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_Vertex.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_VertexIterator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_VertexIterator.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/GW_VertexIterator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/GW_VertexIterator.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // gw_core.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_core/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_core/stdafx.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicFace.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicFace.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicFace.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicFace.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicFace.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicFace.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicMesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicMesh.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicMesh.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicMesh.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicMesh.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicMesh.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPath.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPath.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPath.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPath.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPath.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPath.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPoint.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPoint.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPoint.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPoint.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPoint.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicPoint.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicVertex.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicVertex.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicVertex.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicVertex.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicVertex.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeodesicVertex.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryAtlas.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryAtlas.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryAtlas.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryAtlas.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryAtlas.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryAtlas.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryCell.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryCell.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryCell.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryCell.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryCell.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_GeometryCell.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_Parameterization.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_Parameterization.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_Parameterization.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_Parameterization.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_Parameterization.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_Parameterization.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation.cpp: -------------------------------------------------------------------------------- 1 | #error removed -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation.h: -------------------------------------------------------------------------------- 1 | #error removed -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation.inl: -------------------------------------------------------------------------------- 1 | #error removed -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_ABC.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_ABC.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Cubic.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Cubic.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Cubic.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Cubic.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Cubic.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Cubic.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Linear.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Linear.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Linear.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Linear.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Linear.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Linear.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Quadratic.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Quadratic.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Quadratic.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Quadratic.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Quadratic.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_TriangularInterpolation_Quadratic.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiMesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiMesh.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiMesh.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiMesh.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiMesh.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiMesh.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiVertex.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiVertex.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiVertex.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiVertex.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiVertex.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/GW_VoronoiVertex.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // gw_core.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_geodesic/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_geodesic/stdafx.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Maths.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Maths.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_MathsConfig.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_MathsConfig.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Matrix2x2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Matrix2x2.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Matrix3x3.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Matrix3x3.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Matrix4x4.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Matrix4x4.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_MatrixNxP.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_MatrixNxP.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_MatrixStatic.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_MatrixStatic.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Quaternion.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Quaternion.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_SparseMatrix.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_SparseMatrix.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Vector2D.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Vector2D.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Vector3D.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Vector3D.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_Vector4D.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_Vector4D.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_VectorND.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_VectorND.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/GW_VectorStatic.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/GW_VectorStatic.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_maths/gw_complex.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_maths/gw_complex.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_ASELoader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_ASELoader.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_ASELoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_ASELoader.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_BasicDisplayer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_BasicDisplayer.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_BasicDisplayer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_BasicDisplayer.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_BasicDisplayer.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_BasicDisplayer.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_CSVLoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_CSVLoader.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_GeodesicDisplayer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_GeodesicDisplayer.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_GeodesicDisplayer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_GeodesicDisplayer.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_GeodesicDisplayer.inl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_GeodesicDisplayer.inl -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_InputOutput.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_InputOutput.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_InputOutput.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_InputOutput.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OBJLoader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OBJLoader.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OBJLoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OBJLoader.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OFFLoader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OFFLoader.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OFFLoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OFFLoader.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OpenGLHelper.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_OpenGLHelper.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_PLYLoader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_PLYLoader.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_PLYLoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_PLYLoader.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_Toolkit.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_Toolkit.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_Toolkit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_Toolkit.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_VRMLLoader.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_VRMLLoader.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_VRMLLoader.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/GW_VRMLLoader.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // gw_core.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/gw/gw_toolkit/stdafx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/gw/gw_toolkit/stdafx.h -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_circular_front_propagation_2d.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/perform_circular_front_propagation_2d.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_circular_front_propagation_2d.def: -------------------------------------------------------------------------------- 1 | LIBRARY perform_circular_front_propagation_2d.dll 2 | EXPORTS 3 | mexFunction -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_front_propagation_2d.def: -------------------------------------------------------------------------------- 1 | LIBRARY perform_front_propagation_2d.dll 2 | EXPORTS 3 | mexFunction -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_front_propagation_2d_mex.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/perform_front_propagation_2d_mex.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_front_propagation_3d.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/perform_front_propagation_3d.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_front_propagation_3d.def: -------------------------------------------------------------------------------- 1 | LIBRARY perform_front_propagation_3d.dll 2 | EXPORTS 3 | mexFunction -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_front_propagation_mesh.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/mex/perform_front_propagation_mesh.cpp -------------------------------------------------------------------------------- /external/toolbox_fast_marching/mex/perform_front_propagation_mesh.def: -------------------------------------------------------------------------------- 1 | LIBRARY perform_front_propagation_mesh.dll 2 | EXPORTS 3 | mexFunction -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_circular_fast_marching_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_circular_fast_marching_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_farthest_landmark_sampling.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_farthest_landmark_sampling.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_farthest_point_sampling_boundary.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_farthest_point_sampling_boundary.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_fmstar_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_fmstar_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_fmstar_3d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_fmstar_3d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_front_propagation_2d.m: -------------------------------------------------------------------------------- 1 | % [D,S] = perform_front_propagation_2d(W,start_points,end_points,nb_iter_max,H); 2 | % 3 | % 'D' is a 2D array containing the value of the distance function to seed. 4 | % 'S' is a 2D array containing the state of each point : 5 | % -1 : dead, distance have been computed. 6 | % 0 : open, distance is being computed but not set. 7 | % 1 : far, distance not already computed. 8 | % 'W' is the weight matrix (inverse of the speed). 9 | % 'start_points' is a 2 x num_start_points matrix where k is the number of starting points. 10 | % 'H' is an heuristic (distance that remains to goal). This is a 2D matrix. 11 | % 12 | % Copyright (c) 2004 Gabriel Peyr� -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_front_propagation_2d_slow.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_front_propagation_2d_slow.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/perform_geodesic_interpolation.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/perform_geodesic_interpolation.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/pick_start_end_point.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/pick_start_end_point.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/plot_constrained_path_planing.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/plot_constrained_path_planing.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/plot_fast_marching_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/plot_fast_marching_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/plot_fast_marching_3d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/plot_fast_marching_3d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/plot_volumetric_data.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/plot_volumetric_data.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/publish_html.m: -------------------------------------------------------------------------------- 1 | function publish_html(filename, outputDir, stylesheet) 2 | 3 | % publish_html - publish a file to HTML format 4 | % 5 | % publish_html(filename, outputDir, stylesheet); 6 | % 7 | % Copyright (c) 2008 Gabriel Peyre 8 | 9 | if nargin<1 10 | filename = 'content'; 11 | end 12 | if nargin<2 13 | outputDir = 'html'; 14 | end 15 | if nargin<3 16 | stylesheet = [outputDir '/gpeyre.xsl']; 17 | end 18 | 19 | opts.outputDir = outputDir; 20 | if not(isempty(stylesheet)) 21 | opts.stylesheet = stylesheet; 22 | end 23 | file = publish(filename,opts); 24 | 25 | web(file); 26 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/skeleton.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/skeleton.dll -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_circular.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_circular.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_circular_fast_marching_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_circular_fast_marching_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_circular_prior.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_circular_prior.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_constrained_map.m: -------------------------------------------------------------------------------- 1 | % test for propagation constrained to a sub-set of points 2 | 3 | 4 | n = 300; 5 | name = 'mountain'; 6 | name = 'constant'; 7 | 8 | % number of points 9 | p = 80; 10 | start_points = floor(rand(2,p)*(n-1))+1; 11 | 12 | x = linspace(-1,1,n); 13 | [Y,X] = meshgrid(x,x); 14 | L = zeros(n)-Inf; 15 | I = find(X.^2 + Y.^2 < 0.6^2); L(I) = Inf; 16 | options.constraint_map = L; 17 | 18 | [M,W] = load_potential_map(name, n); 19 | 20 | [D,Z,Q] = perform_fast_marching(W, start_points, options); 21 | 22 | clf; 23 | subplot(1,2,1); 24 | hold on; 25 | imagesc(Q'); axis image; axis off; 26 | plot(start_points(1,:), start_points(2,:), 'k.'); 27 | hold off; 28 | subplot(1,2,2); 29 | hold on; 30 | imagesc(D'); axis image; axis off; 31 | plot(start_points(1,:), start_points(2,:), 'k.'); 32 | hold off; -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_eucldist.m: -------------------------------------------------------------------------------- 1 | % test for euclidean distance 2 | 3 | M = load_image('disk', 128); 4 | M = logical(M); 5 | [D,L] = eucdist2(M); -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fast_marching_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fast_marching_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fast_marching_3d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fast_marching_3d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fmstar_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fmstar_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fmstar_3d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fmstar_3d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fmstar_error.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fmstar_error.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fmstar_landmark.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fmstar_landmark.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_fmstar_weight_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_fmstar_weight_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_multiple_paths_2d.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_multiple_paths_2d.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_segmentation.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/tests/test_segmentation.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/tests/test_voronoi_triangulation.m: -------------------------------------------------------------------------------- 1 | % test for Voronoi cells extractions 2 | 3 | 4 | n = 300; 5 | name = 'mountain'; 6 | name = 'constant'; 7 | 8 | % number of points 9 | p = 80; 10 | start_points = floor(rand(2,p)*(n-1))+1; 11 | 12 | [M,W] = load_potential_map(name, n); 13 | 14 | [D,Z,Q] = perform_fast_marching(W, start_points); 15 | 16 | clf; 17 | subplot(1,2,1); 18 | hold on; 19 | imagesc(Q'); axis image; axis off; 20 | plot(start_points(1,:), start_points(2,:), 'k.'); 21 | hold off; 22 | subplot(1,2,2); 23 | hold on; 24 | imagesc(D'); axis image; axis off; 25 | plot(start_points(1,:), start_points(2,:), 'k.'); 26 | hold off; 27 | 28 | faces = compute_voronoi_triangulation(Q, vertex); 29 | edges = compute_edges(faces); 30 | 31 | hold on; 32 | imagesc(Q'); axis image; axis off; 33 | plot_edges(edges, start_points, 'k'); 34 | hold off; -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/check_face_vertex.m: -------------------------------------------------------------------------------- 1 | function [vertex,face] = check_face_vertex(vertex,face, options) 2 | 3 | % check_face_vertex - check that vertices and faces have the correct size 4 | % 5 | % [vertex,face] = check_face_vertex(vertex,face); 6 | % 7 | % Copyright (c) 2007 Gabriel Peyre 8 | 9 | vertex = check_size(vertex); 10 | face = check_size(face); 11 | 12 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 | function a = check_size(a) 14 | if isempty(a) 15 | return; 16 | end 17 | if size(a,1)>size(a,2) 18 | a = a'; 19 | end 20 | if size(a,1)<3 && size(a,2)==3 21 | a = a'; 22 | end 23 | if size(a,1)<=3 && size(a,2)>=3 && sum(abs(a(:,3)))==0 24 | % for flat triangles 25 | a = a'; 26 | end 27 | if size(a,1)~=3 28 | error('face or vertex is not of correct size'); 29 | end 30 | -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/clamp.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/clamp.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/compute_cuvilinear_abscice.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/compute_cuvilinear_abscice.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/compute_distance_to_points.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/compute_distance_to_points.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/compute_edges.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/compute_edges.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/compute_gaussian_filter.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/compute_gaussian_filter.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/compute_grad.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/compute_grad.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/compute_vertex_ring.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/compute_vertex_ring.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/getoptions.m: -------------------------------------------------------------------------------- 1 | function v = getoptions(options, name, v, mendatory) 2 | 3 | % getoptions - retrieve options parameter 4 | % 5 | % v = getoptions(options, 'entry', v0); 6 | % is equivalent to the code: 7 | % if isfield(options, 'entry') 8 | % v = options.entry; 9 | % else 10 | % v = v0; 11 | % end 12 | % 13 | % Copyright (c) 2007 Gabriel Peyre 14 | 15 | if nargin<4 16 | mendatory = 0; 17 | end 18 | 19 | if isfield(options, name) 20 | v = eval(['options.' name ';']); 21 | elseif mendatory 22 | error(['You have to provide options.' name '.']); 23 | end -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/imageplot.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/imageplot.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/mmax.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/mmax.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/nb_dims.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/nb_dims.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/num2string_fixeddigit.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/num2string_fixeddigit.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_blurring.m: -------------------------------------------------------------------------------- 1 | function M = perform_blurring(M, sigma, options) 2 | 3 | % perform_blurring - gaussian blurs an image 4 | % 5 | % M = perform_blurring(M, sigma, options); 6 | % 7 | % M is the original data 8 | % sigma is the width of blurs (in pixels) 9 | % 10 | % Copyright (c) 2007 Gabriel Peyre 11 | 12 | options.null = 0; 13 | n = size(M,1); 14 | 15 | eta = 4; 16 | p = round((sigma*eta)/2)*2+1; 17 | p = min(p,round(n/2)*2-1); 18 | 19 | h = compute_gaussian_filter(p*[1 1],sigma/(2*n),[n n]); 20 | M = perform_convolution(M, h, options); -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_contour_extraction.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_contour_extraction.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_convolution.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_convolution.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_curve_extraction.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_curve_extraction.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_curve_resampling.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_curve_resampling.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_image_resize.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_image_resize.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_tensor_recomp.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_tensor_recomp.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/perform_vf_normalization.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/perform_vf_normalization.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/plot_mesh.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/plot_mesh.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/prod_vf_sf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/prod_vf_sf.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/progressbar.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/progressbar.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/read_off.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/external/toolbox_fast_marching/toolbox/read_off.m -------------------------------------------------------------------------------- /external/toolbox_fast_marching/toolbox/rescale.m: -------------------------------------------------------------------------------- 1 | function y = rescale(x,a,b) 2 | 3 | % rescale - rescale data in [a,b] 4 | % 5 | % y = rescale(x,a,b); 6 | % 7 | % Copyright (c) 2004 Gabriel Peyr? 8 | 9 | if nargin<2 10 | a = 0; 11 | end 12 | if nargin<3 13 | b = 1; 14 | end 15 | 16 | m = min(x(:)); 17 | M = max(x(:)); 18 | 19 | if M-m1; 24 | end 25 | A(~BW,:) = 0; 26 | A(:,~BW) = 0; 27 | [~,L] = conncomp(A); 28 | assert(min(L(:)) > 0); 29 | L(~BW(:)) = 0; 30 | [~,~,L] = unique(L); 31 | L = reshape(L-1,size(BW)); 32 | assert(all(L(~BW(:))==0)); 33 | NUM = max(L(:)); 34 | end 35 | -------------------------------------------------------------------------------- /imageprocessing/imclose_sphere.m: -------------------------------------------------------------------------------- 1 | function B = imclose_sphere(A,r) 2 | % Compute morphological closing with sphere of radius r. 3 | % 4 | % B = imclose_sphere(A,r) 5 | % 6 | % Inputs: 7 | % A binary image 8 | % r radius of sphere 9 | % Outputs: 10 | % B binary image same size as A 11 | % 12 | % % Example: 13 | % M = (imclose(A,strel('sphere',32))); 14 | % F = imclose_sphere(A,32); 15 | % 16 | assert(islogical(A)); 17 | % pad A by r 18 | rc = ceil(r); 19 | A = padarray(A,repmat(rc,1,ndims(A)),'both'); 20 | B = bwdist(bwdist(A>0)>r)>r; 21 | sizeB = size(B); 22 | indices = arrayfun(@(dim) (rc+1):(sizeB(dim)-rc), 1:ndims(B), 'UniformOutput', false); 23 | B = B(indices{:}); 24 | end 25 | -------------------------------------------------------------------------------- /imageprocessing/imdarken.m: -------------------------------------------------------------------------------- 1 | function [C,alpha_C] = imdarken(A,alpha_A,B,alpha_B) 2 | % IMDARKEN Blend A over B, replacing pixels in B if the cooresponding pixel in 3 | % A is darker. 4 | % 5 | % Inputs: 6 | % A w by h by c image A 7 | % alpha_A alpha mask for image A, either: 8 | % w by h by c 9 | % w by h (same across channels) 10 | % s (same for every pixel) 11 | % B w by h by c image B 12 | % alpha_B alpha mask for image B, either: 13 | % w by h by c 14 | % w by h (same across channels) 15 | % s (same for every pixel) 16 | % Outputs: 17 | % C w by h by c result image, *ALWAYS of type double* 18 | % alpha_C alpha mask for resulting image 19 | 20 | % https://developer.android.com/reference/android/graphics/BlendMode#DARKEN 21 | alpha_C = alpha_A+alpha_B-alpha_B.*alpha_A; 22 | C = (1-alpha_B).*A + (1-alpha_A).*B+min(B,A); 23 | end 24 | -------------------------------------------------------------------------------- /imageprocessing/imdir.m: -------------------------------------------------------------------------------- 1 | function files = imdir(dir_name) 2 | % IMDIR returns image files in directory 3 | % 4 | % files = imdir(dir_name) 5 | % 6 | % Inputs: 7 | % dir_name path to directory 8 | % Outputs: 9 | % files struct array of image files in dir_name 10 | % 11 | % See also: dir 12 | % 13 | 14 | % get list of matlab readable file formats 15 | formats = imformats(); 16 | % build list of formats' extensions: lower and upper case 17 | exts = [formats.ext upper([formats.ext])]; 18 | 19 | files = []; 20 | for k = 1:size(exts,2); 21 | files = [files; dir([dir_name '/*.' exts{k}])]; 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /imageprocessing/iminpaint.m: -------------------------------------------------------------------------------- 1 | function Z = iminpaint(im,M) 2 | % Z = iminpaint(im,M) 3 | % 4 | % Inputs: 5 | % im w by h by c image 6 | % M w by h mask 7 | % Outputs: 8 | % Z w by h by c image with mask in-painted with Laplacian 9 | % 10 | if islogical(M) 11 | assert(numel(M) == size(im,1)*size(im,2)); 12 | if any(size(M)==1) 13 | M = reshape(M,size(im,1),size(im,2)); 14 | end 15 | end 16 | L = fd_laplacian(size(im(:,:,1))); 17 | b = find(M); 18 | X = reshape(im,[],size(im,3)); 19 | Z = min_quad_with_fixed(-L,[],b,X(b,:),[],[],struct('force_Aeq_li',true)); 20 | Z = reshape(Z,size(im)); 21 | end 22 | -------------------------------------------------------------------------------- /imageprocessing/median_filter.m: -------------------------------------------------------------------------------- 1 | function M = median_filter(im) 2 | % MEDIAN_FILTER simpler wrapper for calling medfilt2 on each channel 3 | % 4 | % M = median_filter(im) 5 | % 6 | % Input: 7 | % im w by h by c image 8 | % Output: 9 | % M median filtered image in each channel 10 | % 11 | 12 | % This could probably be a one-liner using num2cell and cellfun 13 | M = zeros(size(im)); 14 | for c = 1 : size(im,3) 15 | M(:,:,c) = medfilt2(im(:,:,c)); 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /imageprocessing/oklab2rgb.m: -------------------------------------------------------------------------------- 1 | function rgb = oklab2rgb(ok) 2 | % OKLAB2RGB Convert colors stored in OKLab color space to RGB color space 3 | % 4 | % rgb = oklab2rgb(ok) 5 | % 6 | % Inputs: 7 | % ok #h by #w by 3 image of colors or #ok by 3 list of colors 8 | % Outputs: 9 | % rgb converted ok colors (same size as ok) 10 | % 11 | % See also: rgb2lin, lin2rgb, oklab2lin , rgb2oklab, lin2oklab 12 | lin = oklab2lin(ok); 13 | rgb = lin2rgb(lin); 14 | end 15 | 16 | -------------------------------------------------------------------------------- /imageprocessing/okloop.m: -------------------------------------------------------------------------------- 1 | function [RGB,OK] = okloop(nc, arc, shift) 2 | % [RGB,OK] = okloop(nc, arc, shift) 3 | % 4 | % Example: 5 | % r = 2; % number of repetitions 6 | % n = 4; % number of unique colors 7 | % okloop(r*n,r*2*pi); 8 | % 9 | % Example: 10 | % % n must be odd 11 | % n = 15; 12 | % X = okloop(n); 13 | % X = X(mod((1:floor(n/2):n*floor(n/2)) -1,n)+1,:); 14 | if nargin < 1, nc = 256; end 15 | if nargin < 2, arc = 2*pi; end 16 | if nargin < 3, shift = 0; end 17 | 18 | th = linspace(0+shift,arc+shift,nc+1)'; 19 | th = th(1:end-1); 20 | l = 0.75010101010101016; 21 | r = 0.12755316371916220; 22 | OK = [repmat(l,nc,1) r*[cos(th) sin(th)]]; 23 | RGB = oklab2rgb(OK); 24 | end 25 | -------------------------------------------------------------------------------- /imageprocessing/rgb2oklab.m: -------------------------------------------------------------------------------- 1 | function ok = rgb2oklab(rgb) 2 | % RGB2OKLAB Convert colors stored in RGB color space to OKLab color space 3 | % 4 | % ok = rgb2oklab(rgb) 5 | % 6 | % Inputs: 7 | % rgb #h by #w by 3 image of colors or #rgb by 3 list of colors 8 | % Outputs: 9 | % ok converted ok colors (same size as rgb) 10 | % 11 | % See also: rgb2lin, lin2rgb, oklab2rgb, lin2oklab, oklab2lin 12 | % 13 | % Example: 14 | % C = permute([0.99215,0.99607,0.99607;0.14901,0.05490,0.94901],[1 3 2]); 15 | % L = rgb2oklab(C); 16 | % imshow([ ... 17 | % interp1([0 1],C,linspace(0,1,334)).*ones(1,146) ... 18 | % oklab2rgb(interp1([0 1],L,linspace(0,1,334)).*ones(1,146))]); 19 | lin = rgb2lin(rgb); 20 | ok = lin2oklab(lin); 21 | end 22 | -------------------------------------------------------------------------------- /images/baboon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/baboon.jpg -------------------------------------------------------------------------------- /images/david.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/david.png -------------------------------------------------------------------------------- /images/dorgan-brothers.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/dorgan-brothers.jpg -------------------------------------------------------------------------------- /images/gorilla-yawning-fake-depth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/gorilla-yawning-fake-depth.jpg -------------------------------------------------------------------------------- /images/gorilla-yawning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/gorilla-yawning.png -------------------------------------------------------------------------------- /images/gorilla-yawning.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/gorilla-yawning.psd -------------------------------------------------------------------------------- /images/gptoolbox-bounce.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/gptoolbox-bounce.gif -------------------------------------------------------------------------------- /images/half-black-half-white-square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/half-black-half-white-square.png -------------------------------------------------------------------------------- /images/hans-hass.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/hans-hass.jpg -------------------------------------------------------------------------------- /images/max-schmeling-landscape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/max-schmeling-landscape.png -------------------------------------------------------------------------------- /images/max-schmeling.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/max-schmeling.jpg -------------------------------------------------------------------------------- /images/nuclear-blast-observers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/nuclear-blast-observers.png -------------------------------------------------------------------------------- /images/nuclear-blast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/nuclear-blast.png -------------------------------------------------------------------------------- /images/otto-freundlich.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alecjacobson/gptoolbox/a161a76d9de709079615fc408c8b66ee32fa09e2/images/otto-freundlich.jpg -------------------------------------------------------------------------------- /matrix/copysign.m: -------------------------------------------------------------------------------- 1 | function C = copysign(A,B) 2 | % C = copysign(A,B) 3 | % 4 | % Inputs: 5 | % A m by n matrix of doubles 6 | % B m by n matrix of doubles 7 | % Outputs: 8 | % C m by n matrix of doubles so that C(i) = abs(A(i)) if B(i) >= 0 and 9 | % C(i) = -abs(A(i)) if B(i) < 0 10 | 11 | %C = (B>=0).*abs(A) + (B<0).*-abs(A); 12 | 13 | signmask = bitxor(typecast(double(0),'uint64'),typecast(double(-0),'uint64')); 14 | not_signmask = bitcmp(signmask,'uint64'); 15 | 16 | %S = bitand(typecast(B,'uint64'),signmask); 17 | %A_abs = bitand(typecast(A,'uint64'), not_signmask); 18 | %C = typecast(bitor(A_abs,S),'double'); 19 | 20 | % Combine into a single line 21 | C = typecast(bitor(bitand(typecast(A,'uint64'), not_signmask),bitand(typecast(B,'uint64'),signmask)),'double'); 22 | end 23 | -------------------------------------------------------------------------------- /matrix/cspy.m: -------------------------------------------------------------------------------- 1 | function cspy(S,epsilon) 2 | % cspy Visualize sparsity pattern. coloring positive and negative entries of S 3 | % in red and blue respectively 4 | % 5 | % cspy(S) 6 | % cspy(S,epsilon) 7 | % 8 | % Inputs: 9 | % S m by n (sparse) matrix 10 | % epsilon zero value {0} 11 | % 12 | % See also: spy 13 | % 14 | 15 | if nargin < 2 16 | epsilon = 0; 17 | end 18 | spy(S>epsilon,'r'); 19 | hold on; 20 | spy(S<-epsilon,'b'); 21 | hold off; 22 | end 23 | -------------------------------------------------------------------------------- /matrix/debug_sparse.m: -------------------------------------------------------------------------------- 1 | function S = debug_sparse(I,J,V,varargin) 2 | fprintf('I: %d %d\n',size(I)); 3 | fprintf('J: %d %d\n',size(J)); 4 | fprintf('V: %d %d\n',size(V)); 5 | if nargin>3 6 | m = varargin{1}; 7 | n = varargin{2}; 8 | fprintf('S: %d %d\n',m,n); 9 | else 10 | fprintf('S: %d %d\n',max(I(:)),max(J(:))); 11 | end 12 | S = sparse(I,J,V,varargin{:}); 13 | end 14 | -------------------------------------------------------------------------------- /matrix/default_mosek_param.m: -------------------------------------------------------------------------------- 1 | function [param,mosek_exists] = default_mosek_param() 2 | warning('deprecated. please call default_quadprog_param()'); 3 | [param,mosek_exists] = default_quadprog_param(); 4 | end 5 | -------------------------------------------------------------------------------- /matrix/full_sparse.m: -------------------------------------------------------------------------------- 1 | function F = full_sparse(I,J,V,S1,S2) 2 | % FULL_SPARSE Faster than calling: 3 | % 4 | % F = full_sparse(I,J,V,S1,S2) 5 | % 6 | % F = full(sparse(I,J,V,S1,S2)) 7 | % 8 | % See also: sparse, accumarray 9 | if nargin>3 10 | F = accumarray([I(:) J(:)],V(:),[S1 S2]); 11 | else 12 | F = accumarray([I(:) J(:)],V(:)); 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /matrix/functionSignatures.json: -------------------------------------------------------------------------------- 1 | { 2 | "readDMAT": {"inputs":[{"name":"filename","type":"filepath=*.dmat"}]}, 3 | "writeDMAT": {"inputs":[{"name":"filename","type":"filepath=*.dmat"}]}, 4 | "blank_so_every_line_can_have_a_comma":{} 5 | } 6 | -------------------------------------------------------------------------------- /matrix/interleave_rows.m: -------------------------------------------------------------------------------- 1 | function C = interleave_rows(A,B) 2 | % Takes two nxm matrices and creates a 2nxm matrix such that even rows are 3 | % from the first matrix and odd rows are from the second. 4 | % 5 | % C = interleave_rows(A,B) 6 | % 7 | % Input: 8 | % A First nxm matrix, top row of output will be same as top of this matrix 9 | % along with every other row 10 | % B Second nxm matrix, bottom row of output will be same as bottom of this 11 | % matrix along with every other row 12 | % 13 | % Output: 14 | % C 2nxm matrix, alternating rows 15 | % 16 | % 17 | if(size(A)~=size(B)) 18 | error('Input matrices must be same shape'); 19 | end 20 | C = reshape([A(:) B(:)]',size(A,1)*2, size(A,2)); 21 | end 22 | -------------------------------------------------------------------------------- /matrix/matrixnormalize.m: -------------------------------------------------------------------------------- 1 | function N = matrixnormalize(M) 2 | % MATRIXNORMALIZE Normalize matrix values to be between the range 0 and 1. 3 | % Current just works with matrices of type double. 4 | % 5 | % N = matrixnormalize(M) 6 | % 7 | % Inputs: 8 | % M original input matrix 9 | % Output: 10 | % N normalized matrix 11 | % 12 | % Example: 13 | % imshow(matrixnormalize(im)) 14 | % % Equivalent to 15 | % imshow(im,[]) 16 | % 17 | switch class(M) 18 | case {'double','single'} 19 | N = (M-min(M(:)))./(max(M(:))-min(M(:))); 20 | case 'logical' 21 | N = M; 22 | case 'uint8' 23 | N = (M-min(M(:)))*(255/double((max(M(:))-min(M(:))))); 24 | otherwise 25 | error('Class not supported'); 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /matrix/maxnz.m: -------------------------------------------------------------------------------- 1 | function [Y,I] = maxnz(X) 2 | % MAXNZ find maximum nonzero entry in columns of X 3 | % 4 | % [Y,I] = maxnz(X) 5 | % 6 | % Inputs: 7 | % X m by n sparse matrix 8 | % Outputs 9 | % Y n list of maximum non zero entries in each column of X 10 | % I n list of row indices to maximum non-zero entries in each column of X 11 | % 12 | % See also: min, max, minnz 13 | % 14 | 15 | [XI,XJ,XV] = find(X); 16 | X_i = sparse(XI,XJ,XV.^-1,size(X,1),size(X,2)); 17 | [minX_i,minI_i] = min(X_i); 18 | [maxX,maxI] = max(X); 19 | minX_i(minX_i==0) = -inf; 20 | maxX(maxX==0) = -inf; 21 | Y = [minX_i.^-1;maxX]; 22 | [Y,J] = max(Y); 23 | I = [minI_i;maxI]; 24 | I = I(sub2ind(size(I),J,1:size(I,2))); 25 | end 26 | 27 | -------------------------------------------------------------------------------- /matrix/minnz.m: -------------------------------------------------------------------------------- 1 | function [Y,I] = minnz(X) 2 | % MINNZ find minimum nonzero entry in columns of X 3 | % 4 | % [Y,I] = minnz(X) 5 | % 6 | % Inputs: 7 | % X m by n sparse matrix 8 | % Outputs 9 | % Y n list of minimum non zero entries in each column of X 10 | % I n list of row indices to minimum non-zero entries in each column of X 11 | % 12 | % See also: min, max, maxnz 13 | % 14 | % 15 | 16 | % rebuild using 1/element 17 | [XI,XJ,XV] = find(X); 18 | X_i = sparse(XI,XJ,XV.^-1,size(X,1),size(X,2)); 19 | [infX_i,infI_i] = max(X==inf); 20 | [maxX_i,maxI_i] = max(X_i); 21 | maxX_i(maxX_i==0) = inf; 22 | maxX_i(infX_i) = 0; 23 | maxI_i(infX_i) = infI_i(infX_i); 24 | [minX,minI] = min(X); 25 | minX(minX==0) = inf; 26 | Y = [maxX_i.^-1;minX]; 27 | [Y,J] = min(Y); 28 | I = [maxI_i;minI]; 29 | I = I(sub2ind(size(I),J,1:size(I,2))); 30 | 31 | 32 | 33 | 34 | end 35 | -------------------------------------------------------------------------------- /matrix/nmultichoosek.m: -------------------------------------------------------------------------------- 1 | function combs = nmultichoosek(values, k) 2 | % NMULTICHOOSEK Generate all k-combinations with repetitions of a given 3 | % set. 4 | % 5 | % Inputs: 6 | % values #values set to consider (should already contain unique elements) 7 | % k size of combination to draw 8 | % Outputs: 9 | % combs nchoosek(#values,k) by k list of combinations 10 | % 11 | % https://stackoverflow.com/a/28284672/148668 12 | assert(numel(values)>=k); 13 | n = numel(values); 14 | combs = bsxfun(@minus, nchoosek(1:n+k-1,k), 0:k-1); 15 | combs = reshape(values(combs),[],k); 16 | end 17 | -------------------------------------------------------------------------------- /matrix/normalizerow.m: -------------------------------------------------------------------------------- 1 | function [ B ] = normalizerow( A ) %#codegen 2 | % NORMALIZEROW Normalize each row so that each row's l2 norm as a vector is 1 3 | % 4 | % [ B ] = normalizerow( A ) 5 | % 6 | % Input: 7 | % A #A by D list of row vectors of dimension D 8 | % Output: 9 | % B #B by D list of normalized row vectors 10 | % 11 | % Copyright 2011, Alec Jacobson (jacobson@inf.ethz.ch), Daniele Panozzo 12 | % 13 | 14 | if issparse(A) 15 | % speed up (20x) for large sparse matrices 16 | B = bsxfun(@times,A,1./sqrt(sum(A.^2,2))); 17 | else 18 | % normrow will use robust norm 19 | B = A./normrow(A); 20 | end 21 | end 22 | 23 | -------------------------------------------------------------------------------- /matrix/normrow.m: -------------------------------------------------------------------------------- 1 | function [ B ] = normrow( A ) 2 | % NORMROW Compute l2 row vector norms 3 | % 4 | % B = normrow( A ) 5 | % 6 | % Input: 7 | % A #A by D list of row vectors of dimension D 8 | % Output: 9 | % B #A list of norms of row vectors in A 10 | % 11 | % Copyright 2011, Alec Jacobson (jacobson@inf.ethz.ch), Daniele Panozzo 12 | % 13 | 14 | switch size(A,2) 15 | case 2 16 | B = hypot(A(:,1),A(:,2)); 17 | otherwise 18 | %B = sqrt(sum(A.^2,2)); 19 | M = max(abs(A),[],2); 20 | B = M.*sqrt(sum((A./M).^2,2)); 21 | B(M==0) = 0; 22 | end 23 | end 24 | 25 | -------------------------------------------------------------------------------- /matrix/pagepinv.m: -------------------------------------------------------------------------------- 1 | function Y = pagepinv(X,tol) 2 | % Y = pagepinv(X,tol) 3 | % 4 | % Inputs: 5 | % X m x n x p array 6 | % Outputs: 7 | % Y n x m x p array so that Y(:,:,i) = pinv(X(:,:,i)) 8 | % 9 | [U,s,V] = pagesvd(X,'econ','vector'); 10 | 11 | if nargin<2 12 | tol = max(size(X(:,:,1))) * eps(pagenorm(s,inf)); 13 | end 14 | 15 | s(s>tol) = 1./s(s>tol); 16 | 17 | Y = pagemtimes(permute(s,[2 1 3]).*V,'none',U,'ctranspose'); 18 | end 19 | -------------------------------------------------------------------------------- /matrix/rand_rotation.m: -------------------------------------------------------------------------------- 1 | function R = rand_rotation(n) 2 | % Uniformly sample SO(n) 3 | % 4 | % R = rand_rotation(n) 5 | % 6 | % Inputs: 7 | % n dimension 8 | % Output: 9 | % R n by n rotation matrix 10 | % 11 | 12 | % This is 5× slower in 3D. 13 | %if n==3 14 | % R = quat2mat(compact(randrot)); 15 | % return; 16 | %end 17 | 18 | % "How to generate a random unitary matrix" [Maris Ozols 2006] 19 | % http://home.lu.lv/~sd20008/papers/essays/Random%20unitary%20[paper].pdf 20 | [Q,R] = qr(randn(n)); 21 | r = diag(R); 22 | L = diag(r./abs(r)); 23 | R = Q*L; 24 | % I don't think this randomness is necessary 25 | %i = randperm(n,1); 26 | i = 1; 27 | R(i,:) = R(i,:)*det(R); 28 | assert(abs(det(R)-1)<1e-10) 29 | 30 | end 31 | -------------------------------------------------------------------------------- /matrix/randcycle.m: -------------------------------------------------------------------------------- 1 | function [C,u,IA,IC] = randcycle(A) 2 | % RANDCYCLE Randomly reindexs a list a indices 3 | % 4 | % Inputs: 5 | % A #A list of indices with unique values u 6 | % Outputs: 7 | % C #C list of indices with same unique values u 8 | % u,IA,IC output of unique(A); 9 | % 10 | 11 | [u,IA,IC] = unique(A); 12 | % scramble u 13 | u = u(randperm(end)); 14 | C = u(IC); 15 | end 16 | -------------------------------------------------------------------------------- /mesh/add_lights.m: -------------------------------------------------------------------------------- 1 | function varargout = add_lights() 2 | % ADD_LIGHTS Add 5 lights based on the current camera 3 | % 4 | %ls = add_lights() 5 | % 6 | % Outputs: 7 | % ls #ls list of light handles 8 | % 9 | lights = @() { ... 10 | light('Color',1.0*[1 1 1],'Position',(campos-camtarget),'Style','local'), ... 11 | light('Color',0.5*teal,'Position', (campos-camtarget)*axisangle2matrix([0 0 1],pi/2),'Style','local'), ... 12 | light('Color',0.5*teal,'Position',-(campos-camtarget)*axisangle2matrix([0 0 1],pi/2),'Style','local'), ... 13 | light('Color',0.5*pink,'Position', (campos-camtarget)*axisangle2matrix([1 0 0],pi*0.9),'Style','local'), ... 14 | light('Color',0.5*pink,'Position', (campos-camtarget)*axisangle2matrix([1 0 0],-pi*0.9),'Style','local') ... 15 | }; 16 | ls = lights(); 17 | if nargout >= 1 18 | varargout{1} = ls; 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /mesh/adjacency_matrix.m: -------------------------------------------------------------------------------- 1 | function [A] = adjacency_matrix(E) 2 | % ADJACENCY_MATRIX Build sparse adjacency matrix from edge list or face list 3 | % 4 | % [A] = adjacency_matrix(E) 5 | % [A] = adjacency_matrix(F) 6 | % [A] = adjacency_matrix(T) 7 | % 8 | % Inputs: 9 | % E #E by 2 edges list 10 | % or 11 | % F #F by 3 triangle list 12 | % or 13 | % T #F by 4 tet list 14 | % Outputs: 15 | % A #V by #V adjacency matrix (#V = max(E(:))) 16 | % 17 | % See also: facet_adjacency_matrix 18 | % 19 | 20 | if size(E,2)>2 21 | F = E; 22 | E = edges(F); 23 | end 24 | 25 | A = sparse([E(:,1) E(:,2)],[E(:,2) E(:,1)],1); 26 | end 27 | -------------------------------------------------------------------------------- /mesh/avgedge.m: -------------------------------------------------------------------------------- 1 | function [ b ] = avgedge(V,F) 2 | % AVGEDGE Compute the average of every edge in the mesh 3 | % 4 | % [ b ] = avgedge(V,F) 5 | % 6 | % Inputs: 7 | % V #V x 3 matrix of vertex coordinates 8 | % F #F x #simplex size list of simplex indices 9 | % Outputs: 10 | % b average edge length 11 | % 12 | % Note: boundary edges are weighted half as much as internal edges 13 | % 14 | % Copyright 2011, Alec Jacobson (jacobson@inf.ethz.ch), and Daniele Panozzo 15 | % 16 | 17 | 18 | % works on anything edges.m can handle 19 | E = edges(F); 20 | B = normrow(V(E(:,1),:)-V(E(:,2),:)); 21 | 22 | b = mean(B); 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /mesh/axisangle2quat.m: -------------------------------------------------------------------------------- 1 | function Q = axisangle2quat(W,TH) 2 | % AXISANGLE2QUAT Convert axis angle representation of rotation to quaternion 3 | % 4 | % Q = axisangle2quat(W,TH) 5 | % 6 | % Inputs: 7 | % W list of axes, #rotations by 3 8 | % TH list of angles, #rotations by 1 9 | % Outputs: 10 | % Q list of rotations stored as quaternions, one for each control 11 | % #rotations by 4 (1,i,j,k) 12 | % 13 | % Copyright 2011, Alec Jacobson (jacobson@inf.ethz.ch) 14 | % 15 | % 16 | 17 | % See: 18 | % http://en.wikipedia.org/wiki/Axis-angle_representation#Unit_Quaternions 19 | Q = [cos(TH/2) W.*repmat(sin(TH/2),1,3)]; 20 | Q = Q./repmat(sqrt(sum(Q.^2,2)),1,4); 21 | end 22 | -------------------------------------------------------------------------------- /mesh/barycenter.m: -------------------------------------------------------------------------------- 1 | function [ B ] = barycenter(V, F) 2 | % BARYCENTER Compute the barycenter of every triangle 3 | % 4 | % B = barycenter(V,F) 5 | % 6 | % Inputs: 7 | % V #V x dim matrix of vertex coordinates 8 | % F #F x simplex_size matrix of indices of triangle corners 9 | % Output: 10 | % B a #F x dim matrix of 3d vertices 11 | % 12 | % See also: quadrature_points 13 | % 14 | 15 | B = zeros(size(F,1),size(V,2)); 16 | for ii = 1:size(F,2) 17 | B = B + 1/size(F,2) * V(F(:,ii),:); 18 | end 19 | 20 | end 21 | 22 | -------------------------------------------------------------------------------- /mesh/beach_ball.m: -------------------------------------------------------------------------------- 1 | function [V,F,C] = beach_ball(long_div_6) 2 | % BEACH_BALL Generate a beach ball mesh with color 3 | % 4 | % [V,F,C] = beach_ball(long_div_6) 5 | % 6 | % Input: 7 | % long_div_6 number of longitude edges divided by 6 8 | % Output: 9 | % V #V by 3 list of vertex positions 10 | % F #F by 3 list of triangle indices into rows of V 11 | % C #F by 3 list of rgb colors 12 | % 13 | long = long_div_6*6; 14 | [X,Y,Z] = sphere(long); 15 | [F,V] = surf2patch(X,Y,Z,'triangles'); 16 | BC = barycenter(V,F); 17 | stripes = ceil(6*(atan2(BC(:,2),BC(:,1))/(2*pi)+0.5)); 18 | top = abs(BC(:,3))>0.9772; 19 | CM = cbrewer('Set1',6); 20 | C = CM(stripes,:); 21 | C(top,:) = 1; 22 | [V,~,J] = remove_duplicate_vertices(V,eps); 23 | F = J(F); 24 | I = (F(:,2)~=F(:,3))&(F(:,3)~=F(:,1))&(F(:,1)~=F(:,2)); 25 | F = F(I,:); 26 | C = C(I,:); 27 | 28 | end 29 | -------------------------------------------------------------------------------- /mesh/bernstein_eval.m: -------------------------------------------------------------------------------- 1 | function B = bernstein_eval(i,n,u) 2 | % BERNSTERIN_EVAL evaluate a Bernstein polynomial. B_i,n(u) 3 | % 4 | % B = bernstein_eval(i,n,u) 5 | % 6 | % Inputs: 7 | % i #i scalar index of polynomial 8 | % n scalar order of polynomial 9 | % u #u evaluation points 10 | % Outputs: 11 | % B #u by #i values 12 | % 13 | u = reshape(u,numel(u),1); 14 | i = reshape(i,1,numel(i)); 15 | nck = factorial(n)./(factorial(i).*factorial(n-(i))); 16 | B = nck .* u.^i .* (1-u).^(n-i); 17 | end 18 | -------------------------------------------------------------------------------- /mesh/bone_parents.m: -------------------------------------------------------------------------------- 1 | function P = bone_parents(BE) 2 | % BONE_PARENTS Find parents in bone 3 | % 4 | % P = bone_parents(BE) 5 | % 6 | % Inputs: 7 | % BE #BE by 2 list of **directed** bone edge indices 8 | % Outputs: 9 | % P #BE list of parent indices into BE (0 means root) 10 | % 11 | % 12 | 13 | %BE = sortrows(BE); 14 | % 0 if not dest otherwise index in list 15 | index_map = zeros(max(BE(:)),1); 16 | index_map(BE(:,2)) = 1:size(BE,1); 17 | roots = setdiff(BE(:,1),BE(:,2)); 18 | % add roots to index map 19 | index_map(roots) = 0;%size(BE,1)+(1:numel(roots)); 20 | % parents after adding roots 21 | P = index_map(BE(:,1)); 22 | end 23 | -------------------------------------------------------------------------------- /mesh/box_each_element.m: -------------------------------------------------------------------------------- 1 | function [B1,B2] = box_each_element(V,F) 2 | % BOX_EACH_ELEMENT 3 | % 4 | % [B1,B2] = box_each_element(V,F) 5 | % 6 | % Inputs: 7 | % V by dim list of mesh vertex positions 8 | % F by ss list of simplices indexing rows of V 9 | % Outputs: 10 | % B1 by dim list of min corners of boxes 11 | % B2 by dim list of max corners of boxes 12 | % 13 | % corners of Axis-aligned boxes containing each element 14 | [B1,B2] = bounds(reshape(V(F,:)',size(V,2),[],size(F,2)),3); 15 | B1 = B1'; 16 | B2 = B2'; 17 | 18 | end 19 | -------------------------------------------------------------------------------- /mesh/catOBJs.m: -------------------------------------------------------------------------------- 1 | function catOBJs(input_files, output_file) 2 | % Concatenate meshes obj files into one mesh 3 | % 4 | % catOBJs(input_files, output_file) 5 | % 6 | % Inputs: 7 | % input_files cell of paths to input files 8 | % Output: 9 | % output_file path to output OBJ 10 | % 11 | [V,F] = load_mesh(input_files{1}); 12 | for i = 2:numel(input_files) 13 | [Vi,Fi] = load_mesh(input_files{i}); 14 | [V, F] = cat_meshes(V,F,Vi,Fi); 15 | end 16 | writeOBJ(output_file,V,F); 17 | end 18 | -------------------------------------------------------------------------------- /mesh/conncomp.m: -------------------------------------------------------------------------------- 1 | function [S,C] = conncomp(G) 2 | % CONNCOMP Drop in replacement for graphconncomp.m from the bioinformatics 3 | % toobox. G is an n by n adjacency matrix, then this identifies the S 4 | % connected components C. This is also an order of magnitude faster. 5 | % 6 | % [S,C] = conncomp(G) 7 | % 8 | % Inputs: 9 | % G n by n adjacency matrix, G(i,j) = G(j,i) ≠ 0 implies ij are connected. 10 | % Outputs: 11 | % S scalar number of connected components 12 | % C 13 | 14 | % Transpose to match graphconncomp 15 | G = G'; 16 | 17 | A = G+speye(size(G)); 18 | [p,~,r] = dmperm(A); 19 | S = numel(r)-1; 20 | C = cumsum(full(sparse(1,r(1:end-1),1,1,size(G,1)))); 21 | C(p) = C; 22 | end 23 | -------------------------------------------------------------------------------- /mesh/connected_components.m: -------------------------------------------------------------------------------- 1 | function [C,CF] = connected_components(F) 2 | % CONNECTED_COMPONENTS Determine the connected components of a mesh described 3 | % by the simplex list F. Components are determined with respect to the edges of 4 | % the mesh. That is, a single component may contain non-manifold edges and 5 | % vertices. 6 | % 7 | % C = connected_components(F) 8 | % 9 | % Inputs: 10 | % F #F by simplex-size list of simplices 11 | % Outputs: 12 | % C #V list of ids for each CC 13 | % CF #F list of ids for each CC 14 | % 15 | % Examples: 16 | % trisurf(F,V(:,1),V(:,2),V(:,3), ... 17 | % connected_components([F;repmat(size(V,1),1,3)])); 18 | 19 | % build adjacency list 20 | A = adjacency_matrix(F); 21 | [~,C] = conncomp(A); 22 | if nargout > 1 23 | CF = C(F(:,1)); 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /mesh/create_irregular_grid_with_min_angle.m: -------------------------------------------------------------------------------- 1 | function [UV,F, res, edge_norms] = ... 2 | create_irregular_grid_with_min_angle( ... 3 | xRes, yRes, n, xWrap, yWrap, min_angle, ... 4 | no_interior, dart_threshold) 5 | % Deprecated. 6 | % 7 | % See also: create_irregular_grid 8 | 9 | warning('Deprecated. Call create_irregular_grid directly'); 10 | [UV,F, res, edge_norms] = create_irregular_grid( ... 11 | xRes,yRes, ... 12 | 'NumDarts',n,'xWrap',xWrap,'yWrap',yWrap, ... 13 | 'MinAngle',min_angle,'NoInterior',no_interior, ... 14 | 'DartThreshold',dart_threshold); 15 | end 16 | -------------------------------------------------------------------------------- /mesh/cubic_eval.m: -------------------------------------------------------------------------------- 1 | function P = cubic_eval(C,t) 2 | % CUBIC_EVAL Evaluate a cubic Bezier curve. 3 | % 4 | % P = cubic_eval(C,t); 5 | % 6 | % Inputs: 7 | % C 4 by dim list of control points 8 | % t #t list of evaluation parameters 9 | % Outputs: 10 | % P #t by dim list of evaluated points 11 | % 12 | % See also: readSVG_cubics, cubic_split 13 | % 14 | t = reshape(t,numel(t),1); 15 | %B = bernstein_eval([0 1 2 3],3,t); 16 | %P = B*C; 17 | P = ... 18 | 1*(1-t).^3.*t.^0.*C(1,:) + ... 19 | 3*(1-t).^2.*t.^1.*C(2,:) + ... 20 | 3*(1-t).^1.*t.^2.*C(3,:) + ... 21 | 1*(1-t).^0.*t.^3.*C(4,:); 22 | end 23 | -------------------------------------------------------------------------------- /mesh/cubic_flat_eval.m: -------------------------------------------------------------------------------- 1 | function [P,T] = cubic_flat_eval(C,tol) 2 | % CUBIC_FLAT_EVAL Recursively subdivide a cubic Bezier curve until each 3 | % segment spans a region of the curve that is locally flat up to a given 4 | % tolerance (i.e., this computes an adaptive refinement). 5 | % 6 | % [P,T] = cubic_flat_eval(C,tol) 7 | % 8 | % Inputs: 9 | % C 4 by dim list of control points 10 | % Outputs: 11 | % P #P by dim list of evaluated points 12 | % T #T list of corresponding parameter values 13 | % 14 | % See also: cubic_eval, cubic_is_flat, cubic_split 15 | % 16 | if cubic_is_flat(C,tol) 17 | P = C([1 4],:); 18 | T = [0;1]; 19 | else 20 | [C1,C2] = cubic_split(C,0.5); 21 | [P1,T1] = cubic_flat_eval(C1,tol); 22 | [P2,T2] = cubic_flat_eval(C2,tol); 23 | P = [P1;P2(2:end,:)]; 24 | T = [T1*0.5;0.5+0.5*T2(2:end)]; 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /mesh/cubic_split.m: -------------------------------------------------------------------------------- 1 | function [C1,C2] = cubic_split(C,t) 2 | % CUBIC_SPLIT Split a cubic Bezier curve at parameter t, producing a left and 3 | % right half. 4 | % 5 | % [C1,C2] = cubic_split(C,t) 6 | % 7 | % Inputs: 8 | % C #4 by dim list of cubic Bézier control points 9 | % t parameter in [0,1] to split along 10 | % Outputs: 11 | % C1 #4 by dim list of cubic Bézier control points of first half 12 | % C2 #4 by dim list of cubic Bézier control points of second half 13 | % 14 | % See also: cubic_eval 15 | % 16 | C12 = (C(2,:)-C(1,:)).*t + C(1,:); 17 | C23 = (C(3,:)-C(2,:)).*t + C(2,:); 18 | C34 = (C(4,:)-C(3,:)).*t + C(3,:); 19 | C123 = (C23-C12).*t+C12; 20 | C234 = (C34-C23).*t+C23; 21 | C1234 = (C234-C123).*t+C123; 22 | C1 = [C(1,:);C12;C123;C1234]; 23 | C2 = [C1234;C234;C34;C(4,:)]; 24 | end 25 | -------------------------------------------------------------------------------- /mesh/cubic_tangent.m: -------------------------------------------------------------------------------- 1 | function T = cubic_tangent(C,t) 2 | % T = cubic_tangent(C,t) 3 | % 4 | % Inputs: 5 | % C 4 by dim list of control points 6 | % t #t list of parameter values 7 | % Outputs: 8 | % T #t by dim list of tangent vectors 9 | t = reshape(t,numel(t),1); 10 | T = ... 11 | 3*(1-t).^2.*t.^0.*(C(2,:)-C(1,:)) + ... 12 | 6*(1-t).^1.*t.^1.*(C(3,:)-C(2,:)) + ... 13 | 3*(1-t).^0.*t.^2.*(C(4,:)-C(3,:)); 14 | end 15 | -------------------------------------------------------------------------------- /mesh/deform_skeleton.m: -------------------------------------------------------------------------------- 1 | function [CT,BET] = deform_skeleton(C,BE,P,dQ) 2 | % DEFORM_SKELETON Deform a skeleton (C,BE,P) by relative rotations dQ 3 | % 4 | % Inputs: 5 | % C #C by dim list of joint positions 6 | % BE #BE by 2 list of bone edges 7 | % P #BE list of bone parents 8 | % dQ #BE by 4 list of quaternion relative rotations 9 | % Outputs: 10 | % CT #BE*2 by dim list of deformed bone endpoints 11 | % BET #BE by 2 list of edge indices into CT 12 | % 13 | 14 | % number of bones 15 | m = size(BE,1); 16 | [Q,T] = forward_kinematics(C,BE,P,dQ); 17 | % Compute a deformed version of the skeleton 18 | CT = C(BE,:); 19 | BET = [1:m;m+(1:m)]'; 20 | for b = 1:m 21 | for s = 0:1 22 | CT(b+s*m,:) = quatrotate(Q(b,:),CT(b+s*m,:))+T(b,:); 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /mesh/df_query.m: -------------------------------------------------------------------------------- 1 | function [id,d] = df_query( DF, p) 2 | % DF_QUERY Use the spatial index build with df_build to provide approximate NN 3 | % and distance from the NN. 4 | % 5 | % [id,d] = df_query(DF,p) 6 | % 7 | % Input: 8 | % DF output of df_build 9 | % p query point 10 | % Output: 11 | % id index of the point closer to p (approximate) 12 | % d distance from the point closer to p (approximate) 13 | 14 | p = p-DF.MIN; 15 | p = p./DF.S; 16 | p = round(p)+1; 17 | 18 | p(p<1) = 1; 19 | p(p>DF.C') = DF.C(p>DF.C'); 20 | 21 | id = DF.N(p(1),p(2),p(3)); 22 | d = DF.D(p(1),p(2),p(3)); 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /mesh/discrete_gaussian_curvature.m: -------------------------------------------------------------------------------- 1 | function k = discrete_gaussian_curvature(V,F) 2 | % DISCRETE_GAUSSIAN_CURVATURE Compute discrete gaussian curvature according 3 | % to (9) in "Discrete Differential-Geometry Operators for Triangulated 4 | % 2-Manifolds" [Meyer et al. 02] but without the inverse area term. 5 | % 6 | % k = discrete_gaussian_curvature(V,F) 7 | % 8 | % Inputs: 9 | % V #V by 3 list of vertex positions 10 | % F #F by 3 list of face indies 11 | % Outputs: 12 | % k #V by 1 list of discrete gaussian curvature values 13 | % 14 | 15 | %K_G(x_i) = (2π - ∑θj) 16 | %ks = 2*pi - sparse(F,1,internalangles(V,F),size(V,1),1); 17 | % slightly faster 18 | vec = @(X) X(:); 19 | k = 2*pi - accumarray(vec(F),vec(internalangles(V,F)),[size(V,1) 1],[],0); 20 | b = unique(outline(F)); 21 | k(b) = k(b)-pi; 22 | 23 | 24 | 25 | end 26 | -------------------------------------------------------------------------------- /mesh/div3.m: -------------------------------------------------------------------------------- 1 | function [D] = div3(V,T) 2 | % DIV3 Compute the discrete divergence operator 3 | % 4 | % D = div(V,T) 5 | % 6 | % Inputs: 7 | % V #vertices by dim list of mesh vertex positions 8 | % T #elements by 3 list of mesh tet indices 9 | % Outputs: 10 | % D #vertices by #elements*3 divergence operator 11 | % 12 | 13 | warning('Deprecated. Call grad directly.'); 14 | D = div(V,T); 15 | 16 | %G = grad3(V,T); 17 | %vol = volume(V,T); 18 | %% Off by a factor 2? 19 | %D = -G'*repdiag(diag(sparse(vol)),3); 20 | end 21 | 22 | -------------------------------------------------------------------------------- /mesh/div_intrinsic.m: -------------------------------------------------------------------------------- 1 | function D = div_intrinsic(l,F) 2 | % DIV_INTRINSIC Construct an intrinsic divergence operator. 3 | % 4 | % Inputs: 5 | % l #F by 3 list of edge lengths 6 | % F #F by 3 list of triangle indices into some vertex list V 7 | % Outputs: 8 | % G #V by #F*2 divergence matrix. 9 | % 10 | % See also: grad_intrinsic 11 | % 12 | 13 | G = grad_intrinsic(l,F); 14 | TA = repdiag(sparse(diag(doublearea_intrinsic(l))),2); 15 | D = -0.25*G'*TA; 16 | 17 | end 18 | 19 | -------------------------------------------------------------------------------- /mesh/divmatrix.m: -------------------------------------------------------------------------------- 1 | function D = divmatrix(V,F) 2 | % D = gradmatrix(V,F) 3 | % V: #V x 3 matrix of vertex coordinates 4 | % F: 3 x #F matrix of indices of triangle corners 5 | % returns #V x #V matrix of grad weights 6 | warning('Obsolete, use `div` instead'); 7 | 8 | FT = F'; 9 | E = ... 10 | unique( ... 11 | sort([FT(:,1) FT(:,2); FT(:,2) FT(:,3); FT(:,3) FT(:,1)]')', ... 12 | 'rows'); 13 | norms = sqrt(sum((V(E(:,1),:) - V(E(:,2),:)).^2,2)); 14 | i = [E(:,1) E(:,2) E(:,1) E(:,2)]; 15 | j = [E(:,2) E(:,1) E(:,1) E(:,2)]; 16 | v = [norms norms -norms -norms] ; 17 | % for repeated indices (i,j) sparse automatically sums up elements, as we want 18 | D = sparse(i,j,v,size(V,1),size(V,1)); 19 | end 20 | -------------------------------------------------------------------------------- /mesh/draw_boxes.m: -------------------------------------------------------------------------------- 1 | function p = draw_boxes(BN,BX,varargin) 2 | % DRAW_BOXES Draw a list of boxes given minimum corners and maximum corners 3 | % 4 | % p = draw_boxes(BN,BX) 5 | % 6 | % Inputs: 7 | % BN #B by dim list of minimum corners 8 | % BX #B by dim list of maximum corners 9 | % Outputs: 10 | % p plot handle 11 | % 12 | dim = size(BN,2); 13 | m = size(BN,1); 14 | switch dim 15 | case 3 16 | V = []; 17 | for x = 0:1 18 | for y = 0:1 19 | for z = 0:1 20 | V = [V;BN + bsxfun(@times,BX-BN,[x y z])]; 21 | end 22 | end 23 | end 24 | F = [3 4 2 1 25 | 1 2 6 5 26 | 8 6 2 4 27 | 4 8 7 3 28 | 5 7 3 1 29 | 5 7 8 6 30 | ]; 31 | F = reshape(bsxfun(@plus,(F(:)-1)*m,1:m)',6*m,4); 32 | t = trisurf(F,V(:,1),V(:,2),V(:,3),varargin{:}); 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /mesh/eat_comments.m: -------------------------------------------------------------------------------- 1 | function line = eat_comments(file_pointer,comment_symbol) 2 | % EAT_COMMENTS use fscanf to eat lines starting with a comment_symbol 3 | % 4 | % line = eat_comments(file_pointer,comment_symbol) 5 | % 6 | % Inputs: 7 | % file_pointer returned from fopen 8 | % comment_symbol symbol of comment, e.g. '#' 9 | % Output: 10 | % line next line that does not start with a comment_symbol 11 | % (file_pointer is correspondingly adjusted) 12 | % 13 | assert(size(comment_symbol,2) == 1); 14 | 15 | while(true) 16 | % read next whole line 17 | line = fscanf(file_pointer,' %[^\n]s'); 18 | if(size(line,2) == 0) 19 | break; 20 | elseif(line(1,1) ~= comment_symbol) 21 | break; 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /mesh/ellipse_to_spline.m: -------------------------------------------------------------------------------- 1 | function [Pi,Ci] = ellipse_to_spline(cx,cy,rx,ry) 2 | % special fraction 3 | s = 1193/2160; 4 | Pi = [1,0;1,s;s,1;0,1;-s,1;-1,s;-1,0;-1,-s;-s,-1;0,-1;s,-1;1,-s;1,0]; 5 | % This repeats the first point rather than closing. parse_path may be counting 6 | % on this. 7 | Ci = [1,2,3,4;4,5,6,7;7,8,9,10;10,11,12,13]; 8 | Pi = Pi.*[rx ry]+[cx cy]; 9 | end 10 | 11 | -------------------------------------------------------------------------------- /mesh/equilateral_tiling.m: -------------------------------------------------------------------------------- 1 | function [V,F] = equilateral_tiling(x); 2 | % EQUILATERAL_TILING Create a tiling of the unit hexagon using equilateral 3 | % triangles. 4 | % 5 | % Inputs: 6 | % x number of edges on each side of the hexgon (x=1 would produce 6 7 | % triangles) 8 | % Outputs: 9 | % V #V by 2 list of vertex positions 10 | % F #F by 3 list of triangle indices into V 11 | % 12 | [V,F] = create_regular_grid(2*x+1,2*x+1); 13 | V = sqrt(8)*bsxfun(@minus,V,[0.5 0.5])*sqrt(2)/2*[-1/sqrt(3) -1;1/sqrt(3) -1]; 14 | % Outside of hexagon 15 | out = find(V(:,2)>V(x+1,2)+1/(2*x+1)*0.25 | V(:,2)<-V(x+1,2)-1/(2*x+1)*0.25); 16 | F = F(~any(ismember(F,out),2),:); 17 | [V,J] = remove_unreferenced(V,F); 18 | F = J(F); 19 | end 20 | -------------------------------------------------------------------------------- /mesh/expand_axis.m: -------------------------------------------------------------------------------- 1 | function expand_axis(f,ah) 2 | % EXPAND_AXIS Expand axis by a scale factor f 3 | % 4 | % expand_axis(f); 5 | % expand_axis(f,ah) 6 | % 7 | % Inputs: 8 | % f factor to scale axis by 9 | % Optional: 10 | % ah handle to axis 11 | % 12 | if nargin<2 13 | ah =gca; 14 | end 15 | a = reshape(axis(ah),2,[]); 16 | axis(ah,reshape(bsxfun(@plus,bsxfun(@minus,a,mean(a))*f,mean(a)),1,[])); 17 | end 18 | -------------------------------------------------------------------------------- /mesh/falpha.m: -------------------------------------------------------------------------------- 1 | function str = falpha(alpha,ealpha) 2 | % FPHONG Simply returns: 3 | % struct('FaceAlpha',alpha,'EdgeAlpha',alpha); 4 | % 5 | % str = fphong() 6 | % 7 | if nargin < 1 8 | alpha = 0.6; 9 | end 10 | if nargin < 2 11 | ealpha = alpha; 12 | end 13 | str = struct('FaceAlpha',alpha,'EdgeAlpha',ealpha); 14 | end 15 | 16 | -------------------------------------------------------------------------------- /mesh/false_barycentric.m: -------------------------------------------------------------------------------- 1 | function [VV,FF,I,J] = false_barycentric(V,F) 2 | % FALSE_BARYCENTRIC Conduct false barycentric subdivision on (V,F) 3 | % 4 | % [VV,FF,I,J] = false_barycentric(V,F) 5 | % 6 | % Inputs: 7 | % V #V by dim list of vertex positions 8 | % F #F by 3 list of triangle indices into rows of V 9 | % Outputs: 10 | % VV #V+#F by dim list of vertex positions 11 | % FF 3*#F by 3 list of triangle indices into rows of VV 12 | % I #FF list of indices into F 13 | % J #F list of indices into F of added midpoints 14 | % 15 | % 16 | % See also: dual_subdivide 17 | % 18 | n = size(V,1); 19 | VV = [V;barycenter(V,F)]; 20 | K = n + (1:size(F,1))'; 21 | FF = [F(:,[2 3]) K;F(:,[3 1]) K;F(:,[1 2]) K]; 22 | I = repmat(1:size(F,1),1,3)'; 23 | J = F(:); 24 | end 25 | -------------------------------------------------------------------------------- /mesh/fd_plot_stencil.m: -------------------------------------------------------------------------------- 1 | function [s,t] = fd_plot_stencil(side,V) 2 | % Visualization of the stencil (non-zeros in a row V of a matrix). 3 | % 4 | % [s,t] = fd_plot_stencil(side,V) 5 | % 6 | % Inputs: 7 | % side [h w] 8 | % V h*w by 1 row of a sparse matrix 9 | % Outputs: 10 | % s handle to surf plot 11 | % t handle to text plot 12 | % 13 | % Example: 14 | % Q = fd_laplacian([5 5]); 15 | % fd_plot_stencil([5 5],Q(ceil(end/2),:)); 16 | % 17 | h = side(1); 18 | w = side(2); 19 | [X,Y] = meshgrid((1:w+1)-0.5,(1:h+1)-0.5); 20 | s = surf(X,Y,0*X,reshape(V,side),'EdgeColor','k'); 21 | [X,Y] = meshgrid((1:w),(1:h)); 22 | t = text(X(:),Y(:),num2str(V(:),'%0.1f'), ... 23 | 'HorizontalAlignment','center', ... 24 | 'FontSize',20, ... 25 | 'BackgroundColor',[0.7 0.7 0.7]); 26 | view(2); 27 | axis equal; 28 | end 29 | 30 | -------------------------------------------------------------------------------- /mesh/fibonacci_sphere_sampling.m: -------------------------------------------------------------------------------- 1 | function Q = fibonacci_sphere_sampling(P,phi) 2 | % FIBONACCI_SPHERE_SAMPLING Generate P points on the unit sphere using a 3 | % fibonacci spiral. 4 | % 5 | % Q = fibonacci_sphere_sampling(P,phi) 6 | % 7 | % Inputs: 8 | % P number of points to generate 9 | % phi golden ratio {(1+sqrt(5))/2} 10 | % Outputs: 11 | % Q P by 3 list of points on the unit sphere 12 | % 13 | if nargin<2 14 | phi = (1+sqrt(5))/2; 15 | end 16 | % https://arxiv.org/pdf/0912.4540.pdf 17 | % P = 2*N+1 18 | N = (P-1)/2; 19 | i = linspace(-N,N,P)'; 20 | sin_lat = 2.*i./P; 21 | cos_lat = sqrt(1-sin_lat.^2); 22 | lon = 2.*pi.*i./phi^2; 23 | Q = [cos_lat.*cos(lon) cos_lat.*sin(lon) sin_lat]; 24 | end 25 | -------------------------------------------------------------------------------- /mesh/fit_rotation.m: -------------------------------------------------------------------------------- 1 | function R = fit_rotation(S) 2 | % FIT_ROTATION find rotation for a given covariance matrix 3 | % 4 | % R = fit_rotation(S) 5 | % 6 | % Inputs: 7 | % S n by n covariance matrix 8 | % Outputs: 9 | % R n by n rotation matrix closest to S 10 | % 11 | 12 | % svd 13 | [su,ss,sv]=svd(S); 14 | R = sv*su'; 15 | % if reflection then flip last column 16 | if( det(R) < 0 ) 17 | su(:,end) = -su(:,end); 18 | R = sv*su'; 19 | end 20 | % should definitely be rotation now 21 | %assert( det(R) >= 0 ); 22 | end 23 | -------------------------------------------------------------------------------- /mesh/flipped_tet_orders.m: -------------------------------------------------------------------------------- 1 | function flipped_order = flipped_tet_orders() 2 | % FLIPPED_TET_ORDERS 3 | % 4 | % flipped_order = flipped_tet_orders() 5 | % 6 | % Outputs: 7 | % flipped_order 20 by 4 list of tet index orders that are flipped inside 8 | % out (negative volume) 9 | % 10 | flipped_order = [ ... 11 | 4 3 1 2 12 | 4 2 3 1 13 | 4 1 2 3 14 | 3 4 2 1 15 | 3 2 1 4 16 | 3 1 4 2 17 | 2 4 1 3 18 | 2 3 4 1 19 | 2 1 3 4 20 | 1 4 3 2 21 | 1 3 2 4 22 | 1 2 4 3]; 23 | end 24 | -------------------------------------------------------------------------------- /mesh/fphong.m: -------------------------------------------------------------------------------- 1 | function str = fphong() 2 | % FPHONG Simply returns: 3 | % struct('FaceColor','interp','FaceLighting','phong'); 4 | % 5 | % str = fphong() 6 | % 7 | % Example: 8 | % set(tsurf(F,V),fphong); 9 | % 10 | str = struct('FaceColor','interp','FaceLighting','phong'); 11 | end 12 | -------------------------------------------------------------------------------- /mesh/fsoft.m: -------------------------------------------------------------------------------- 1 | function str = fsoft() 2 | % FSOFT Simply returns: 3 | % struct('SpecularStrength',0.2,'DiffuseStrength',0.2,'AmbientStrength',0.8); 4 | % 5 | % str = fsoft() 6 | % 7 | % Example: 8 | % set(tsurf(F,V),fsoft); 9 | % 10 | str = struct('SpecularStrength',0.2,'DiffuseStrength',0.2,'AmbientStrength',0.8); 11 | end 12 | 13 | -------------------------------------------------------------------------------- /mesh/get_pencil_curves.m: -------------------------------------------------------------------------------- 1 | function [V,E,cid] = get_pencil_curves(tol) 2 | % GET_PENCIL_CURVES Get many pencil curves 3 | % 4 | % [V,E,cid] = get_pencil_curves(tol) 5 | % 6 | % Inputs: 7 | % tol dpsimplify tolerance 8 | % Outputs: 9 | % V #V by 2 list of vertices 10 | % E #E by 2 list of edge indices into V 11 | % cid list of indices into V indicating last vertex in each curve 12 | % 13 | % See also: get_pencil_curve 14 | % 15 | V = []; 16 | E = []; 17 | cid = []; 18 | while true 19 | hold on; 20 | V1 = get_pencil_curve(); 21 | hold off; 22 | V1 = dpsimplify(V1,tol); 23 | E1 = [1:size(V1,1)-1;2:size(V1,1)]'; 24 | E = [E;size(V,1)+E1]; 25 | V = [V;V1]; 26 | cid = [cid;size(V,1)]; 27 | if input('Continue? y/n','s') == 'n' 28 | return 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /mesh/grad3.m: -------------------------------------------------------------------------------- 1 | function G = grad3(V,T) 2 | % GRAD3 Compute the numerical gradient operator for tet meshes in 3d 3 | % 4 | % G = grad(V,F) 5 | % 6 | % Inputs: 7 | % V #vertices by dim list of mesh vertex positions 8 | % T #elements by 3 list of mesh tet indices 9 | % Outputs: 10 | % G #elements*dim by #V Gradient operator 11 | % 12 | % Example: 13 | % L = cotmatrix(V,T); 14 | % G = grad3(V,T); 15 | % vol = volume(V,T); 16 | % GMG = -G'*repdiag(diag(sparse(vol)),3)*G; 17 | % 18 | 19 | warning('Deprecated. Call grad directly.'); 20 | G = grad(V,T); 21 | end 22 | -------------------------------------------------------------------------------- /mesh/grad_intrinsic.m: -------------------------------------------------------------------------------- 1 | function G = grad_intrinsic(l,F) 2 | % GRAD_INTRINSIC Construct an intrinsic gradient operator. 3 | % 4 | % Inputs: 5 | % l #F by 3 list of edge lengths 6 | % F #F by 3 list of triangle indices into some vertex list V 7 | % Outputs: 8 | % G #F*2 by #V gradient matrix: G=[Gx;Gy] where x runs along the 23 edge and 9 | % y runs in the counter-clockwise 90° rotation. 10 | % 11 | 12 | x = (l(:,2).^2-l(:,1).^2-l(:,3).^2)./(-2.*l(:,1)); 13 | y = sqrt(l(:,3).^2 - x.^2); 14 | n = max(F(:)); 15 | m = size(F,1); 16 | Z = zeros(m,1); 17 | V2 = [x y;Z Z;l(:,1) Z]; 18 | F2 = reshape(1:3*m,m,3); 19 | G2 = grad(V2,F2); 20 | P = sparse(F2,F,1,m*3,n); 21 | G = G2*P; 22 | 23 | end 24 | -------------------------------------------------------------------------------- /mesh/group_sum_matrix.m: -------------------------------------------------------------------------------- 1 | function A = group_sum_matrix(G,k) 2 | % GROUP_SUM_MATRIX Builds a matrix A such that A*V computes the sum of 3 | % vertices in each group specified by G 4 | % 5 | % A = group_sum_matrix(G,k) 6 | % 7 | % Inputs: 8 | % G #V list of group indices (1 to k) for each vertex, such that vertex i 9 | % is assigned to group G(i) 10 | % k #groups, default is max(G) 11 | % Outputs: 12 | % A #groups by #V sparse matrix such that A*V = group_sums 13 | % 14 | % See also: centroid_matrix 15 | 16 | 17 | % number of vertices 18 | n = numel(G); 19 | % number of groups 20 | if ~exist('k','var') 21 | k = max(G); 22 | end 23 | 24 | indices = 1:n; 25 | 26 | % builds A such that A(i,j) = 1 where i corresponds to group i and j 27 | % corresponds to vertex j 28 | A = sparse(G,indices,1,k,n); 29 | 30 | end 31 | -------------------------------------------------------------------------------- /mesh/harmonic.m: -------------------------------------------------------------------------------- 1 | % See kharmonic.m 2 | % 3 | % `harmonic` was stolen from gptoolbox by matlab's builtin double.harmonic in 4 | % R2014a. 5 | -------------------------------------------------------------------------------- /mesh/hcp_lattice.m: -------------------------------------------------------------------------------- 1 | function C = hcp_lattice(I,J,K) 2 | % HCP_LATTICE generate the center locations of a hexagonal close-packed 3 | % lattice of unit-radius spheres. 4 | % 5 | % Inputs: 6 | % I #I list of x-coordinate indices 7 | % J #I list of y-coordinate indices 8 | % K #I list of z-coordinate indices 9 | % Outputs: 10 | % C #I by 3 list of center locations 11 | % 12 | % Example: 13 | % [I,J,K] = meshgrid(0:9,0:9,0:9); 14 | % C = hcp_lattice(I(:),J(:),K(:)); 15 | % [SV,SF] = lloyd_sphere(300); 16 | % [V,F] = repmesh(SV,SF,C); 17 | i = I(:); 18 | j = J(:); 19 | k = K(:); 20 | % https://en.wikipedia.org/wiki/Close-packing_of_equal_spheres#Simple_hcp_lattice 21 | C = [2*i + mod(j+k,2), sqrt(3)*(j+1/3*mod(k,2)), 2*sqrt(6)/3*k]; 22 | end 23 | -------------------------------------------------------------------------------- /mesh/incenter.m: -------------------------------------------------------------------------------- 1 | function [I,B,R] = incenter(V,F) 2 | % INCENTER Compute the incenter of a triangle mesh 3 | % 4 | % I = incenter(V,F) 5 | % 6 | % Inputs: 7 | % V #V by 3 list of vertex positions 8 | % F #F by 3 list of triangle indices 9 | % Outputs: 10 | % I #F by 3 list of incenters 11 | % B #F by 3 list of barycentric coordinates of incenter 12 | % R #F by 1 list of inradii 13 | % 14 | % See also: barycenter, orthocenter, circumradius 15 | % 16 | 17 | l = edge_lengths(V,F); 18 | B = l./sum(l,2); 19 | 20 | if nargout >2 21 | A = doublearea(V,F); 22 | % perimeter 23 | S = sum(l,2); 24 | R = (A./S); 25 | end 26 | 27 | I = B(:,1).*V(F(:,1),:) + B(:,2).*V(F(:,2),:) + B(:,3).*V(F(:,3),:); 28 | end 29 | -------------------------------------------------------------------------------- /mesh/internalangles.m: -------------------------------------------------------------------------------- 1 | function [ A ] = internalangles( V, F) 2 | % INTERNALANGLES Compute internal angles per face (in degrees) 3 | % 4 | % A = internalangles(V,F) 5 | % 6 | % Inputs: 7 | % V #V x 3 matrix of vertex coordinates 8 | % F #F x 3 matrix of indices of triangle corners 9 | % Output: 10 | % A #F x 3 list of triples of triangle angles 11 | % 12 | i1 = F(:,1); i2 = F(:,2); i3 = F(:,3); 13 | 14 | s12 = normrow(V(i2,:) - V(i1,:)); 15 | s13 = normrow(V(i3,:) - V(i1,:)); 16 | s23 = normrow(V(i3,:) - V(i2,:)); 17 | 18 | l = [s23 s13 s12]; 19 | 20 | A = internalangles_intrinsic(l); 21 | 22 | end 23 | 24 | -------------------------------------------------------------------------------- /mesh/internalangles_intrinsic.m: -------------------------------------------------------------------------------- 1 | function [ A ] = internalangles_intrinsic(l) 2 | % INTERNALANGLES_INTRINSIC Compute internal angles per face (in degrees) using 3 | % edge lengths 4 | % 5 | % A = internalangles_intrinsic(l) 6 | % 7 | % Inputs: 8 | % l #F x 3 matrix of edge lengths 9 | % Output: 10 | % A #F x 3 list of triples of triangle angles 11 | % 12 | 13 | s23 = l(:,1); 14 | s31 = l(:,2); 15 | s12 = l(:,3); 16 | 17 | a23 = acos((s12.^2 + s31.^2 - s23.^2)./(2.*s12.*s31)); 18 | a31 = acos((s23.^2 + s12.^2 - s31.^2)./(2.*s23.*s12)); 19 | a12 = acos((s31.^2 + s23.^2 - s12.^2)./(2.*s31.*s23)); 20 | 21 | A = [a23 a31 a12]; 22 | 23 | end 24 | 25 | 26 | -------------------------------------------------------------------------------- /mesh/is_delaunay.m: -------------------------------------------------------------------------------- 1 | function [O1,O2] = is_delaunay(varargin) 2 | error('Call is_intrinsic_delaunay or is_extrinsic_delaunay directly'); 3 | end 4 | -------------------------------------------------------------------------------- /mesh/is_planar.m: -------------------------------------------------------------------------------- 1 | function [f,s] = is_planar(V,epsilon) 2 | % IS_PLANAR Return whether the 3D mesh is planar 3 | % 4 | % [f,s] = is_planar(V) 5 | % [f,s] = is_planar(V,epsilon) 6 | % 7 | % Inputs: 8 | % V #V x 3 matrix of vertex coordinates 9 | % epsilon optional parameter used as threshold for smallest eigen value of 10 | % pca, {1e-10} 11 | % Outputs: 12 | % f flag whether mesh is planar 13 | % s smallest principle component variance 14 | % 15 | % 16 | 17 | 18 | if ~exist('epsilon','var') 19 | epsilon = 1e-10; 20 | end 21 | 22 | 23 | if size(V,2) == 2 24 | f = true; 25 | s = 0; 26 | return; 27 | end 28 | 29 | % This seems to have changed during matlab. For large V this is 30 | % infeasible. 31 | [c,l] = pcacov(V); 32 | 33 | s = min(l); 34 | 35 | 36 | f = s < epsilon; 37 | 38 | end 39 | -------------------------------------------------------------------------------- /mesh/is_self_intersecting.m: -------------------------------------------------------------------------------- 1 | function flag = is_self_intersecting(V,O) 2 | % IS_SELF_INTERSECTING Determine if a set of edges in 2D has any intersections 3 | % 4 | % flag = is_self_intersecting(V,O) 5 | % 6 | % Inputs: 7 | % V #V by 2 list of vertex positions 8 | % O #O by 2 list of edge indices into rows of V 9 | % Outputs: 10 | % flag true iff some edge intersects another edge (not including shared 11 | % vertices) 12 | % 13 | 14 | [V,~,~,O] = remove_unreferenced(V,O); 15 | % This is doing strictly more work since it's constructing the intersections 16 | % but it's faster and more robust than segment_segment_squared_distance 17 | flag = size(triangulate(V,O,'Flags','-c'),1)~=size(V,1); 18 | end 19 | -------------------------------------------------------------------------------- /mesh/lapsmoothF.m: -------------------------------------------------------------------------------- 1 | function [S] = lapsmoothF(TT,S,a,it) 2 | % LAPSMOOTHF Laplacian smoothing for a scalar field defined on faces 3 | % 4 | % [S] = lapsmoothF(TT,S,a,it) 5 | % 6 | % Inputs: 7 | % TT triangle-triangle topology (use tt to compute it) 8 | % S scalar filed defined over faces, Fx1 9 | % a controls the smoothing strenght (0..1) 10 | % it number of iterations 11 | % Output: 12 | % S smoothed scalar field, Fx1 13 | 14 | for x = 1:it 15 | for i=1:size(TT,1) 16 | acc = 0; 17 | count = 0; 18 | for j=1:3 19 | if(TT(i,j) ~= -1) 20 | acc = acc + S(TT(i,j)); 21 | count = count + 1; 22 | end 23 | end 24 | S(i) = (1-a)*S(i) + ... 25 | (a * acc./count); 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /mesh/manifold_patches.m: -------------------------------------------------------------------------------- 1 | function [C,A,uE2F,uE] = manifold_patches(F) 2 | % MANIFOLD_PATCHES Compute connected components of facets connected by 3 | % manifold edges. 4 | % 5 | % [C,A,uE2F,uE] = manifold_patches(F) 6 | % 7 | % Known bugs: This will detect a moebius strip as a single patch (manifold, 8 | % non-orientable) and also non-manfiold, yet orientable patches. 9 | % 10 | % Q: Does this find exactly (manifold || orientable) patches? 11 | % 12 | % Inputs: 13 | % F #F by simplex-size list of facets 14 | % Outputs: 15 | % C #F list of component ids 16 | % A #F by #F adjacency matrix 17 | % 18 | 19 | % simplex size 20 | ss = size(F,2); 21 | assert(ss == 3 || ss == 2); 22 | 23 | [A,uE2F,uE] = facet_adjacency_matrix(F,'ManifoldOnly',true); 24 | % Connected components are patches 25 | [~,C] = conncomp(A); 26 | 27 | end 28 | -------------------------------------------------------------------------------- /mesh/massmatrix3.m: -------------------------------------------------------------------------------- 1 | function M = massmatrix3(V,T, type) 2 | % MASSMATRIX3 mass matrix for the mesh given by V and F 3 | % 4 | % M = massmatrix3(V,T, type) 5 | % 6 | % 7 | % Inputs: 8 | % V #V x 3 matrix of vertex coordinates 9 | % T #T x 4 matrix of indices of tetrahedral corners 10 | % type string containing type of mass matrix to compute 11 | % 'barycentric': diagonal lumped mass matrix obtained by summing 1/3 12 | % of volumes of surrounding tets 13 | % Not yet supported: 14 | % 'full': full mass matrix for p.w. linear fem 15 | % 'voronoi' 16 | % Output: 17 | % M #V x #V matrix of cot weights 18 | % 19 | % Copyright 2011, Alec Jacobson (jacobson@inf.ethz.ch) 20 | % 21 | % See also: massmatrix 22 | % 23 | warning('Deprecated. Call massmatrix directly'); 24 | M = massmatrix(V,T,type); 25 | end 26 | -------------------------------------------------------------------------------- /mesh/material_boundary_facets.m: -------------------------------------------------------------------------------- 1 | function E = material_boundary_facets(F,FI) 2 | % E = material_boundary_facets(F,FI) 3 | % 4 | % Inputs: 5 | % F #F by 3 list of triangle indices into rows of some V 6 | % FI #F list of material ids 7 | % Outputs: 8 | % E #E by 2 list of unique edge boundaries between elements with different 9 | % ids 10 | [uE,~,EMAP] = unique(sort([F(:,[2 3]);F(:,[3 1]);F(:,[1 2])],2),'rows'); 11 | uE2FI = sparse(EMAP,repmat(FI,3,1),1); 12 | E = uE(sum(uE2FI,2)==1 | sum(uE2FI>0,2)==2,:); 13 | end 14 | -------------------------------------------------------------------------------- /mesh/moveEV.m: -------------------------------------------------------------------------------- 1 | function S_V = moveEV(V, E, S_E) 2 | % MOVEEV Seems to give each vertex the average value across its incident 3 | % edges? 4 | % 5 | % S_V = moveEV(V, E, S_E) 6 | % 7 | % Inputs: 8 | % V #V by dim mesh vertex positions? 9 | % E #E by 2 list of edge indices? 10 | % S_E #E by 1 scalar values on edges? 11 | % Outputs: 12 | % S_V #V by 1 scalar vavlues on vertices? 13 | 14 | A = adjacency_matrix(E); 15 | num_neighbors = sum(A,2); 16 | 17 | S_V = zeros(size(V,1),1); 18 | S_V(E(:,1)) = S_V(E(:,1)) + S_E; 19 | S_V(E(:,2)) = S_V(E(:,2)) + S_E; 20 | 21 | S_V = 0.5* S_V ./ num_neighbors; 22 | 23 | end 24 | -------------------------------------------------------------------------------- /mesh/moveFV.m: -------------------------------------------------------------------------------- 1 | function [ SV ] = moveFV(V,F,S) 2 | % MOVEFV Move a scalar field defined on faces to vertices by averaging 3 | % 4 | % [ SV ] = moveFV(V,F,S) 5 | % 6 | % Input: 7 | % V,F mesh 8 | % S scalar field defined on faces, Fx1 9 | % 10 | % Output: 11 | % SV scalar field defined on vertices 12 | 13 | SV = zeros(size(V,1),size(S,2)); 14 | COUNT = zeros(size(V,1),1); 15 | 16 | for i=1:size(F,1) 17 | SV(F(i,:)',:) = SV(F(i,:)',:) + repmat(S(i,:),size(F,2),1); 18 | COUNT(F(i,:)') = COUNT(F(i,:)') + 1; 19 | end 20 | 21 | SV = SV ./ repmat(COUNT, 1, size(S,2)); 22 | 23 | end 24 | 25 | -------------------------------------------------------------------------------- /mesh/moveVF.m: -------------------------------------------------------------------------------- 1 | function [ SF ] = moveVF(F,S) 2 | % moveVF 3 | % Move a scalar field defined on vertices to faces by averaging 4 | % 5 | % Input: 6 | % V,F: mesh 7 | % S: scalar field defined on vertices, Vx1 8 | % 9 | % Output: 10 | % SF: scalar field defined on faces 11 | 12 | M = sparse(repmat((1:size(F,1))',3,1),[F(:,1),F(:,2),F(:,3)],1/3); 13 | SF = M*S; 14 | 15 | end 16 | 17 | -------------------------------------------------------------------------------- /mesh/nonmanifold_edges.m: -------------------------------------------------------------------------------- 1 | function [E,C] = nonmanifold_edges(F) 2 | % NONMANIFOLD_EDGES List of non-manifold edges 3 | % 4 | % Inputs: 5 | % F #F by dim=3 list of facet indices 6 | % Outputs: 7 | % E #E by 2 list of nonmanifold edges 8 | % C #E by 1 list of unsigned Counts (>2) 9 | % %pC #E by 1 list of positive Counts 10 | % %nC #E by 1 list of negative Counts 11 | % 12 | 13 | allE = [F(:,[2 3]); F(:,[3 1]); F(:,[1 2])]; 14 | sortallE = sort(allE,2); 15 | sC = sparse(sortallE(:,1),sortallE(:,2),(allE(:,1)2 | abs(sC)>1).* C); 20 | E = [EI EJ]; 21 | end 22 | -------------------------------------------------------------------------------- /mesh/octahedron.m: -------------------------------------------------------------------------------- 1 | function [V,F] = octahedron() 2 | % [V,F] = octahedron() 3 | % 4 | % Outputs: 5 | % V 6 by 3 list of mesh vertex positions 6 | % F 8 by 3 list of mesh face indices into rows of V 7 | V = [eye(3);-eye(3)]; 8 | F = [ 9 | 1 2 3 10 | 1 3 5 11 | 1 5 6 12 | 1 6 2 13 | 2 4 3 14 | 2 6 4 15 | 3 4 5 16 | 4 6 5]; 17 | end 18 | -------------------------------------------------------------------------------- /mesh/orthocenter.m: -------------------------------------------------------------------------------- 1 | function O = orthocenter(V,F) 2 | % ORTHOCENTER Compute the orthocenter of a triangle mesh 3 | % 4 | % O = orthocenter(V,F) 5 | % 6 | % Inputs: 7 | % V #V by 3 list of vertex positions 8 | % F #F by 3 list of triangle indices 9 | % Outputs: 10 | % O #F by 3 list of orthocenters 11 | % 12 | % See also: barycenter, incenter, circumradius 13 | % 14 | 15 | m = size(F,1); 16 | O = zeros(m,3); 17 | E = cat(3, ... 18 | V(F(:,3),:)-V(F(:,2),:), ... 19 | V(F(:,1),:)-V(F(:,3),:), ... 20 | V(F(:,2),:)-V(F(:,1),:)); 21 | N = normals(V,F); 22 | P = cross(E,repmat(N,[1 1 3]),2); 23 | P = P./sqrt(sum(P.^2,2)); 24 | 25 | [~,cosA] = internalangles(V,F); 26 | 27 | G = cat(3, ... 28 | cosA(:,2).*cosA(:,3), ... 29 | cosA(:,1).*cosA(:,3), ... 30 | cosA(:,1).*cosA(:,2)); 31 | O = sum(P.*G,3); 32 | 33 | 34 | end 35 | -------------------------------------------------------------------------------- /mesh/plot_directed_edges.m: -------------------------------------------------------------------------------- 1 | function varargout = plot_directed_edges(V,E,varargin) 2 | % PLOT_DIRECTED_EDGES Plot direct edges using quiver 3 | % 4 | % p = plot_directed_edges(V,E) 5 | % p = plot_directed_edges(V,E,LINESPEC,...) 6 | % 7 | % Inputs: 8 | % V #V by dim list of edge vertiecs 9 | % E #E by 2 list of edges 10 | % Outputs: 11 | % p plot handle 12 | % 13 | % See also: plot_edges 14 | % 15 | if isempty(E) 16 | return; 17 | end 18 | 19 | switch size(V,2) 20 | case 2 21 | q = quiver( ... 22 | V(E(:,1),1), ... 23 | V(E(:,1),2), ... 24 | V(E(:,2),1)-V(E(:,1),1), ... 25 | V(E(:,2),2)-V(E(:,1),2), ... 26 | 0, ... 27 | varargin{:}); 28 | otherwise 29 | error('Unsupported dimension: %d',size(V,2)); 30 | end 31 | 32 | if nargout >= 1 33 | varargout{1} = p; 34 | end 35 | 36 | end 37 | 38 | -------------------------------------------------------------------------------- /mesh/plt.m: -------------------------------------------------------------------------------- 1 | function p = plt(V,varargin) 2 | % PLT 3 | % 4 | % p = plt(V,varargin) 5 | % 6 | % Shorthand for: 7 | % p = plot(V(:,1),V(:,2), ... 8 | 9 | switch size(V,2) 10 | case 3 11 | pp = plot3(V(:,1),V(:,2),V(:,3),varargin{:}); 12 | case 2 13 | pp = plot(V(:,1),V(:,2),varargin{:}); 14 | end 15 | 16 | if nargout>0, p = pp; end 17 | end 18 | -------------------------------------------------------------------------------- /mesh/point_cubic_squared_distance.m: -------------------------------------------------------------------------------- 1 | function [sqrD,S] = point_cubic_squared_distance(Q,C,tol) 2 | [P,T] = cubic_flat_eval(C,tol); 3 | E = [1:size(P,1)-1;2:size(P,1)]'; 4 | [sqrD,I,C] = point_mesh_squared_distance(Q,P,E); 5 | B = barycentric_coordinates(C,P(E(I,1),:),P(E(I,2),:),'Project',true); 6 | S = T(E(I,1)).*B(:,1) + T(E(I,2)).*B(:,2); 7 | end 8 | -------------------------------------------------------------------------------- /mesh/point_spline_signed_distance.m: -------------------------------------------------------------------------------- 1 | function [D,I,S,K] = point_spline_signed_distance(Q,P,C,tol) 2 | [sqrD,I,S,K] = point_spline_squared_distance(Q,P,C,tol); 3 | W = spline_winding_number(P,C,Q); 4 | D = (1-abs(W)*2).*sqrt(sqrD); 5 | end 6 | -------------------------------------------------------------------------------- /mesh/poly_to_spline.m: -------------------------------------------------------------------------------- 1 | function [P,C] = spline_to_poly(V,E) 2 | % SPLINE_TO_POLY Trivially convert a poly-line into cubic Bézier curves. 3 | % 4 | % [P,C] = spline_to_poly(V,E) 5 | % 6 | % Inputs: 7 | % V #V by dim list of poly-line vertex positions 8 | % E #E by 2 list of edge indices into rows of V 9 | % Outputs: 10 | % P #V+2*#E by dim list of cubic bezier curve control points 11 | % C #E by 4 list of control point indices into rows of P 12 | P = [V; 13 | V(E(:,1),:)*(2/3) + V(E(:,2),:)*(1/3); ... 14 | V(E(:,1),:)*(1/3) + V(E(:,2),:)*(2/3)]; 15 | C = [E(:,1) size(V,1)+reshape((1:2*size(E,1)),[],2) E(:,2)]; 16 | end 17 | -------------------------------------------------------------------------------- /mesh/quad_facet_adjacency_matrix.m: -------------------------------------------------------------------------------- 1 | function A = quad_facet_adjacency_matrix(Q) 2 | % 3 | % A = quad_facet_adjacency_matrix(Q) 4 | % 5 | % Inputs: 6 | % Q #Q by 4 list of quad indices 7 | % Outputs: 8 | % A #Q by #Q adjacency matrix 9 | % 10 | allE = [Q(:,1:2);Q(:,2:3);Q(:,3:4);Q(:,[4 1])]; 11 | [E,~,EMAP] = unique(sort(allE,2),'rows'); 12 | E2Q = sparse(EMAP,repmat(1:size(Q,1),1,4)',1,size(E,1),size(Q,1)); 13 | A = (E2Q'*E2Q)>0; 14 | end 15 | -------------------------------------------------------------------------------- /mesh/quadratic_eval.m: -------------------------------------------------------------------------------- 1 | function P = quadratic_eval(Q,t) 2 | % QUADRATIC_EVAL Evaluate a cubic Bezier curve. 3 | % 4 | % P = quadratic_eval(C,t); 5 | % 6 | % Inputs: 7 | % Q 3 by dim list of control points 8 | % t #t list of evaluation parameters 9 | % Outputs: 10 | % P #t by dim list of evaluated points 11 | % 12 | % See also: readSVG_cubics, cubic_split, quadratic_eval 13 | % 14 | t = reshape(t,numel(t),1); 15 | P = ... 16 | (1-t).^2 .*Q(1,:) + ... 17 | 2.*(1-t).*t .*Q(2,:) + ... 18 | t.^2.*Q(3,:); 19 | end 20 | -------------------------------------------------------------------------------- /mesh/quadratic_to_cubic.m: -------------------------------------------------------------------------------- 1 | function C = quadratic_to_cubic(Q) 2 | % C = quadratic_to_cubic(Q) 3 | % 4 | % Inputs: 5 | % Q 3 by dim list of quadratic Bezier control points 6 | % Ouputs: 7 | % C 4 by dim list of cubicBezier control points 8 | % 9 | 10 | C(1, :) = Q(1, :); 11 | C(2, :) = (1/3)*Q(1, :) + (2/3)*Q(2, :); 12 | C(3, :) = (2/3)*Q(2, :) + (1/3)*Q(3, :); 13 | C(4, :) = Q(3, :); 14 | 15 | end 16 | -------------------------------------------------------------------------------- /mesh/quatbetween.m: -------------------------------------------------------------------------------- 1 | function q = quatbetween(u,v,varargin) 2 | % QUATBETWEEN compute the unit quaternion representation of the rotation 3 | % between two vectors 4 | % 5 | % [w,a] = axisanglebetween(u,v) 6 | % [w,a] = axisanglebetween(u,v,nan_replacement) same as above but NaN rows 7 | % resulting from angle exactly pi are replaced with nan_replacement 8 | % 9 | % Inputs: 10 | % u n by dim list of row vectors 11 | % v n by dim list of row vectors 12 | % Outputs: 13 | % q n by 4 list of unit quaternions 14 | % 15 | [w,a] = axisanglebetween(u,v,varargin{:}); 16 | q = axisangle2quat(w,a); 17 | end 18 | -------------------------------------------------------------------------------- /mesh/qvr.m: -------------------------------------------------------------------------------- 1 | function q = qvr(X,U,varargin) 2 | % QVR 3 | % 4 | % q = qvr(X,U,varargin) 5 | % 6 | % Shorthand for: 7 | % q = quiver(X(:,1),X(:,2),U(:,1),U(:,2),...) 8 | 9 | if size(X,1) == 1 10 | X = repmat(X,size(U,1),1); 11 | end 12 | if size(U,1) == 1 13 | U = repmat(U,size(X,1),1); 14 | end 15 | 16 | switch size(X,2) 17 | case 3 18 | qq = quiver3(X(:,1),X(:,2),X(:,3),U(:,1),U(:,2),U(:,3),varargin{:}); 19 | case 2 20 | qq = quiver(X(:,1),X(:,2),U(:,1),U(:,2),varargin{:}); 21 | end 22 | 23 | if nargout>0, q = qq; end 24 | end 25 | -------------------------------------------------------------------------------- /mesh/randball.m: -------------------------------------------------------------------------------- 1 | function x = randball(n,dim) 2 | % RANDBALL Uniformly sample n points _inside_ a dim-dimensional ball. 3 | % 4 | % x = randball(n,dim) 5 | % 6 | % Inputs: 7 | % n number of samples 8 | % dim dimension of ball 9 | % Outputs: 10 | % x n by dim list of sample points 11 | % 12 | x = normalizerow(normrnd(0,1,n,dim)).*(rand(n,1).^(1/dim)); 13 | end 14 | -------------------------------------------------------------------------------- /mesh/readBF.m: -------------------------------------------------------------------------------- 1 | function [V,WI,P] = readBF(filename) 2 | % READBF Read a skeleton from the .bf bone forest format 3 | % 4 | % [V,WI,P] = readBF(filename) 5 | % 6 | % Read bone forest from a .bf file 7 | % 8 | % Input: 9 | % filename .bf file name 10 | % Output: 11 | % V # vertices by 3 list of vertex offsets from parents 12 | % WI # vertices list of indices of weights (0 means no weights) 13 | % P # vertices list of indices of bone parents (0 means root) 14 | % 15 | D = dlmread(filename); 16 | V = D(:,3:end); 17 | WI = D(:,1)+1; 18 | P = D(:,2)+1; 19 | end 20 | -------------------------------------------------------------------------------- /mesh/readPLY.m: -------------------------------------------------------------------------------- 1 | function [V,F] = readPLY(filename) 2 | % READPLY Wrapper for read_ply 3 | % 4 | % Input: 5 | % filename path to .ply file 6 | % Outputs: 7 | % V #V by 3 list of vertex positions 8 | % F #F by 3 list of face indices 9 | % 10 | [V,F] = read_ply(filename); 11 | 12 | end 13 | -------------------------------------------------------------------------------- /mesh/remove_duplicate_simplices.m: -------------------------------------------------------------------------------- 1 | function [SF,SFI,SFJ] = remove_duplicate_simplices(F) 2 | % REMOVE_DUPLICATE_SIMPLICES Remove duplicate simplices (regardless of order) 3 | % 4 | % Inputs: 5 | % F #F by ss list of simplex indices 6 | % Outputs: 7 | % SF #SF by ss list of unique simplices (maintaining original order of 8 | % first simplex found) 9 | % SFI #SF list so that SF = F(SFI,:) 10 | % SFJ #SFI list so that F = SF(SFJ,:) 11 | [~,SFI,SFJ] = unique(sort(F,2),'rows','stable'); 12 | SF = F(SFI,:); 13 | end 14 | -------------------------------------------------------------------------------- /mesh/reuleaux_triangle.m: -------------------------------------------------------------------------------- 1 | function [P,E] = reuleaux_triangle(sam) 2 | % REULEAUX_TRIANGLE Construct a reuleaux triangle (curve of constant width) 3 | % 4 | % Inputs: 5 | % sam number of samples per side 6 | %% th_max portion of circle to use as side in radians (0,pi*2/3) 7 | % Outputs: 8 | % P #sam*3 by 2 list of vertex positions 9 | % E #E by 2 list of edge indices into P 10 | % 11 | if nargin<1 12 | sam = 20; 13 | end 14 | th_max = pi/3; 15 | th = linspace(0,th_max,sam+1)'; 16 | E = [1:numel(th)-1;2:numel(th)]'; 17 | P = [cos(th) sin(th)]; 18 | %c = [0.5 sqrt(3)/6]; 19 | c = 0.5*[P(1,:)+P(end,:)]+sqrt(3)/6*[P(end,:)-P(1,:)]*[0 1;-1 0]; 20 | rot = @(ph) [cos(ph) -sin(ph);sin(ph) cos(ph)]; 21 | R = rot(-2*pi/3); 22 | P = bsxfun(@minus,P(1:end-1,:),c); 23 | P = [P;P*R;P*R*R]; 24 | P = P/sqrt(sum(P(1,:).^2)); 25 | E = [1:size(P,1);2:size(P,1) 1]'; 26 | end 27 | -------------------------------------------------------------------------------- /mesh/sct.m: -------------------------------------------------------------------------------- 1 | function s = sct(V,varargin) 2 | % SCT 3 | % 4 | % s = sct(V,varargin) 5 | % 6 | % Shorthand for: 7 | % s = scatter(V(:,1),V(:,2), ... 8 | 9 | switch size(V,2) 10 | case 3 11 | ss = scatter3(V(:,1),V(:,2),V(:,3),varargin{:}); 12 | case 2 13 | ss = scatter(V(:,1),V(:,2),varargin{:}); 14 | end 15 | 16 | if nargout>0, s = ss; end 17 | end 18 | -------------------------------------------------------------------------------- /mesh/stable_camva.m: -------------------------------------------------------------------------------- 1 | function stable_camva(a) 2 | % STABLE_CAMVA Act like camva without changing zoom (aka dolly zoom) 3 | % 4 | % Inputs: 5 | % a angle input to camva 6 | % 7 | % Note: This will mess up interactive view orbitting. So set up your 8 | % view first... 9 | % 10 | % See also: camva 11 | old_a = camva; 12 | old_t = camtarget; 13 | old_p = campos; 14 | camva(a); 15 | s = tan(a/2*pi/180)/tan(old_a/2*pi/180); 16 | p = (old_p-old_t)/s+old_t; 17 | campos(p); 18 | end 19 | -------------------------------------------------------------------------------- /mesh/super_fibonacci.m: -------------------------------------------------------------------------------- 1 | function q = super_fibonacci(n,phi,psi) 2 | % SUPER_FIBONACCI Generate n quaternions according to "Super-Fibonacci 3 | % Spirals: Fast, Low-Discrepancy Sampling of SO(3)" [Alexa 2021] 4 | % 5 | % q = super_fibonacci(n,phi,psi) 6 | % 7 | % Inputs: 8 | % n number of rotations to generate 9 | % phi, psi parameters controling the distribution {sqrt(2), 1.53375116875…} 10 | % Outputs: 11 | % q n by 4 list of unit quaternions 12 | % 13 | % 14 | if nargin<2 15 | phi = sqrt(2); 16 | end 17 | if nargin<3 18 | psi = 1.533751168755204288118041; 19 | end 20 | % https://marcalexa.github.io/superfibonacci/ 21 | i = (0:n-1)'; 22 | s = i + 0.5; 23 | r = sqrt(s./n); 24 | R = sqrt(1.0-s./n) 25 | alpha = (2*pi .* s)./phi; 26 | beta = (2*pi .* s)./psi; 27 | q = [r.*sin(alpha), r.*cos(alpha), R.*sin(beta), R.*cos(beta)]; 28 | end 29 | -------------------------------------------------------------------------------- /mesh/surf_to_mesh.m: -------------------------------------------------------------------------------- 1 | function [V,F] = surf_to_mesh(X,Y,Z) 2 | % SURF_TO_MESH Convert a grid-based `surf` representation of surface to a 3 | % triangle mesh representation. 4 | % 5 | % [V,F] = surf_to_mesh(X,Y,Z) 6 | % 7 | % Inputs: 8 | % X m by n list of x-coordinates 9 | % Y m by n list of y-coordinates 10 | % Z m by n list of z-coordinates 11 | % Outputs: 12 | % V #V by 3 list of vertex positions 13 | % F #F by 3 list of face indices 14 | % 15 | 16 | clean = true; 17 | s2p = surf2patch(X,Y,Z); 18 | F = s2p.faces; 19 | V = s2p.vertices; 20 | F = [F(:,[1 2 3]);F(:,[1 3 4])]; 21 | 22 | if clean 23 | [V,VI,VJ] = remove_duplicate_vertices(V,1e-7); 24 | F = VJ(F); 25 | F = F(doublearea(V,F)>eps,:); 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /mesh/texture_coords.m: -------------------------------------------------------------------------------- 1 | function [TC] = texture_coords(V,flip_y) 2 | % TEXTURE_COORDS normalize mesh x and y coordinates for use as texture 3 | % coordinates 4 | % 5 | % [TC] = texture_coords(V,flip_y) 6 | % 7 | % Inputs: 8 | % V #V by 2 list of mesh vertex positions 9 | % flip_y boolean whether to flip texture coordinates, {true} 10 | % Outputs 11 | % TC #V by 2 list of mesh texture coordinates, between 0 and 1 12 | % 13 | % normalize texture coordinates to be between zero and 1 14 | % 15 | 16 | TC = [ ... 17 | (V(:,1)-min(V(:,1)))/(max(V(:,1))-min(V(:,1))) ... 18 | (V(:,2)-min(V(:,2)))/(max(V(:,2))-min(V(:,2)))]; 19 | 20 | if ~exist('flip_y','var') 21 | flip_y = true; 22 | end 23 | 24 | if flip_y 25 | TC(:,2) = 1-TC(:,2); 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /mesh/tri2tgf.m: -------------------------------------------------------------------------------- 1 | function tri2tgf(input_name,output_name) 2 | % TRI2TGF Script to convert a triangle mesh to a tgf graph (skeleton file) 3 | % 4 | % tri2tgf(input_name,output_name) 5 | % 6 | % Inputs: 7 | % input_name name of file contaning input vertices and faces of surface, 8 | % should end in .off or .obj 9 | % output_name name of output file to be written with 3D tet mesh, should 10 | % end in .mesh 11 | 12 | % read input mesh 13 | [V,F] = load_mesh(input_name); 14 | % Find all edges in mesh, note internal edges are repeated 15 | E = sort( ... 16 | [F(:,1) (:,2); ... 17 | F(:,2) (:,3); ... 18 | F(:,3) (:,1)]')'; 19 | % remove duplicates 20 | E = unique(E,'rows'); 21 | writeTGF(output_name,V,E); 22 | 23 | end 24 | -------------------------------------------------------------------------------- /mesh/triangle_strip.m: -------------------------------------------------------------------------------- 1 | function [V,F] = triangle_strip(P,E) 2 | % TRIANGLE_STRIP build a strip of triangles given a curve 3 | % 4 | % [V,F] = triangle_strip(P,E) 5 | % 6 | % Inputs: 7 | % P #points by 2 list of 2d points 8 | % E #edges by 2 list of edge indices into P 9 | % Outputs: 10 | % V #points*2 by 3 list of 3d points 11 | % F #edges*2 by 3 list of triangle indices 12 | % 13 | n = size(P,1); 14 | V = [P -ones(n,1);P ones(n,1)]; 15 | F = [E n+E(:,1);n+fliplr(E) E(:,2)]; 16 | end 17 | -------------------------------------------------------------------------------- /mesh/triangles_from_strip.m: -------------------------------------------------------------------------------- 1 | function F = triangles_from_strip(S) 2 | % TRIANGLES_FROM_STRIP Create a list of triangles from a stream of indices 3 | % along a strip. 4 | % 5 | % Inputs: 6 | % S #S list of indices 7 | % Outputs: 8 | % F #S-2 by 3 list of triangle indices 9 | % 10 | 11 | %F = zeros(numel(S)-2,3); 12 | %for s = 3:numel(S) 13 | % if mod(s,2) == 0 14 | % F(s-2,:) = fliplr([S(s-2) S(s-1) S(s)]); 15 | % else 16 | % F(s-2,:) = [S(s-2) S(s-1) S(s)]; 17 | % end 18 | %end 19 | 20 | S = S(:); 21 | % Maintain order and orientations 22 | F = [ ... 23 | S(1:2:end-2) S(2:2:end-1) S(3:2:end) ... 24 | S(3:2:end-1) S(2:2:end-2) S(4:2:end)]; 25 | F = reshape(F',3,numel(S)-2)'; 26 | 27 | end 28 | -------------------------------------------------------------------------------- /mesh/tt.m: -------------------------------------------------------------------------------- 1 | function [Fp, Fi] = tt(F) 2 | warning('tt is deprecated, use triangle_triangle_adjacency instead.'); 3 | [Fp, Fi] = triangle_triangle_adjacency(F); 4 | end 5 | -------------------------------------------------------------------------------- /mesh/txt.m: -------------------------------------------------------------------------------- 1 | function s = txt(V,varargin) 2 | % TXT 3 | % 4 | % s = txt(V,varargin) 5 | % 6 | % Shorthand for: 7 | % s = text(V(:,1),V(:,2), ... 8 | % 9 | % Example: 10 | % txt(V,num2str((1:size(V,1))')); 11 | 12 | switch size(V,2) 13 | case 3 14 | ss = text(V(:,1),V(:,2),V(:,3),varargin{:}); 15 | case 2 16 | ss = text(V(:,1),V(:,2),varargin{:}); 17 | end 18 | 19 | if nargout>0, s = ss; end 20 | end 21 | 22 | -------------------------------------------------------------------------------- /mesh/uniformly_sample_edges.m: -------------------------------------------------------------------------------- 1 | function [S,SI] = uniformly_sample_edges(V,E,h) 2 | % UNIFORMLY_SAMPLE_EDGES Sample edges of (V,E) with spacing close to h. 3 | % 4 | % Inputs: 5 | % V #V by dim list of vertex locations 6 | % E #E by 2 list of edges indices into V 7 | % h desired distance between samples 8 | % Outputs: 9 | % S #S by dim list of sample locations 10 | % SI #SI list of indices into E 11 | % 12 | S = []; 13 | SI = []; 14 | for e = 1:size(E,1) 15 | n = ceil(sqrt(sum((V(E(e,1),:)-V(E(e,2),:)).^2,2))/h)+1; 16 | s = linspace(0,1,n)'; 17 | SI = [SI;e*ones(n,1)]; 18 | S = [S; ... 19 | bsxfun(@times,1-s,V(E(e,1),:))+bsxfun(@times, s,V(E(e,2),:))]; 20 | end 21 | [S,I] = unique(S,'rows'); 22 | SI = SI(I,:); 23 | end 24 | -------------------------------------------------------------------------------- /mesh/vertex_triangle_adjacency.m: -------------------------------------------------------------------------------- 1 | function [VT] = vertex_triangle_adjacency(F) 2 | % VERTEX_TRIANGLE_ADJACENCY Build a vertex-triangle adjacency matrix for a 3 | % triangle mesh. 4 | % 5 | % VT = vertex_triangle_adjacency(F) 6 | % 7 | % Input: 8 | % F #F x 3 list of face indices 9 | % Output: 10 | % VT #F x #V sparse matrix, VT(i,j) is 1 iff vertex i is in face j 11 | 12 | i = (1:size(F,1))'; 13 | j = F; 14 | VT = sparse([i i i],j,1); 15 | 16 | end 17 | -------------------------------------------------------------------------------- /mesh/vv.m: -------------------------------------------------------------------------------- 1 | function [VV] = vv(V,F) 2 | warning('vv is deprecated, use adjacency_matrix instead.'); 3 | VV = adjacency_matrix(F); 4 | end 5 | -------------------------------------------------------------------------------- /mesh/writeBB.m: -------------------------------------------------------------------------------- 1 | function writeBB(filename,D,type) 2 | % WRITEBB write medit data file 3 | % 4 | % writeBB(filename,D,type) 5 | % 6 | % Inputs: 7 | % filename path to *.bb file 8 | % D #D by dim data matrix 9 | % type type identifier as per 10 | % http://www.ann.jussieu.fr/frey/publications/RT-0253.pdf page 34 11 | % 2 means defined at vertices 12 | % 1 means defined at elements 13 | 14 | f = fopen(filename,'w'); 15 | % print header 16 | % only vector data is supported 17 | fprintf(f,'%d %d %d %d\n',2,1,size(D,1),type); 18 | fprintf(f,'%g\n',D'); 19 | fclose(f); 20 | 21 | end 22 | -------------------------------------------------------------------------------- /mesh/writeMDD.m: -------------------------------------------------------------------------------- 1 | function writeMDD(mdd_filename,VV) 2 | % WRITEMDD Write a mesh animation to a .mdd file, e.g., for use in Blender 3 | % 4 | % Inputs: 5 | % mdd_filename path to .mdd file 6 | % VV #V by 3 by #frames mesh animation 7 | % 8 | fp = fopen(mdd_filename,'w','ieee-be'); 9 | fwrite(fp,size(VV,3),'uint32'); 10 | fwrite(fp,size(VV,1),'uint32'); 11 | fwrite(fp,linspace(0,1,size(VV,3)),'float'); 12 | fwrite(fp,permute(VV,[2 1 3]),'float'); 13 | fclose(fp); 14 | end 15 | -------------------------------------------------------------------------------- /mesh/writeSMF.m: -------------------------------------------------------------------------------- 1 | function writeSMF(filename,V,F) 2 | % WRITESMF Write a mesh (V,F) to a .smf file. 3 | % 4 | % writeSMF(filename,V,F) 5 | % 6 | % Input: 7 | % filename path to .obj file 8 | % V #V by 3 list of vertices 9 | % F #F by 3 list of triangle indices 10 | % 11 | % See also: writeOBJ.m 12 | % 13 | f = fopen( filename, 'w' ); 14 | fprintf( f, 'v %0.17g %0.17g %0.17g\n', V'); 15 | fprintf( f, 'f %d %d %d\n', F'); 16 | fclose(f); 17 | end 18 | -------------------------------------------------------------------------------- /mesh/writeSTL.m: -------------------------------------------------------------------------------- 1 | function writeSTL(filename, V,F) 2 | % WRITESTL writes an STL file with vertex/face information. Uses single 3 | % precision. 4 | % 5 | % writeSTL(filename,V,F) 6 | % 7 | % Input: 8 | % filename path to .stl file 9 | % V #V by 3 list of vertices (Default units are in mm) 10 | % F #F by 3 list of triangle indices 11 | % 12 | 13 | TR = triangulation(F, V); 14 | stlwrite(TR,filename) 15 | 16 | end 17 | 18 | -------------------------------------------------------------------------------- /mesh/writeTGF.m: -------------------------------------------------------------------------------- 1 | function writeTGF(filename,V,E) 2 | % WRITETGF Write a graph to a .tgf file 3 | % 4 | % writeTGF(filename,V,E) 5 | % 6 | % Input: 7 | % filename .tgf file name 8 | % V # vertices by 3 list of vertex positions 9 | % E # edges by 2 list of edge indices 10 | % 11 | % Assumes that graph vertices are 3 dimensional 12 | 13 | if( size(V,2) ~= 3) 14 | % append zeros 15 | V = [V 0*V(:,1)]; 16 | end 17 | %disp(['writing: ',filename]); 18 | fp = fopen(filename,'w'); 19 | % print vertices 20 | fprintf(fp,'%d %g %g %g\n',[1:size(V,1); V']); 21 | % print separator 22 | fprintf(fp,'#\n'); 23 | % print edges, .tgf is 1-indexed 24 | if(~isempty(E)) 25 | fprintf(fp,'%d %d\n',[E']); 26 | end 27 | fclose(fp); 28 | end 29 | -------------------------------------------------------------------------------- /mesh/writeWIRE.m: -------------------------------------------------------------------------------- 1 | function writeWIRE(filename, V,E) 2 | % WRITEWIRE writes an .wire file with vertex/edge information (see PyMesh 3 | % documentation). 4 | % 5 | % writeWIRE(filename,V,F,UV,N) 6 | % 7 | % Input: 8 | % filename path to .wire file 9 | % V #V by 3 list of vertices 10 | % E #E by 2 list of edge indices into E 11 | % 12 | 13 | f = fopen( filename, 'w' ); 14 | if size(V,2) == 2 15 | warning('Appending 0s as z-coordinate'); 16 | V(:,end+1:3) = 0; 17 | else 18 | assert(size(V,2) == 3); 19 | end 20 | 21 | fprintf( f, 'v %0.17g %0.17g %0.17g\n', V'); 22 | assert(size(E,2) == 2,'Edge list should have two columns'); 23 | fprintf( f, 'l %d %d\n', E'); 24 | 25 | fclose(f); 26 | end 27 | -------------------------------------------------------------------------------- /mex/ambient_occlusion.m: -------------------------------------------------------------------------------- 1 | % AMBIENT_OCCLUSION Compute ambient occlusion per given point 2 | % 3 | % S = ambient_occlusion(V,F,P,N,num_samples) 4 | % 5 | % Inputs: 6 | % V #V by 3 list of mesh vertex positions 7 | % F #F by 3 list of mesh triangle facet indices into V 8 | % P #P by 3 list of origin points 9 | % N #P by 3 list of origin normals 10 | % num_samples number of samples 11 | % Outputs: 12 | % S #P list of ambient occlusion values between 1 (fully occluded) and 0 13 | % (not occluded) 14 | % 15 | % Examples: 16 | % % mesh (V,F), scalar field Z 17 | % AO = ambient_occlusion(V,F,V,per_vertex_normals(V,F),1000); 18 | % tsurf(F,V,'FaceVertexCData', ... 19 | % bsxfun(@times,1-AO, ... 20 | % squeeze(ind2rgb(floor(matrixnormalize(Z)*256),jet(256)))), ... 21 | % fphong,'EdgeColor','none'); 22 | % 23 | -------------------------------------------------------------------------------- /mex/blue_noise.m: -------------------------------------------------------------------------------- 1 | % BLUE_NOISE 2 | % 3 | % [P,FI,B] = blue_noise(V,F,r) 4 | % or 5 | % [P,FI,B] = blue_noise(V,r) 6 | % with V 2D 7 | 8 | -------------------------------------------------------------------------------- /mex/cmake/DownloadProject.CMakeLists.cmake.in: -------------------------------------------------------------------------------- 1 | # Distributed under the OSI-approved MIT License. See accompanying 2 | # file LICENSE or https://github.com/Crascit/DownloadProject for details. 3 | 4 | cmake_minimum_required(VERSION 2.8.2) 5 | 6 | project(${DL_ARGS_PROJ}-download NONE) 7 | 8 | include(ExternalProject) 9 | ExternalProject_Add(${DL_ARGS_PROJ}-download 10 | ${DL_ARGS_UNPARSED_ARGUMENTS} 11 | SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" 12 | BINARY_DIR "${DL_ARGS_BINARY_DIR}" 13 | CONFIGURE_COMMAND "" 14 | BUILD_COMMAND "" 15 | INSTALL_COMMAND "" 16 | TEST_COMMAND "" 17 | TLS_VERIFY OFF 18 | ) 19 | -------------------------------------------------------------------------------- /mex/cmake/libigl.cmake: -------------------------------------------------------------------------------- 1 | if(TARGET igl::core) 2 | return() 3 | endif() 4 | 5 | include(FetchContent) 6 | FetchContent_Declare( 7 | libigl 8 | GIT_REPOSITORY https://github.com/libigl/libigl.git 9 | GIT_TAG 667101084ac342f1f700299349452143069cbb4a 10 | ) 11 | FetchContent_MakeAvailable(libigl) 12 | -------------------------------------------------------------------------------- /mex/collapse_small_triangles.m: -------------------------------------------------------------------------------- 1 | % Given a triangle mesh (V,F) compute a new mesh (VV,FF) which contains the 2 | % original faces and vertices of (V,F) except any small triangles have been 3 | % removed via collapse. 4 | % 5 | % We are *not* following the rules in "Mesh Optimization" [Hoppe et al] 6 | % Section 4.2. But for our purposes we don't care about this criteria. 7 | % 8 | % [FF] = collapse_small_triangles(V,F,eps) 9 | % 10 | % Inputs: 11 | % V #V by 3 list of vertex positions 12 | % F #F by 3 list of triangle indices into V 13 | % eps epsilon for smallest allowed area treated as fraction of squared bounding box 14 | % diagonal 15 | % Outputs: 16 | % FF #FF by 3 list of triangle indices into V 17 | % 18 | -------------------------------------------------------------------------------- /mex/dual_laplacian.m: -------------------------------------------------------------------------------- 1 | % DUAL_LAPLACIAN from "Laplace Operators for Tetrahedral Meshes" [Alexa et al. 2 | % 2020] 3 | % 4 | % [L,M] = dual_laplacian(V,T) 5 | % 6 | % Inputs: 7 | % V #V by 3 list of vertex positions 8 | % T #T by 4 list of tetrahedron indices into rows of V 9 | % Outputs: 10 | % L #V by #V sparse dual Laplacian matrix 11 | % M #V by #V sparse mass matrix 12 | -------------------------------------------------------------------------------- /mex/eltopo.m: -------------------------------------------------------------------------------- 1 | % ELTOPO Given a surface mesh (V0,F) in a self-intersecting state (may be many 2 | % connected components) and desired new vertex positions (potentially causing 3 | % self-intersections or "tunneling"), use EL TOPO's implementation of "ROBUST 4 | % TOPOLOGICAL OPERATIONS FOR DYNAMIC EXPLICIT SURFACES" [Brochu & Bridson, 5 | % 2009] to find new vertex positions U and possibly new combinatorics G 6 | % resolving those collisions. 7 | % 8 | % [U,G,t] = eltopo(V0,F,V1) 9 | % 10 | % Inputs: 11 | % V0 #V by 3 list of input vertex positions at "time t=0" 12 | % F #F by 3 list of triangle indices into V0 13 | % V1 #V by 3 list of desired output vertex positions at "time t=1" 14 | % Outputs: 15 | % U #U by 3 list of self-intersection free vertex positions at "time t=1" 16 | % G #G by 3 list of triangle indices into U. 17 | % t time step actually achieved (t=1 on success, t=0 on failure) 18 | % 19 | -------------------------------------------------------------------------------- /mex/exact_geodesic.m: -------------------------------------------------------------------------------- 1 | % EXACT_GEODESIC 2 | % 3 | % Inputs: 4 | % V #V by dim list of vertex positions 5 | % F #F by 3 list of triangle indices into rows of V 6 | % VS #VS by 1 list of indices into rows of V of source vertices 7 | % FS #FS by 1 list of indices into rows of F of source faces 8 | % VT #VT by 1 list of indices into rows of V of target vertices 9 | % FT #FT by 1 list of indices into rows of F of target faces 10 | % Outputs: 11 | % D #VT+#FT by 1 list of geodesic distances of each target w.r.t. the nearest one in the source set 12 | % 13 | % 14 | -------------------------------------------------------------------------------- /mex/fast_sparse.m: -------------------------------------------------------------------------------- 1 | % FAST_SPARSE 2 | % 3 | % S = fast_sparse(I,J,V,m,n); 4 | % 5 | % instead of 6 | % 7 | % S = sparse(I,J,V,m,n); 8 | % 9 | % Why is this faster than sparse? Please send your query to 10 | % http://www.mathworks.com/support/bugreports 11 | -------------------------------------------------------------------------------- /mex/fit_cubic_bezier.m: -------------------------------------------------------------------------------- 1 | % FIT_CUBIC_BEZIER Fit a cubic bezier spline (G1 continuous) to an ordered list 2 | % of input points in any dimension, according to "An algorithm for automatically 3 | % fitting digitized curves" [Schneider 1990]. 4 | % 5 | % Inputs: 6 | % d #d by dim list of points along a curve to be fit with a cubic bezier 7 | % spline (should probably be roughly uniformly spaced). If d(0)==d(end), 8 | % then will treat as a closed curve. 9 | % error maximum squared distance allowed 10 | % Output: 11 | % cubics #cubics list of 4 by dim lists of cubic control points 12 | % 13 | % Example: 14 | % [P,~,C] = remove_duplicate_vertices(cell2mat(fit_cubic_bezier(X,1)),0); 15 | % C = reshape(C,4,[])'; 16 | -------------------------------------------------------------------------------- /mex/fit_rotations_mex.m: -------------------------------------------------------------------------------- 1 | function mex_exists = fit_rotations_mex() 2 | mex_exists = false; 3 | end 4 | -------------------------------------------------------------------------------- /mex/form_factor.m: -------------------------------------------------------------------------------- 1 | % FORM_FACTOR Computer form factors for radiosity computation 2 | % 3 | % [F,V,BC,N] = form_factor(P,E) 4 | % 5 | % Inputs: 6 | % P #P by 2 list of 2D vertices 7 | % E #E by 2 list of edge indices into P 8 | % Outputs: 9 | % F #E by #E matrix of integrated form factor values 10 | % V #E by #E matrix of visibility values 11 | % BC #E by 2 list of edge barycenters 12 | % N #E by 2 list of length-weighted normals 13 | -------------------------------------------------------------------------------- /mex/functionSignatures.json: -------------------------------------------------------------------------------- 1 | { 2 | "read_mesh_from_xml":{"inputs":[{"name":"filename","type":"filepath=*.xml"}]}, 3 | 4 | "blank_so_every_line_can_have_a_comma":{} 5 | } 6 | -------------------------------------------------------------------------------- /mex/impaste.m: -------------------------------------------------------------------------------- 1 | % IMPASTE paste an image from the current clipboard. 2 | % 3 | % IM = impaste(); 4 | % 5 | % Outputs: 6 | % IM h by w by 3 RGB image pasted from clipboard. 7 | % Throws an error if the clipboard does not contain an image. 8 | -------------------------------------------------------------------------------- /mex/paste.h: -------------------------------------------------------------------------------- 1 | #include 2 | // Get image from clipboard as an RGB image 3 | // 4 | // Outputs: 5 | // IM h*w*c list of rgb pixel color values as uint8, running over height, 6 | // then width, then rgb channels 7 | // h height 8 | // w width 9 | // c channels 10 | bool paste(unsigned char *& IM,size_t & h, size_t & w, size_t & c); 11 | -------------------------------------------------------------------------------- /mex/principal_curvature.m: -------------------------------------------------------------------------------- 1 | % PRINCIPAL_CURVATURE Compute principal curvatures at vertices of a mesh (V,F) 2 | % 3 | % [PD1,PD2,PV1,PV2] = principal_curvature(V,F); 4 | % 5 | % Inputs: 6 | % V #V by 3 list of mesh vertex positions 7 | % F #F by 3 list of mesh triangule indices into rows of V 8 | % Outputs: 9 | % PD1 #V by 3 list of first principal curvature directions 10 | % PD2 #V by 3 list of second principal curvature directions 11 | % PV1 #V list of first principal curvature values 12 | % PV2 #V list of second principal curvature values 13 | % 14 | -------------------------------------------------------------------------------- /mex/psd_project_rows.m: -------------------------------------------------------------------------------- 1 | function H = psd_project_rows(H,tol) 2 | % H = psd_project_rows(H) 3 | if nargin < 2 4 | tol = 0; 5 | end 6 | m = round(sqrt(size(H,2))); 7 | assert(m*m==size(H,2)); 8 | for i = 1:size(H,1) 9 | A = reshape(H(i,:),m,m); 10 | [V,D] = eig(triu(A)+triu(A,1)','vector'); 11 | B = V*(max(D,tol).*V'); 12 | H(i,:) = B(:); 13 | if any(~isreal(B(:))) 14 | keyboard 15 | end 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /mex/ray_mesh_intersect.m: -------------------------------------------------------------------------------- 1 | % RAY_MESH_INTERSECT Find first hit (if it exists) for each ray. 2 | % 3 | % [flag, t, lambda] = ray_mesh_intersect(src, dir, V, F); 4 | % 5 | % Input: 6 | % src #rays by 3 list of 3D vector ray origins 7 | % dir #rays by 3 list of 3D vector ray directions 8 | % V #V by 3 list of vertex positions 9 | % F #F by 3 list of triangle indices 10 | % Output: 11 | % id #rays list of indices into F (0 if no hit) 12 | % t #rays list of distances from the ray origin (inf if no hit) 13 | % lambda #rays by 3 list of barycentric coordinate of hit 14 | % 15 | -------------------------------------------------------------------------------- /mex/read_mesh_from_xml.m: -------------------------------------------------------------------------------- 1 | % READ_MESH_FROM_XML Read a mesh from an xml file written using 2 | % igl::serialize_xml V from the tag and F from the tag. V 3 | % may be written using CGAL::Epeck but will be converted summarily to 4 | % double upon reading. 5 | % 6 | % [V,F] = read_mesh_from_xml(filename) 7 | % 8 | % Inputs: 9 | % filename path to .xml file 10 | % Outputs: 11 | % V #V by 3 list of vertex positions 12 | % F #F by 3 list of face indices into V 13 | % 14 | -------------------------------------------------------------------------------- /mex/slim.m: -------------------------------------------------------------------------------- 1 | % SLIM Comptue a parameterization using Scalable Locally Injective Maps 2 | % [Rabinovich et al. 2016] 3 | % 4 | % U = slim(V,F,b,bc); 5 | % U = slim(V,F,b,bc,'ParameterName',ParameterValue, ...) 6 | % 7 | % Inputs 8 | % V #V by 3 list of 3D mesh coordinates 9 | % F #F by 3 list of triangle indices into F 10 | % b #b list of boundary indices into V 11 | % bc #b by 2 list of boundary conditions 12 | % Optional: 13 | % 'P' followed by weight on boundary conditions: 0-->ignored, 14 | % large->enforced {1e5} 15 | % 'Iters' followed by number of iterations {100} 16 | % Outputs: 17 | % U #V by 2 list of output 2D mesh coordinates 18 | % U0 #V by 2 list of output 2D mesh coordinates of initial feasible guess 19 | % 20 | -------------------------------------------------------------------------------- /mex/snap_rounding.m: -------------------------------------------------------------------------------- 1 | % SNAP_ROUNDING Snap a list of possible intersecting segments with 2 | % endpoints in any precision to _the_ integer grid. 3 | % 4 | % Inputs: 5 | % V #V by 2 list of vertex positions 6 | % E #E by 2 list of segment indices into V 7 | % Outputs: 8 | % VI #VI by 2 list of output integer vertex positions, rounded copies 9 | % of V are always the first #V vertices 10 | % EI #EI by 2 list of segment indices into V, #EI ≥ #E 11 | % J #EI list of indices into E revealing "parent segments" 12 | % 13 | -------------------------------------------------------------------------------- /mex/split_nonmanifold.m: -------------------------------------------------------------------------------- 1 | % SPLIT_NONMANIFOLD Split a non-manifold (or non-orientable) mesh into a 2 | % manifold orientable mesh possibly with more connected components. 3 | % 4 | % Inputs: 5 | % F #F by 3 list of input tringle indices into some vertex list V 6 | % %Optional: 7 | % % 'V' followed by #V by dim vertex list 8 | % Outputs: 9 | % SF #F by 3 list of output tringle indices into V(SVI,:) 10 | % SVI #SV list of indices into V identifying vertex positions 11 | % %SV #SV by dim list of vertex positions so that SV = V(SVI,:) 12 | % 13 | -------------------------------------------------------------------------------- /mex/tetrahedralize.m: -------------------------------------------------------------------------------- 1 | % TETRAHEDRALIZE 2 | % 3 | % [TV,TT] = tetgen(SV,SF) 4 | % [TV,TT,TF,TR,TN,PT,FT] = tetgen(SV,SF,'Flags',flags) 5 | % 6 | % Inputs: 7 | % SV #SV by 3 list of input vertex positions 8 | % SF #SF by 3 list of face indices into rows of SV 9 | % Optional: 10 | % 'Flags' followed by TetGen flags to use {'-q2'} 11 | % Outputs: 12 | % TV #TV by 3 list of output vertex positions (SV should appear as first 13 | % rows) 14 | % TT #TT by 4 list of output tetrahedron indices into rows of TV 15 | % TF #TF by 3 list of output boundary triangles indices into rows of TV 16 | % TR #TT list of region ID for each tetrahedron 17 | % TN #TT by 4 list of indices neighbors for each tetrahedron 18 | % PT #TV list of incident tetrahedron for a vertex 19 | % FT #TF by 2 list of tetrahedrons sharing a triface 20 | % 21 | % 22 | % 23 | -------------------------------------------------------------------------------- /mex/upper_envelope.m: -------------------------------------------------------------------------------- 1 | % UPPER_ENVELOPE 2 | % 3 | % [VV,FF,J,FJ] = upper_envelope(V,F,Z) 4 | -------------------------------------------------------------------------------- /mex/vcpkg.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gp-toolbox-mex", 3 | "version-string": "0.1.0", 4 | "dependencies": [ 5 | "blas", 6 | "lapack" 7 | ] 8 | } -------------------------------------------------------------------------------- /mex/winding_number/prepare_lhs.cpp: -------------------------------------------------------------------------------- 1 | #ifdef MEX 2 | #include "prepare_lhs.h" 3 | 4 | void prepare_lhs( 5 | const int nlhs, 6 | mxArray *plhs[], 7 | const int no, 8 | double *& S) 9 | { 10 | // Create pointers for output arrays 11 | if(nlhs > 0) 12 | { 13 | // solid angles 14 | plhs[0] = mxCreateDoubleMatrix(no,1, mxREAL); 15 | S = mxGetPr(plhs[0]); 16 | } 17 | } 18 | #endif 19 | -------------------------------------------------------------------------------- /mex/winding_number/prepare_lhs.h: -------------------------------------------------------------------------------- 1 | #ifndef PREPARE_LHS_H 2 | #define PREPARE_LHS_H 3 | #include 4 | // Prepare left hand side 5 | // 6 | // Inputs: 7 | // nlhs number of left hand side arguments 8 | // plhs pointer to left hand side arguments 9 | // no number of origins 10 | // Outputs: 11 | // S no by 1 list of solid angles 12 | void prepare_lhs( 13 | const int nlhs, 14 | mxArray *plhs[], 15 | const int no, 16 | double *& S); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /mex/winding_number/triangle_tree.cpp: -------------------------------------------------------------------------------- 1 | #include "triangle_tree.h" 2 | #include 3 | 4 | void triangle_tree( 5 | const Eigen::MatrixXd & V, 6 | const Eigen::MatrixXi & F, 7 | TriTree & tree, 8 | TriangleList & tlist) 9 | { 10 | assert(F.cols() == 3); 11 | tlist.clear(); 12 | 13 | // Loop over facets 14 | for(int f = 0;f 5 | #include "CGAL_typedefs.h" 6 | 7 | // Construct an AABB tree using CGAL and fill it with the triangles of a 8 | // triangle mesh (V,F) 9 | // 10 | // Inputs: 11 | // V #V by 3 list of vertex positions 12 | // F #F by 3 list of triangle indices 13 | // Outputs: 14 | // Tree AABB tree containing triangles 15 | // tlist list of triangles 16 | void triangle_tree( 17 | const Eigen::MatrixXd & V, 18 | const Eigen::MatrixXi & F, 19 | TriTree & tree, 20 | TriangleList & tlist); 21 | #endif 22 | -------------------------------------------------------------------------------- /utility/NoCTranspose.m: -------------------------------------------------------------------------------- 1 | classdef NoCTranspose < double 2 | methods 3 | function obj = ctranspose(data) 4 | error("You called ctranspose (') on a NoCTranspose object"); 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /utility/README.md: -------------------------------------------------------------------------------- 1 | These files patch MATLAB to automatically remember ALL commands in your history 2 | (rather than just the last 20KB's worth) 3 | 4 | On Unix, issue: 5 | (You may have to change R2014a to whatever matlab version you have) 6 | 7 | cp ~/.matlab/R2014a/history.m ~/.matlab/R2014a/history_saved.m 8 | mv preserve_history.m ~/.matlab/R2014a/preserve_history.m 9 | 10 | If you don't already have a `finish.m` or `startup.m` you can issue: 11 | 12 | mv finish.m ~/.matlab/R2014a/finish.m 13 | mv startup.m ~/.matlab/R2014a/startup.m 14 | 15 | Otherwise you'll have to append these files to your existing `finish.m` and 16 | `startup.m` files. 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /utility/base64decode.m: -------------------------------------------------------------------------------- 1 | function V = base64decode(RES) 2 | % V = base64decode(RES) 3 | % 4 | % Inputs: 5 | % RES #RES long list of characters 6 | % Outputs: 7 | % V #V long list of bytes 8 | % 9 | % Faster implementation of: 10 | % Documentation for matlab.net.base64decode 11 | % 12 | % See also: base64encode 13 | vals = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; 14 | equ = find(RES=='=')-1; 15 | if isempty(equ) 16 | equ = numel(RES); 17 | end 18 | [~,inds] = ismember(RES(1:equ),vals); 19 | bin = dec2bin_logical(inds-1,6); 20 | %assert(isequal(bin,dec2bin(inds-1,6)=='1')); 21 | 22 | bin = reshape(bin',1,[]); 23 | bin = bin(1:floor(numel(bin)/8)*8); 24 | bin = reshape(bin,8,[])'; 25 | % This is very slow... 26 | %V = bin2dec(bin); 27 | V = (bin)*(2.^(7:-1:0))'; 28 | end 29 | 30 | -------------------------------------------------------------------------------- /utility/blue.m: -------------------------------------------------------------------------------- 1 | function C = blue() 2 | % BLUE Returns a nice bluecolor 3 | % 4 | % Outputs: 5 | % [0.2 0.3 0.8] 6 | C = [0.2 0.3 0.8]; 7 | end 8 | 9 | -------------------------------------------------------------------------------- /utility/clear_class.m: -------------------------------------------------------------------------------- 1 | function clear_class(class_name) 2 | % CLEAR_CLASS clears all variables of a specific class 3 | % 4 | % clear_class(class_name) 5 | % 6 | % Inputs: 7 | % class_name name of class to clear as string 8 | % 9 | % See also: clear 10 | % 11 | 12 | % Get a cell list of all variable names as strings 13 | s_v = who; 14 | s_v 15 | % loop over variabls 16 | for ii = 1:numel(s_v) 17 | % Get this variable as string 18 | s_s = s_v{ii}; 19 | s_s 20 | s_d = eval(s_s); 21 | class(s_d) 22 | if strcmp(class(s_d),class_name) 23 | fprintf('clearing: %s...',s_s); 24 | clear(s_s); 25 | end 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /utility/create_cache.m: -------------------------------------------------------------------------------- 1 | function create_cache(cache_name) 2 | % CREATE_CACHE Save the workspace of the caller function using the provided 3 | % cache_name, possibly overwriting it. 4 | % 5 | % create_cache(cache_name) 6 | % 7 | % Inputs: 8 | % cache_name path to .mat cache file 9 | % 10 | % See also: find_cache 11 | 12 | if isunix 13 | % get a list of current variables in this scope, this is the input "state" 14 | variables = evalin('caller','who'); 15 | variable_names = sprintf('^%s$|',variables{:}); 16 | save_cmd = sprintf('save(''%s'',''-regexp'',''%s'');',cache_name,variable_names); 17 | evalin('caller',save_cmd); 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /utility/derekblue.m: -------------------------------------------------------------------------------- 1 | function c = derekblue() 2 | c = [144.0/255, 210.0/255, 236.0/255]; 3 | end 4 | 5 | -------------------------------------------------------------------------------- /utility/enable_toolbox.m: -------------------------------------------------------------------------------- 1 | function enable_toolbox(name) 2 | local_toolbox_dir = ['./' name]; 3 | if exist(local_toolbox_dir,'dir'); 4 | rmdir(local_toolbox_dir,'s'); 5 | end 6 | mkdir(local_toolbox_dir); 7 | mkdir([local_toolbox_dir '/private']) 8 | addpath(local_toolbox_dir) % important to do this before copying 9 | matlabroot = '/Applications/MATLAB_R2018a.app/'; 10 | copyfile( ... 11 | [matlabroot '/toolbox/' name '/' name '/*.m'], ... 12 | [local_toolbox_dir '/']) 13 | copyfile( ... 14 | [matlabroot '/toolbox/' name '/' name '/private/*.m'], ... 15 | [local_toolbox_dir '/private']) 16 | end 17 | -------------------------------------------------------------------------------- /utility/figmp4.m: -------------------------------------------------------------------------------- 1 | function vobj = figmp4(name,vobj,nf) 2 | % vobj = figmp4(name,vobj) 3 | % 4 | % Inupts: 5 | % name path to .mp4 file 6 | % vobj [] on first call and see output for subsequent calls 7 | % Outputs: 8 | % vobj mp4 video object. the video will not be valid until you call 9 | % vobj.close 10 | % 11 | % Edit your code in ** three ** places 12 | % 13 | % vobj = []; 14 | % for iter = 1:10 15 | % ... 16 | % drawnow; 17 | % vobj = figmp4('myvideo.mp4',vobj); 18 | % end 19 | % vobj.close; 20 | % 21 | if ~exist('nf','var') 22 | nf = 1; 23 | end 24 | if isempty(vobj) 25 | vobj = VideoWriter(name,'MPEG-4'); 26 | vobj.Quality = 100; 27 | %vobj = VideoWriter(name,'Archival'); 28 | vobj.open; 29 | end 30 | im = getfield(getframe(gcf),'cdata'); 31 | for f = 1:nf 32 | vobj.writeVideo(im); 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /utility/gold.m: -------------------------------------------------------------------------------- 1 | function g = gold() 2 | % GOLD return a gold color 3 | % 4 | % g = gold() 5 | % 6 | % Outputs: 7 | % g 1 by 3 gold rgb values 8 | % 9 | 10 | g = [255 228 58]/255; 11 | 12 | end 13 | -------------------------------------------------------------------------------- /utility/gptoolbox_version.m: -------------------------------------------------------------------------------- 1 | function v = gptoolbox_version() 2 | % GPTOOLBOX_VERSION Returns version of GPTOOLBOX as a string 3 | % 4 | % v = gptoolbox_version() 5 | % 6 | 7 | % This file should contain the current version number of gptoolbox 8 | % World.Major.Minor 9 | % Anyone may increment Minor to indicate a small change. 10 | % Major indicates a large change or large number of changes. 11 | % World indicates a substantial change or release. 12 | v = '0.1.2'; 13 | end 14 | -------------------------------------------------------------------------------- /utility/is_writable.m: -------------------------------------------------------------------------------- 1 | function flag = is_writable(name) 2 | % IS_WRITABLE Determine if a path is writable 3 | % 4 | % flag = is_writable(name) 5 | % 6 | % Inputs: 7 | % name path to check 8 | % Outputs: 9 | % flag whether writable 10 | if exist(name,'file') 11 | [~,attribs] = fileattrib(name); 12 | flag = attribs.UserWrite; 13 | return; 14 | end 15 | dirname = fileparts(name); 16 | if exist(dirname,'file') 17 | [~,attribs] = fileattrib(dirname); 18 | flag = attribs.UserWrite; 19 | return; 20 | end 21 | flag = false; 22 | end 23 | -------------------------------------------------------------------------------- /utility/lipmanya.m: -------------------------------------------------------------------------------- 1 | function CM = yaron_colormap(n) 2 | CM = hex2rgb([ 3 | 'ce517e' 4 | 'd16486' 5 | 'd47890' 6 | 'd88a95' 7 | 'dd9c9e' 8 | 'e0ada7' 9 | 'e5beaf' 10 | 'ead1ba' 11 | 'efe2c3' 12 | 'e6e6c4' 13 | 'cfd7bc' 14 | 'b9ccb5' 15 | 'a4c2af' 16 | '8db7a8' 17 | '77aca1' 18 | '54a49e' 19 | '309c96' 20 | '159592' 21 | ]); 22 | if nargin>=1 23 | CM = interp1(linspace(0,1,size(CM,1))',CM,linspace(0,1,n)','spline'); 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /utility/orange.m: -------------------------------------------------------------------------------- 1 | function C = orange() 2 | % ORANGE Returns a nice orange color 3 | % 4 | % Outputs: 5 | % [1.0 0.7 0.2] 6 | % 7 | C = [1.0 0.7 0.2]; 8 | end 9 | -------------------------------------------------------------------------------- /utility/pink.m: -------------------------------------------------------------------------------- 1 | function C = pink() 2 | % PINK Returns a nice pink color 3 | % 4 | % Outputs: 5 | % [254 194 194]/255; 6 | C = [254 194 194]/255;; 7 | end 8 | 9 | -------------------------------------------------------------------------------- /utility/pride.m: -------------------------------------------------------------------------------- 1 | function CM = pride(n) 2 | if nargin<1 3 | n = 8; 4 | end 5 | CM = [ 6 | 0.47450980392156861,0.00000000000000000,0.48235294117647060 7 | 0.18823529411764706,0.00000000000000000,0.52549019607843139 8 | 0.09019607843137255,0.70980392156862748,0.69803921568627447 9 | 0.06666666666666667,0.49803921568627452,0.00784313725490196 10 | 1.00000000000000000,0.99607843137254903,0.03921568627450980 11 | 0.98823529411764710,0.47843137254901963,0.03137254901960784 12 | 0.98431372549019602,0.00000000000000000,0.02745098039215686 13 | 0.98823529411764710,0.29803921568627451,0.64705882352941180 14 | ]; 15 | assert(n<=8); 16 | CM = CM(1:n,:); 17 | end 18 | -------------------------------------------------------------------------------- /utility/report_mosek_error.m: -------------------------------------------------------------------------------- 1 | function report_mosek_error(r,res) 2 | % REPORT_MOSEK_ERROR issue warning or error on return values from running 3 | % mosekopt 4 | % 5 | % [r,res] = report_mosek_error(r,res) 6 | % 7 | % Example: 8 | % [r,res]=mosekopt('minimize echo(0)',prob,param); 9 | % [r,res] = report_mosek_error(r,res) 10 | % 11 | 12 | % check for mosek error 13 | if(r == 4006) 14 | warning(['MOSEK ERROR. rcode: ' ... 15 | num2str(res.rcode) ' ' ... 16 | res.rcodestr ' ' ... 17 | res.rmsg ... 18 | 'The solution is probably OK, but ' ... 19 | 'to make this error go away, increase: ' ... 20 | 'MSK_DPAR_INTPNT_CO_TOL_REL_GAP' ... 21 | ]); 22 | elseif(r ~= 0) 23 | error(['FATAL MOSEK ERROR. rcode: ' ... 24 | num2str(res.rcode) ' ' ... 25 | res.rcodestr ' ' ... 26 | res.rmsg]); 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /utility/startup.m: -------------------------------------------------------------------------------- 1 | % Custom startup which loads last working directory and workspace 2 | % 3 | % See also: finish 4 | 5 | lastworkspace = '/var/tmp/lastworkspace.mat'; 6 | try 7 | load(lastworkspace); 8 | catch 9 | disp('Sorry, but I could not load last workspace from:') 10 | disp(lastworkspace) 11 | end; 12 | 13 | if ispref('my','LastWorkingDirectory') 14 | lwd = getpref('my','LastWorkingDirectory'); 15 | try 16 | cd(lwd) 17 | catch 18 | warning('Sorry, could not change to your last working directory: %s', lwd); 19 | end; 20 | end; 21 | clear lwd; 22 | 23 | com.mathworks.mde.desk.MLDesktop.getInstance.restoreLayout('figure-command-history'); 24 | clear lwd; 25 | format short g; 26 | -------------------------------------------------------------------------------- /utility/teal.m: -------------------------------------------------------------------------------- 1 | function C = teal() 2 | % TEAL Returns a nice teal color 3 | % 4 | % Outputs: 5 | % [144 216 196]/255 6 | % 7 | % Example: 8 | % reshape(dec2hex(round(teal*255))',1,[]) 9 | C = [144 216 196]/255; 10 | end 11 | 12 | -------------------------------------------------------------------------------- /utility/tempprefix.m: -------------------------------------------------------------------------------- 1 | function T = tempprefix(D); 2 | % TEMPPREFIX returns a unique name prefix, starting with the given directory 3 | % suitable for use as a prefix for temporary files. 4 | % 5 | % T = tempprefix(D) 6 | % T = tempprefix() same as above but uses builtin tempdir as D 7 | % 8 | % Inputs: 9 | % D name of directory to find prefix 10 | % Outputs: 11 | % T unique temp prefix 12 | % 13 | % Copyright 2011, Alec Jacobson (jacobson@inf.ethz.ch) 14 | % 15 | % See also: tempname 16 | % 17 | 18 | while(true) 19 | if(exist('D','var')) 20 | T = tempname(D); 21 | else 22 | T = tempname(); 23 | end 24 | if(isempty(dir([T '*']))) 25 | break; 26 | end 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /utility/zoe.m: -------------------------------------------------------------------------------- 1 | function CM = zoe(varargin) 2 | if nargin < 1 3 | n = 128; 4 | else 5 | n = varargin{1}; 6 | end 7 | if nargin < 2 8 | alpha = 0.95; 9 | else 10 | alpha = varargin{2}; 11 | end 12 | 13 | t = [0;0.5 - 1e-5;0.5 + 1e-5;1]; 14 | h = ['ffffff'; '489acc'; 'fffae3'; 'ff7424']; 15 | c = hex2rgb(h); 16 | 17 | 18 | CM = interp1(t,c,linspace(0,1,2*n)','linear'); 19 | CM(2:2:end,:) = CM(2:2:end,:) * alpha; 20 | end 21 | -------------------------------------------------------------------------------- /wrappers/find_first_path.m: -------------------------------------------------------------------------------- 1 | function [s] = find_first_path(guesses,quiet) 2 | % [s] = find_first_path(guesses,quiet) 3 | si = find(cellfun(@(guess) exist(guess,'file'),guesses),1,'first'); 4 | if isempty(si) 5 | if nargin>1 && quiet 6 | s = []; 7 | return; 8 | else 9 | error('Could not find path'); 10 | end 11 | end 12 | s = guesses{si}; 13 | end 14 | -------------------------------------------------------------------------------- /wrappers/meshfix.m: -------------------------------------------------------------------------------- 1 | function [W,G] = meshfix(V,F) 2 | % Call Marco Atene's MESHFIX on a mesh 3 | % 4 | % [W,G] = meshfix(V,F) 5 | % 6 | % Inputs: 7 | % V #V by 3 list of mesh vertex positions 8 | % F #F by 3 list of triangle indices 9 | % Outputs: 10 | % W #W by 3 list of output mesh vertex positions 11 | % G #G by 3 list of output triangle indices 12 | % 13 | prefix = tempname; 14 | off_filename = [prefix '.off']; 15 | off_filename_fixed = [prefix '_fixed.off']; 16 | writeOFF(off_filename,V,F); 17 | flags = ''; 18 | command = [path_to_meshfix ' ' flags ' ' off_filename]; 19 | [status, result] = system(command); 20 | if status ~= 0 21 | fprintf(command); 22 | error(result); 23 | end 24 | [W,G] = readOFF(off_filename_fixed); 25 | 26 | delete(off_filename); 27 | delete(off_filename_fixed); 28 | end 29 | -------------------------------------------------------------------------------- /wrappers/path_to_convert.m: -------------------------------------------------------------------------------- 1 | function s = path_to_convert() 2 | % PATH_TO_CONVERT 3 | % 4 | % s = path_to_convert() 5 | % 6 | % Outputs: 7 | % s path to convert executable 8 | % 9 | % See also: path_to_qslim 10 | % 11 | 12 | if ispc 13 | % replace this with path 14 | s = 'c:/prg/lib/convert/Release/convert.exe'; 15 | elseif isunix || ismac 16 | [status, s] = system('which convert'); 17 | s = strtrim(s); 18 | if status ~= 0 19 | guesses = { ... 20 | '/usr/local/bin/convert', ... 21 | '/opt/local/bin/convert'}; 22 | s = find_first_path(guesses); 23 | end 24 | end 25 | end 26 | 27 | -------------------------------------------------------------------------------- /wrappers/path_to_eltopo.m: -------------------------------------------------------------------------------- 1 | function s = path_to_eltopo() 2 | % PATH_TO_eltopo Returns absolute, system-dependent path to eltopo header and 3 | % includes 4 | % 5 | % Outputs: 6 | % s path to eltopo base directory as string 7 | % 8 | % See also: eltopo 9 | 10 | if ispc 11 | s = 'c:/prg/lib/eltopo/' 12 | elseif ismac 13 | s = find_first_path({'/usr/local/eltopo'}); 14 | end 15 | 16 | end 17 | 18 | -------------------------------------------------------------------------------- /wrappers/path_to_libigl.m: -------------------------------------------------------------------------------- 1 | function s = path_to_libigl() 2 | % PATH_TO_LIBIGL 3 | % 4 | % s = path_to_libigl() 5 | % 6 | % Returns path to libigl as string 7 | 8 | s = find_first_path({'/usr/local/igl/libigl/','/usr/local/libigl/'}); 9 | end 10 | -------------------------------------------------------------------------------- /wrappers/path_to_medit.m: -------------------------------------------------------------------------------- 1 | function [s] = path_to_medit() 2 | % PATH_TO_MEDIT Return path to medit executable 3 | % 4 | % s = path_to_medit() 5 | % 6 | % Outputs: 7 | % s path to medit executable 8 | % 9 | % See also: medit 10 | % 11 | 12 | 13 | if ispc 14 | s = 'c:/prg/lib/medit/Release/medit.exe'; 15 | elseif isunix || ismac 16 | % I guess this means linux 17 | [status, s] = system('which medit'); 18 | s = strtrim(s); 19 | if status ~= 0 20 | guesses = { ... 21 | '/usr/local/bin/medit', ... 22 | '/opt/local/bin/medit'}; 23 | s = find_first_path(guesses); 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /wrappers/path_to_meshfix.m: -------------------------------------------------------------------------------- 1 | function s = path_to_meshfix() 2 | % PATH_TO_MESHFIX Returns absolute, system-dependent path to meshfix executable 3 | % 4 | % Outputs: 5 | % s path to meshfix as string 6 | % 7 | % See also: meshfix 8 | 9 | if ispc 10 | s = 'c:/prg/lib/meshfix/Release/meshfix.exe'; 11 | elseif isunix || ismac 12 | % I guess this means linux 13 | [status, s] = system('which meshfix'); 14 | s = strtrim(s); 15 | if status ~= 0 16 | guesses = { ... 17 | '/usr/local/bin/meshfix', ... 18 | '/opt/local/bin/meshfix', ... 19 | '/usr/local/igl/libigl/external/MeshFix/meshfix', ... 20 | '/usr/local/libigl/external/MeshFix/meshfix'}; 21 | s = find_first_path(guesses); 22 | end 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /wrappers/path_to_qslim.m: -------------------------------------------------------------------------------- 1 | function s = path_to_qslim() 2 | % PATH_TO_QSLIM 3 | % 4 | % s = path_to_qslim() 5 | % 6 | % Outputs: 7 | % s path to qslim executable 8 | % 9 | % See also: qslim 10 | % 11 | 12 | if ispc 13 | s = 'c:/prg/lib/qslim/Release/qslim.exe'; 14 | elseif isunix || ismac 15 | % I guess this means linux 16 | [status, s] = system('which qslim'); 17 | s = strtrim(s); 18 | if status ~= 0 19 | guesses = { ... 20 | '/usr/local/bin/qslim', ... 21 | '/opt/local/bin/qslim'}; 22 | s = find_first_path(guesses); 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /wrappers/path_to_tetgen.m: -------------------------------------------------------------------------------- 1 | function s = path_to_tetgen() 2 | % PATH_TO_TETGEN Returns absolute, system-dependent path to tetgen executable 3 | % 4 | % Outputs: 5 | % s path to tetgen as string 6 | % 7 | % See also: tetgen 8 | 9 | if ispc 10 | % replace this with path 11 | s = 'c:/prg/lib/tetgen/Release/tetgen.exe'; 12 | elseif ismac || isunix 13 | [status,s] = system('which tetgen'); 14 | s = strtrim(s); 15 | if status ~= 0 16 | guesses = { ... 17 | '/usr/local/bin/tetgen', ... 18 | '/opt/local/bin/tetgen', ... 19 | '/Users/ajx/Repos/tetgen/build/tetgen', ... 20 | '/usr/local/igl/libigl/external/tetgen/tetgen', ... 21 | '/usr/local/libigl/external/tetgen/tetgen'}; 22 | s = find_first_path(guesses); 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /wrappers/path_to_triangle.m: -------------------------------------------------------------------------------- 1 | function s = path_to_triangle() 2 | % PATH_TO_TRIANGLE Returns absolute, system-dependent path to triangle 3 | % executable 4 | % 5 | % Outputs: 6 | % s path to triangle as string 7 | % 8 | % See also: triangle 9 | 10 | if ispc 11 | s = 'c:/prg/lib/triangle/Release/triangle.exe'; 12 | elseif isunix || ismac 13 | [status, s] = system('which triangle'); 14 | s = strtrim(s); 15 | if status ~= 0 16 | guesses = { ... 17 | '/usr/local/bin/triangle', ... 18 | '/opt/local/bin/triangle'}; 19 | s = find_first_path(guesses); 20 | end 21 | end 22 | end 23 | 24 | --------------------------------------------------------------------------------