Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rarora7777/smooth-closest-point
A "smooth closest point" operator for projecting points near a triangle mesh onto the mesh, while avoiding undesirable projection onto edges.
https://github.com/rarora7777/smooth-closest-point
closest-point geometry-processing sketching virtual-reality
Last synced: 15 days ago
JSON representation
A "smooth closest point" operator for projecting points near a triangle mesh onto the mesh, while avoiding undesirable projection onto edges.
- Host: GitHub
- URL: https://github.com/rarora7777/smooth-closest-point
- Owner: rarora7777
- Created: 2019-02-13T15:55:51.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-16T21:23:40.000Z (over 3 years ago)
- Last Synced: 2024-10-24T04:25:52.623Z (2 months ago)
- Topics: closest-point, geometry-processing, sketching, virtual-reality
- Language: C++
- Homepage:
- Size: 1.56 MB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Code to compute offset-surfaces around a manifold triangle mesh, tetrahedral mesh the space between the inner and outer offset surfaces (the _shell_), and embed the tetrahedral mesh in a higher-dimensional space. This higher-dimensional embedding can then be used for smooth closest-point queries for object within the shell.
Adapted from [Panozzo et al. 2013], see below.
# Build Instructions
Dependencies: [OpenMesh](https://www.graphics.rwth-aachen.de/software/openmesh/download/) (7.1 or higher), [Eigen3](http://eigen.tuxfamily.org/index.php?title=Main_Page), [libigl](https://github.com/libigl/libigl/). [TetWild](https://github.com/Yixin-Hu/TetWild) is also recommended, but is not required for building the application.
Please modify the paths below based on your machine. `LIBIGL_DIR` should point to the libigl root folder and `Eigen3_DIR` should point to the folder containing `Eigen3Config.cmake`.
## Windows
```
mkdir build
cd build
cmake .. -DLIBIGL_DIR="D:/dev/libigl" -DEigen3_DIR="D:/dev/eigen3/build"
cmake --build . --config Release
```## Linux/MacOS
```
mkdir build
cd build
cmake .. -DLIBIGL_DIR="/usr/local/libigl" -DEigen3_DIR="/usr/local/eigen3/build" -DCMAKE_BUILD_TYPE=Release
cmake --build .
```# Usage
## Pre-processing
For pre-processing (compute and embed shell tet mesh), the main point of entry is `computeAndSaveOffsetSurfaces` followed by `computeAndSaveEmbedding`.- Add the following to the MATLAB path: `./`, `./matlab/`, and `./decimator/`.
- Download a manifold triangle mesh in Wavefront OBJ format to `./data/`. Let's call it `bunny.obj`.
- In MATLAB, run `computeAndSaveEmbedding("bunny")`.
- [Optional, but recommended] Use TetWild to improve mesh quality of the offset surfaces `./data/bunny_out_cgal.obj` and `./data/bunny_in_cgal.obj`. For objects that are thin everywhere, the inner offset surface may be absent. Please ensure that the TetWild-processed surfaces are located at `./data/bunny_out.obj` and `./data/bunny_in.obj` (if inner surface exists). If not using TetWild, simply rename the files (remove `_cgal`).
- In MATLAB, run `computeAndSaveEmbedding("bunny", 1000)`. This may take a while. Higher the value of the second parameter, better the embedding quality but higher the runtime for this step. The triangle and tetrahedral meshes are created in a simple text format at `./data/bunny_tri.txt` and `./data/bunny_tet.txt`. Use `readMesh("./data/bunny_tri.txt", 3, 8)` and `readMesh("./data/bunny_tet.txt", 4, 8)` to read and view these meshes, if required.Note that the main technical component is `embedMeshAndSpace.m`. The rest is boilerplate code.
## Runtime
Call functions in `Phong.dll` (`Phong.so`/`Phong.dylib` on Linux/MacOS). Typical usage:
- Create a `Phong` object using `createPhongObject()`.
- For every point that needs to be projected, call `project()` or `projectBruteForce()`.
- Delete the `Phong` object using `deletePhongObject()`.Please see `src/phong/Phong.h` for details. The exported functions are at the bottom of the file in an `extern "C"` block.
## Other uses (not well-documented yet)
- Create splines on a triangle mesh using `splineOnSurface`. Add `./bspline/` to MATLAB path to use this.
- Generate a smooth curve on a triangle mesh with a prescribed target complexity (length of curve and length of Gauss map) using `generateCurveOnMesh`. Requires [geodesic_matlab](https://github.com/rarora7777/geodesic_matlab).
- For a curve on the mesh, compute "keypoints" on it using `computeKeypoints`. These keypoints lie at curvature extrema and are generally well-spaced (not too close or too far from each other).# License
In accordance with the license associated with Panozzo et al.'s original repo, this code is free to use for non-commercial applications, including my changes and additions.
# Stuff from Panozzo et al.'s original repo
------ IntroductionReference implementation for the paper Weighted Averages on Surfaces
Daniele Panozzo, Ilya Baran, Olga Diamanti, Olga Sorkine
SIGGRAPH 2013This code is free to use for non-commercial applications, please cite our paper if you use it in your project.
@article{Panozzo:WA:2013,
author = {Daniele Panozzo and Ilya Baran and Olga Diamanti and Olga Sorkine-Hornung},
title = {Weighted Averages on Surfaces},
journal = {ACM Transactions on Graphics (proceedings of ACM SIGGRAPH)},
volume = {32},
number = {4},
year = {2013},
}------ Content of the package:
The code is divided into three parts:
1) Euclidean embedding metric computation (matlab) Section 3.5
This can be used independently, the script that contains the implementation is WA_precompute.m.
It depends on the fast_marching toolbox from Gabriel Peyre (http://www.mathworks.com/matlabcentral/fileexchange/6110-toolbox-fast-marching) and on OpenMesh(http://www.openmesh.org).2) Phong Projection (C++)
This can be used independently, it is contained two files (TrianglePhong.h and TrianglePhong.cpp) and it only requires Eigen to be compiled. See the comments in the header file for more details.
3) Weighted Averages (C++)
It depends on Eigen and on the libigl 0.2.1 (http://igl.ethz.ch/projects/libigl/).
4) Matlab wrapper for the entire system
While the C++ code in 2) and 3) should be called directly from your C++ application to achieve good performances, we also provide two simple matlab wrappers that can be used to experiment with the method.
The two main methods are WA_forward.m and WA_inverse.m that solve the forward and inverse problem respectively. We also included a simple command-line test application WA_check.m and an interactive application that locally parametrize a mesh WA_starthere.m.
------ Dependencies
Matlab: Fast-marching toolbox (http://www.mathworks.com/matlabcentral/fileexchange/6110-toolbox-fast-marching), OpenMesh(http://www.openmesh.org).
C++: Eigen 3.2.0 (http://eigen.tuxfamily.org/), libigl(http://igl.ethz.ch/projects/libigl/)All the dependencies (except OpenMesh) are included in the package for convenience.
Version 1.0 - August 14th 2013