diff --git a/.gitignore b/.gitignore index 6ab33f6..1771bfd 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ /cmake-build-* /build* /external* +/data diff --git a/.travis.yml b/.travis.yml index d479abf..f082928 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,7 @@ matrix: env: - MATRIX_EVAL="export CC=gcc-7 && CXX=g++-7 && CONFIG=Debug && NPROC=2" - os: osx + osx_image: xcode10.2 compiler: clang env: - MATRIX_EVAL="export CONFIG=Debug && NPROC=2" diff --git a/README.md b/README.md index 5694c6b..a1e4f75 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Voroffset +[![Build Status](https://travis-ci.com/geometryprocessing/voroffset.svg?branch=master)](https://travis-ci.com/geometryprocessing/voroffset) + Discrete mesh offsetting based on half-space Voronoi diagrams and Power diagrams. ### Compilation @@ -9,7 +11,8 @@ Dependencies are downloaded automatically by CMake at configuration time. To com ```bash mkdir build cd build -cmake -j8 +cmake .. +cmake --build . -j8 --config Release ``` ### Running the code @@ -59,3 +62,7 @@ Options: -f,--force Overwrite output file -u,--radius_in_mm Radius is given in mm instead ``` + +### Replicability + +Head over to the [scripts/](scripts/) folder for further instructions. diff --git a/cmake/VoroffsetDownloadExternal.cmake b/cmake/VoroffsetDownloadExternal.cmake index 135b4cf..6605b06 100644 --- a/cmake/VoroffsetDownloadExternal.cmake +++ b/cmake/VoroffsetDownloadExternal.cmake @@ -26,8 +26,9 @@ endfunction() ## Eigen function(voroffset_download_eigen) voroffset_download_project(eigen - URL http://bitbucket.org/eigen/eigen/get/3.3.7.tar.gz - URL_MD5 f2a417d083fe8ca4b8ed2bc613d20f07 + GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git + GIT_TAG tags/3.3.7 + GIT_SHALLOW TRUE ) endfunction() diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..2a53a38 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,10 @@ +### Replicability + +To reproduce Figure 19 of the paper, simply run the bash script `./fig19.sh` from the terminal. +This will download the input data, compile and run the code. To produce the rendering in the paper, you will need to use [PyRenderer](https://github.com/qnzhou/PyRenderer) and Mitsuba. Those are available via docker. Make sure that [docker](https://docs.docker.com/storage/storagedriver/overlayfs-driver/) is configured with the `overlay2` driver enabled. Otherwise, you may simply open the resulting meshes from the `data/output/` folder that are produced by the script. + +:warning: This script uses Docker, which might require to be run with sudo access. If you use a recent version (>= 19.3), you can add yourself to the `docker` group (root-equivalent) as documented [here](https://docs.docker.com/install/linux/docker-ce/ubuntu/): + +``` +sudo usermod -aG docker your-user +``` diff --git a/scripts/fig19.sh b/scripts/fig19.sh new file mode 100755 index 0000000..c816609 --- /dev/null +++ b/scripts/fig19.sh @@ -0,0 +1,40 @@ +#! /bin/bash + +SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P )" +BUILD_DIR=${SCRIPT_DIR}/../build +DATA_DIR=${SCRIPT_DIR}/../data +OUTPUT_DIR=${SCRIPT_DIR}/../data/output + +CONTAINER="docker run -it --rm -v ${OUTPUT_DIR}:${OUTPUT_DIR} qnzhou/pyrender" + +# Step 1: Download data and compile the code + +mkdir -p ${DATA_DIR} +if [ ! -f ${DATA_DIR}/filigree.ply ]; then + wget https://github.com/geometryprocessing/voroffset/releases/download/1.0/filigree.ply -O ${DATA_DIR}/filigree.ply +fi + +mkdir -p ${BUILD_DIR} +if [ ! -f ${BUILD_DIR}/offset3d ]; then + pushd ${BUILD_DIR} + cmake .. + make -j 8 + popd +fi + +# Step 2: Run offset algorithm + +mkdir -p ${OUTPUT_DIR} + +${BUILD_DIR}/offset3d ${DATA_DIR}/filigree.ply -o ${OUTPUT_DIR}/morph_dexelized.obj -f -n 256 -r 3 -p 3 -x noop +${BUILD_DIR}/offset3d ${DATA_DIR}/filigree.ply -o ${OUTPUT_DIR}/morph_dilation.obj -f -n 256 -r 3 -p 3 -x dilation +${BUILD_DIR}/offset3d ${DATA_DIR}/filigree.ply -o ${OUTPUT_DIR}/morph_erosion.obj -f -n 256 -r 3 -p 3 -x erosion +${BUILD_DIR}/offset3d ${DATA_DIR}/filigree.ply -o ${OUTPUT_DIR}/morph_closing.obj -f -n 256 -r 3 -p 3 -x closing +${BUILD_DIR}/offset3d ${DATA_DIR}/filigree.ply -o ${OUTPUT_DIR}/morph_opening.obj -f -n 256 -r 3 -p 3 -x opening + +# Step 3: Render pretty pictures + +cp ${SCRIPT_DIR}/morph.json ${OUTPUT_DIR} +pushd ${OUTPUT_DIR} +${CONTAINER} bash -c ". /usr/local/mitsuba/setpath.sh; mkdir -p ${OUTPUT_DIR}; cd ${OUTPUT_DIR}; render.py --renderer mitsuba -S `pwd`/morph.json;" +popd diff --git a/scripts/morph.json b/scripts/morph.json new file mode 100644 index 0000000..577080d --- /dev/null +++ b/scripts/morph.json @@ -0,0 +1,60 @@ +{ + "views": [ + { + "type": "mesh_only", + "width": 1600, + "height": 1600, + "transparent_bg": true, + "background": "n", + "mesh": "morph_dexelized.obj", + "wire_frame": false, + "color": "gray", + "name": "morph_dexelized.png" + }, + { + "type": "mesh_only", + "width": 1600, + "height": 1600, + "transparent_bg": true, + "background": "n", + + "mesh": "morph_erosion.obj", + "wire_frame": false, + "color": "gray", + "name": "morph_erosion.png" + }, + { + "type": "mesh_only", + "width": 1600, + "height": 1600, + "transparent_bg": true, + "background": "n", + "mesh": "morph_dilation.obj", + "wire_frame": false, + "color": "gray", + "name": "morph_dilation.png" + }, + { + "type": "mesh_only", + "width": 1600, + "height": 1600, + "transparent_bg": true, + "background": "n", + "mesh": "morph_opening.obj", + "wire_frame": false, + "color": "gray", + "name": "morph_opening.png" + }, + { + "type": "mesh_only", + "width": 1600, + "height": 1600, + "transparent_bg": true, + "background": "n", + "mesh": "morph_closing.obj", + "wire_frame": false, + "color": "gray", + "name": "morph_closing.png" + } + ] +}