Skip to content

Commit e801a43

Browse files
committed
Fixed shear executable
1 parent 86b2b69 commit e801a43

File tree

11 files changed

+195
-294
lines changed

11 files changed

+195
-294
lines changed

CMakeLists.txt

Lines changed: 43 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
77
add_compile_options(-fPIC)
88
set(DIR_EXT "${CMAKE_CURRENT_SOURCE_DIR}/ext")
99

10+
# Set options if top level
1011
if (PROJECT_IS_TOP_LEVEL)
1112
# Options for the project
12-
option(USE_PYBIND "Generate pybindings" ON)
1313
option(USE_MULTIPRECISION "Use high precision floating point" OFF)
14-
option(ENABLE_VISUALIZATION "Generate viewers for visualization" ON)
1514
option(CHECK_VALIDITY "Check validity pre and post conditions" ON)
16-
option(BUILD_CURVATURE_METRIC_TESTS "Build tests" ON)
17-
option(USE_SUITESPARSE "Use suite sparse methods for matrix inversion" ON)
15+
option(ENABLE_VISUALIZATION "Generate viewers for visualization" ON)
1816
option(RENDER_TEXTURE "Render results" ON)
17+
option(USE_SUITESPARSE "Use suite sparse methods for matrix inversion" ON)
18+
option(USE_PYBIND "Generate pybindings" ON)
19+
option(BUILD_CURVATURE_METRIC_TESTS "Build tests" ON)
1920

20-
# Set libigl options
21+
# Set libigl and suitesparse options
2122
option(LIBIGL_PREDICATES "Use Predicates" ON)
2223
set ( SUITESPARSE_ENABLE_PROJECTS "suitesparse_config;cholmod;spqr" )
2324
option ( SUITESPARSE_USE_CUDA OFF )
2425
endif()
2526

26-
#find_package(Boost REQUIRED COMPONENTS system filesystem serialization)
27-
2827
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
2928

29+
# Optionally get multiprecision libraries
3030
if(USE_MULTIPRECISION)
3131
# Turning this on activates mpfr in the conformal code
3232
option(LIBIGL_COPYLEFT_CGAL "Use CGAL" ON)
@@ -37,43 +37,33 @@ if(USE_MULTIPRECISION)
3737
link_directories(${MPFR_LIBRARIES_DIR})
3838
endif()
3939

40+
# Set compile definitions
41+
add_compile_definitions(USE_EMBREE)
42+
add_compile_definitions(_USE_MATH_DEFINES)
43+
if(USE_MULTIPRECISION)
44+
add_compile_definitions(MULTIPRECISION)
45+
endif()
4046
if(CHECK_VALIDITY)
4147
add_compile_definitions(CHECK_VALIDITY)
4248
endif()
43-
4449
if (RENDER_TEXTURE)
4550
option(LIBIGL_OPENGL "Use OpenGL" ON)
4651
option(LIBIGL_GLFW "Use GLFW" ON)
4752
option(LIBIGL_PNG "Use PNG" ON)
4853
option(LIBIGL_EMBREE "Use EMBREE" ON)
54+
add_compile_definitions(RENDER_TEXTURE)
4955
endif()
50-
51-
# # Add highfive library
52-
if (USE_HIGHFIVE)
53-
find_package(HDF5 REQUIRED)
54-
include(highfive)
55-
add_library(HighFiveLib INTERFACE)
56-
target_include_directories(HighFiveLib SYSTEM INTERFACE ${highfive_SOURCE_DIR}/include/ ${HDF5_INCLUDE_DIRS})
57-
target_link_libraries(HighFiveLib INTERFACE ${HDF5_LIBRARIES})
58-
add_compile_definitions(USE_HIGHFIVE)
59-
endif()
60-
61-
# Set compile definitions
6256
if(USE_PYBIND)
6357
add_compile_definitions(PYBIND)
6458
endif()
6559

66-
if(USE_MULTIPRECISION)
67-
add_compile_definitions(MULTIPRECISION)
68-
endif()
69-
60+
# Set suitesparse compile definitions
61+
# WARNING: This compile definition publicly links suitesparse into the
62+
# conformal ideal delaunay library
7063
if(USE_SUITESPARSE)
7164
add_compile_definitions(USE_SUITESPARSE)
7265
endif()
7366

74-
add_compile_definitions(USE_EMBREE)
75-
add_compile_definitions(_USE_MATH_DEFINES)
76-
7767
# Get external libraries
7868
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/util")
7969
include(conformal_ideal_delaunay)
@@ -83,32 +73,39 @@ include(cli11)
8373

8474
# Optionally create visualization library
8575
if(RENDER_TEXTURE)
86-
add_library(visualization
76+
add_library(rendering
8777
src/util/visualization.cc
8878
)
89-
target_link_libraries(visualization PUBLIC
79+
target_link_libraries(rendering PUBLIC
9080
igl::core
9181
igl::glfw
9282
igl::png
9383
igl::embree
9484
plot
9585
)
86+
set(RENDER_LIBRARIES
87+
rendering
88+
)
9689
endif()
9790

91+
# Optionally enable polyscope visualization
9892
if(ENABLE_VISUALIZATION)
9993
add_compile_definitions(ENABLE_VISUALIZATION)
100-
endif()
101-
102-
if(ENABLE_VISUALIZATION)
10394
include(polyscope)
10495
set(POLYSCOPE_LIBRARIES
10596
polyscope
10697
)
10798
endif()
10899

100+
# Install executables to bin directory
101+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
102+
109103
# Make main cpp library
110104
add_subdirectory(src)
111105

106+
# Build executables
107+
add_subdirectory(src/app)
108+
112109
# Build pybind optimization functions
113110
if(USE_PYBIND)
114111
include(pybind11)
@@ -120,19 +117,8 @@ if(USE_PYBIND)
120117
target_link_libraries(optimization_py PUBLIC
121118
PennerOptimizationLib
122119
pybind11::module
120+
${RENDER_LIBRARIES}
123121
)
124-
# Link visualization methods if created
125-
if(RENDER_TEXTURE)
126-
add_compile_definitions(RENDER_TEXTURE)
127-
target_link_libraries(optimization_py PRIVATE
128-
visualization
129-
)
130-
endif()
131-
if(USE_HIGHFIVE)
132-
target_link_libraries(optimization_py PUBLIC
133-
HighFiveLib
134-
)
135-
endif()
136122

137123
# Set pybinding settings
138124
set_target_properties(optimization_py PROPERTIES LIBRARY_OUTPUT_DIRECTORY
@@ -143,25 +129,18 @@ if(USE_PYBIND)
143129
)
144130
endif()
145131

146-
if(APPLE OR NOT UNIX)
147-
add_subdirectory(src/app)
148-
endif()
132+
# Optionally build tests (only valid for double precision)
133+
if((BUILD_CURVATURE_METRIC_TESTS) AND (NOT USE_MULTIPRECISION))
134+
include(Catch2)
149135

150-
# Following libraries only valid for double
151-
if(NOT USE_MULTIPRECISION)
152-
# Optionally build tests
153-
if(BUILD_CURVATURE_METRIC_TESTS)
154-
include(Catch2)
155-
156-
# Build testing executable
157-
add_executable(CurvatureMetricTests
158-
src/tests/tests.cpp
159-
)
160-
target_link_libraries(CurvatureMetricTests PRIVATE
161-
PennerOptimizationLib
162-
Catch2::Catch2WithMain
163-
)
164-
set(TEST_DATA_ROOT "${PROJECT_SOURCE_DIR}/src/tests/regression/")
165-
target_compile_definitions(CurvatureMetricTests PUBLIC TEST_DATA_DIR=\"${TEST_DATA_ROOT}\")
166-
endif()
136+
# Build testing executable
137+
add_executable(CurvatureMetricTests
138+
src/tests/tests.cpp
139+
)
140+
target_link_libraries(CurvatureMetricTests PRIVATE
141+
PennerOptimizationLib
142+
Catch2::Catch2WithMain
143+
)
144+
set(TEST_DATA_ROOT "${PROJECT_SOURCE_DIR}/src/tests/regression/")
145+
target_compile_definitions(CurvatureMetricTests PUBLIC TEST_DATA_DIR=\"${TEST_DATA_ROOT}\")
167146
endif()

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
An implementation of [Metric Optimization in Penner Coordinates](https://dl.acm.org/doi/10.1145/3618394).
88

9-
![Contour pipeline](media/teaser.jpg)
9+
![Parameterization with interpolation](media/teaser.jpg)
1010

1111
### Overview
1212

@@ -54,7 +54,12 @@ Scripts to generate the figures of "Metric Optimization in Penner Coordinates" a
5454
TODO
5555
The models (with parameterizations) and cameras used in [Algebraic Smooth Occluding Contours](http://ryanjcapouellez.com/papers/algebraic_smooth_occluding_contours.html) necessary for these scripts can be downloaded [here](http://ryanjcapouellez.com/papers/algebraic-contours-data.zip); they must be copied to `data/meshes` and `data/cameras` respectively.
5656

57-
The figure bash scripts can be run independently or in batch with the command
57+
A Conda environment must be activated (before compiling the code) with
58+
```
59+
conda env create -f environment.yml
60+
conda activate penner-optimization
61+
```
62+
The figure bash scripts can then be run independently or in batch with
5863
```
5964
bash fig-all.sh
6065
```

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: curvature-metric
1+
name: penner-optimization
22
channels:
33
- conda-forge
44
- defaults

src/app/CMakeLists.txt

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
add_executable(conformal_metric
2-
conformal_metric.cpp
3-
)
4-
target_link_libraries(conformal_metric PRIVATE
5-
PennerOptimizationLib
6-
)
7-
if(USE_SUITESPARSE)
8-
target_link_libraries(conformal_metric PRIVATE
9-
SuiteSparse::SuiteSparseConfig
10-
SuiteSparse::CHOLMOD
11-
)
12-
endif()
13-
141
add_executable(optimize_metric
152
optimize_metric.cpp
163
)
@@ -23,7 +10,8 @@ add_executable(optimize_shear
2310
optimize_shear.cpp
2411
)
2512
target_link_libraries(optimize_shear PRIVATE
26-
PennerOptimizationLib
13+
PennerOptimizationLib
14+
CLI11::CLI11
2715
)
2816

2917
add_executable(plot_shear_energy

src/app/conformal_metric.cpp

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/app/optimize_metric.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main(int argc, char* argv[])
6161

6262
spdlog::set_level(spdlog::level::info);
6363
std::filesystem::create_directories(output_dir);
64-
opt_params->output_dir = output_dir;
64+
opt_params->output_dir = output_dir;
6565

6666
// TODO Make this automatic
6767
if (use_discrete_metric)

0 commit comments

Comments
 (0)