• Stars
    star
    125
  • Rank 286,335 (Top 6 %)
  • Language
    C++
  • License
    MIT License
  • Created over 4 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A robust Laplace matrix for general (possibly nonmanifold) triangle meshes, and point clouds [Sharp & Crane SGP 2020]

nonmanifold-laplacians

Robust Laplace operators for general (possibly nonmanifold) triangle meshes and point clouds. For details, see A Laplacian for Nonmanifold Triangle Meshes by Nicholas Sharp and Keenan Crane from SGP 2020.

For Python bindings (with pip package), see https://github.com/nmwsharp/robust-laplacians-py

This method efficiently generates a high-quality V x V Laplace matrix for any (possibly nonmanifold, with or without boundary) triangular 3D surface mesh. In particular, the resulting Laplacian will always satisfy the maximum principle, with all-positive edge weights between nodes. The method can also produce a similar Laplacian for a point cloud.

The core algorithm is implemented in geometry-central. This is a simple application which loads a mesh or point cloud, builds our intrinsic tufted cover, and generates the resulting Laplace (and mass) matrix.

As a command-line tool, the program will output matrices in a simple format which can be read in by other programs (including MATLAB, etc). It can also be run with the --gui flag, to create a window and visualize the relevant data---though be wary that this visualization is significantly more expensive and less robust than the main algorithm.

GUI demo gif

Building and running

On unix-like machines, use:

git clone --recurse-submodules https://github.com/nmwsharp/nonmanifold-laplacian
cd nonmanifold-laplacian
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
./bin/tufted-idt /path/to/your/mesh.obj

The codebase also builds on Visual Studio 2017 & 2019, by using CMake to generate a Visual Studio solution file.

The input should be a mesh or point cloud; any inputs with no faces will be processed as point clouds. Use the --gui flag to load a 3D gui to inspect the results.

If the input contains unreferenced vertices that do not appear in any face, the program will still ensure that the resulting matices have the same dimensions and indexing as the input vertex set by adding dummy rows. Optional parameters below control what values are inserted into these dummy rows; the defaults set 1 for the diagonal of the Laplacian and a small positive value for the diagonal of the mass matrix, to yield matrices which are full rank.

Options

Use --help for defaults, etc.

flag purpose
--gui Show the GUI
--mollifyFactor Amount of intrinsic mollification to apply, relative to the mesh length scale. Larger values will lend robustness to floating-point degeneracy, though very large values will distort geometry. Reasonable range is roughly 0 to 1e-3. Default: 1e-6
--nNeigh Number of nearest-neighbors to be used for point cloud Laplacian. The construction is not very sensitive to this parameter, it usually does not need to be tweaked. Default: 30
--laplacianReplace For any unreferenced vertices in the input, put this this value in the diagonal of the Laplace matrix. Default: 1
--massReplace For any unreferenced vertices in the input, put this this value in the diagonal of the mass matrix. Negative values will interpreted relative to the smallest mass entry among referenced vertices, like X times the smallest mass. Default: -1e-3
--outputPrefix Prefix to prepend to all output file paths. Default: tufted_
--writeLaplacian Write the resulting Laplace matrix. A sparse VxV matrix, holding the weak Laplace matrix (that is, does not include mass matrix). Name: laplacian.spmat
--writeMass Write the resulting mass matrix. A sparse diagonal VxV matrix, holding lumped vertex areas. Name: lumped_mass.spmat

Output formats

Sparse matrices are output as an ASCII file where each line one entry in the matrix, giving the row, column, and value. The row and column indices are 1-indexed to make matlab happy. These files can be automatically loaded in matlab (see here). Parsers in other environments should be straightforward.

Known issues

This implementation is not the same code which was used to generate the results in the paper. If you need exact comparisons, please contact the authors.

Direct dependencies

(all are permissively licensed, and packaged with the repo)

Citation

@article{Sharp:2020:LNT,
  author={Nicholas Sharp and Keenan Crane},
  title={{A Laplacian for Nonmanifold Triangle Meshes}},
  journal={Computer Graphics Forum (SGP)},
  volume={39},
  number={5},
  year={2020}
}

More Repositories

1

polyscope

A C++ & Python viewer for 3D data like meshes and point clouds
C++
1,789
star
2

geometry-central

Applied 3D geometry in C++, with a focus on surface meshes.
C++
1,068
star
3

potpourri3d

An invigorating blend of 3D geometry tools in Python.
Python
411
star
4

diffusion-net

Pytorch implementation of DiffusionNet for fast and robust learning on 3D surfaces like meshes or point clouds.
Python
402
star
5

happly

A C++ header-only parser for the PLY file format. Parse .ply happily!
C++
306
star
6

robust-laplacians-py

Build high-quality Laplace matrices on meshes and point clouds in Python. Implements [Sharp & Crane SGP 2020].
C++
199
star
7

neural-implicit-queries

Queries on neural implicit surfaces via range analysis: ray casting, intersection, closest point, & more. SIGGRAPH 2022 paper. JAX implementation.
Python
172
star
8

neural-physics-subspaces

Fit low-dimensional subspaces to physical systems with neural networks (SIGGRAPH 2023)
Python
151
star
9

DDGSpring2016

Code repository for 15-869 Discrete Differential Geometry at CMU in Spring 2016.
Python
121
star
10

intrinsic-triangulations-tutorial

An introductory course intrinsic triangulations for powerful & robust geometry processing --- tutorial code and links.
Python
121
star
11

learned-triangulation

Source code for "PointTriNet: Learned Triangulation of 3D Point Sets", by Nicholas Sharp and Maks Ovsjanikov at ECCV 2020
Python
104
star
12

variational-surface-cutting

Codebase for "Variational Surface Cutting" by Sharp & Crane, SIGGRAPH 2018
C++
90
star
13

flip-geodesics-demo

Construct geodesic paths, loops, networks on surface with a fast and simple edge flipping algorithm. C++ demo app and more.
C++
90
star
14

vector-heat-demo

C++ demo of the Vector Heat Method (Sharp, Soliman, and Crane. 2019.)
C++
59
star
15

gc-polyscope-project-template

A template project to get started with geometry-central and Polyscope.
C++
47
star
16

navigating-intrinsic-triangulations-demo

Demo code for "Navigating Intrinsic Triangulations". Sharp, Soliman, and Crane. 2019
C++
47
star
17

polyscope-py

Python bindings for Polyscope
Python
33
star
18

arrgh

A small python utility to pretty-print a table summarizing arrays & scalars from numpy, pytorch, etc.
Python
26
star
19

discretization-robust-correspondence-benchmark

Benchmark for the generalization of 3D machine learning models across different remeshing/samplings of a surface.
Python
16
star
20

geometry-central-tutorials

Tutorials for the geometry-central geometry processing library.
C++
11
star
21

libigl-polyscope-project-template

An example project and build system using libIGL and Polyscope
CMake
8
star
22

RNA-Surface-Segmentation-Dataset

A dataset of segmented RNA molecule surfaces, as a benchmark task in 3D machine learning on surfaces. From Poulenard et al., 3DV 2019.
8
star
23

recipes

Food, food, food
HTML
4
star
24

polyscope-docs

Documentation for polyscope
HTML
3
star
25

nmwsharp.github.io

HTML
1
star