11[ ![ OpenABF] ( docs/images/banner.svg )] ( https://gitlab.com/educelab/OpenABF )
22
3- ** OpenABF** is a header-only library of angle-based flattening algorithms for
4- C++. It is designed to be as simple as possible to integrate into existing
5- projects .
3+ ** OpenABF** is a single-header C++ library of angle-based flattening algorithms.
4+ The templated interface is designed for simple out-of-the-box use, and
5+ integration with existing geometric processing pipelines is quick and easy .
66
7- ## Requirements
8- * [ Eigen 3.3+] ( http://eigen.tuxfamily.org/ )
9-
10- ## Installation
11- ### CMake
12- This project is configured and installed using the CMake build system:
13-
14- ``` shell
15- mkdir build
16- cmake -S . -B build/
17- cmake --install build/
18- ```
19-
20- This will install the OpenABF header(s) to your default system path and provide
21- an easy method to link OpenABF against your own CMake project:
22-
23- ``` cmake
24- # Find OpenABF libraries
25- find_package(OpenABF REQUIRED)
26-
27- # Link to an executable
28- add_executable(MyTarget main.cpp)
29- target_link_libraries(MyTarget OpenABF::OpenABF)
30- ```
31-
32- The CMake project provides a number of flags for configuring the installation:
33- - ` OPENABF_MULTIHEADER ` : Install the multi-header version of OpenABF
34- (Default: OFF)
35- - ` OPENABF_BUILD_TESTS ` : Build project unit tests. This will download and build
36- the Google Test framework. (Default: OFF)
37- - ` OPENABF_BUILD_DOCS ` : Build documentation. Dependencies: Doxygen, Graphviz
38- (optional). (Default: ON if Doxygen is found)
39-
40- ### Manual
41- Copy and paste the contents of ` single_include ` to your project or include path.
42- As this project requires Eigen, you also need to add that project to your
43- include path.
7+ ## Dependencies
8+ - C++14 compiler
9+ - [ Eigen 3.3+] ( http://eigen.tuxfamily.org/ )
10+ - CMake 3.15+ (optional)
4411
4512## Usage
13+ The following example demonstrates how to construct and parameterize a mesh
14+ with OpenABF:
15+
4616``` c++
4717#include < OpenABF/OpenABF.hpp>
4818
4919// Alias algorithms for convenience
5020using ABF = OpenABF::ABFPlusPlus<float >;
5121using LSCM = OpenABF::AngleBasedLSCM<float , ABF::Mesh>;
5222
53- // Make a new mesh
23+ // Make a triangular pyramid mesh
5424auto mesh = ABF::Mesh::New();
5525mesh->insert_vertex (0, 0, 0);
5626mesh->insert_vertex(2, 0, 0);
@@ -67,36 +37,120 @@ for (const auto& v : mesh->vertices()) {
6737}
6838
6939// Compute parameterized angles
70- ABF abf;
71- abf.setMesh(mesh);
72- abf.compute();
40+ ABF::Compute(mesh);
7341
7442// Compute mesh parameterization from angles
75- LSCM lscm;
76- lscm.setMesh(mesh);
77- lscm.compute();
43+ LSCM::Compute(mesh);
7844
7945// Print new coordinates
8046for (const auto& v : mesh->vertices()) {
8147 std::cout << v->idx << ": " << v->pos << std::endl;
8248}
8349```
50+ **Note:** The `HalfEdgeMesh` class
51+ [currently assumes](https://gitlab.com/educelab/OpenABF/-/issues/4) that the
52+ surface has a boundary, is manifold, and that the winding order of all faces is
53+ the same. Care should be taken that this assumption is not violated when
54+ constructing your mesh.
55+
56+ ## Installation
57+ ### CMake
58+ This project can be configured and installed using the CMake build system:
59+
60+ ```shell
61+ mkdir build
62+ cmake -S . -B build/
63+ cmake --install build/
64+ ```
65+
66+ This will install the OpenABF header(s) to your system include path and provide
67+ an easy method for including OpenABF inside of your own CMake project:
68+
69+ ``` cmake
70+ # Find OpenABF libraries
71+ find_package(OpenABF REQUIRED)
72+
73+ # Link to an executable
74+ add_executable(MyTarget main.cpp)
75+ target_link_libraries(MyTarget OpenABF::OpenABF)
76+ ```
77+
78+ ** Note:** For best performance, configure your CMake project with the
79+ ` -DCMAKE_BUILD_TYPE=Release ` flag.
80+
81+ #### Configuration
82+ The OpenABF CMake project provides a number of flags for configuring the
83+ installation:
84+ - ` OPENABF_MULTIHEADER ` : Install the multi-header version of OpenABF
85+ (Default: OFF)
86+ - ` OPENABF_BUILD_EXAMPLES ` : Build example applications. (Default: OFF)
87+ - ` OPENABF_BUILD_TESTS ` : Build project unit tests. This will download and build
88+ the Google Test framework. (Default: OFF)
89+ - ` OPENABF_BUILD_DOCS ` : Build documentation. Dependencies: Doxygen, Graphviz
90+ (optional). Unavailable if Doxygen is not found. (Default: OFF)
91+
92+ #### FetchContent (CMake 3.11+)
93+ Another option for providing OpenABF to your project is by using CMake's
94+ [ FetchContent module] ( https://cmake.org/cmake/help/latest/module/FetchContent.html ) :
95+
96+ ``` cmake
97+ include(FetchContent)
98+ FetchContent_Declare(
99+ openabf
100+ GIT_REPOSITORY https://gitlab.com/educelab/OpenABF.git
101+ GIT_TAG v1.0
102+ )
103+
104+ # Populate the project but exclude from All targets
105+ FetchContent_GetProperties(openabf)
106+ if(NOT openabf_POPULATED)
107+ FetchContent_Populate(openabf)
108+ add_subdirectory(${openabf_SOURCE_DIR} ${openabf_BINARY_DIR} EXCLUDE_FROM_ALL)
109+ endif()
110+ ```
111+
112+ This downloads the OpenABF source code and adds it to your CMake project as a
113+ subproject. Link it against your targets as you would any library added with
114+ ` find_package ` :
115+
116+ ``` cmake
117+ add_executable(MyTarget main.cpp)
118+ target_link_libraries(MyTarget OpenABF::OpenABF)
119+ ```
120+
121+ ### Manual
122+ Copy and paste the contents of ` single_include/ ` to your project or include
123+ path. As OpenABF depends upon the Eigen library, you will also need to add the
124+ Eigen headers to your include path:
125+
126+ ``` shell
127+ g++ -I /path/to/eigen/ -DNDEBUG -std=c++14 -O3 main.cpp -o main
128+ ```
129+
130+ ** Note:** For best performance, compile your application with the ` NDEBUG `
131+ preprocessor definition.
84132
85133## License
86134OpenABF is licensed under [ the Apache 2.0 license] ( LICENSE ) . This allows you to
87135use OpenABF freely in open source or proprietary software. However, any software
88136released in source or binary form must include and preserve a readable copy of
89- the attributions provided in the [NOTICE](NOTICE).
137+ the attributions provided in [ NOTICE] ( NOTICE ) .
138+
139+ The OpenABF logo and banner graphic are by Seth Parker (EduceLab, University
140+ of Kentucky) and are licensed under
141+ [ CC BY-NC-SA 4.0] ( http://creativecommons.org/licenses/by-nc-sa/4.0/ ) .
90142
91143## Contributors
92- If you would like to fix bugs or develop new features for OpenABF, please see
93- [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
144+ OpenABF is glad to welcome contributors of all skill sets. If you have found a
145+ bug or wish to contribute a new feature, please see
146+ [ CONTRIBUTING] ( CONTRIBUTING.md ) for more information on how to get started.
94147
95148### Updating the single-header file
96- All code changes should be made to the multi-header library files in
97- `include/OpenABF`. Before your Merge Request can be accepted, yoy need to update
98- the single-header library with your changes by running the following command
99- in the root of the source directory:
149+ OpenABF is deployed as a single-header library, but is developed as a
150+ multi-header library. All code changes should be made to the multi-header
151+ files in ` include/OpenABF/ ` . Before your Merge Request can be accepted, please
152+ update the single-header file with your changes by running the following
153+ command from the root of the source directory:
100154
101155``` shell
102156python3 thirdparty/amalgamate/amalgamate.py -c single_include.json -s .
@@ -105,7 +159,7 @@ python3 thirdparty/amalgamate/amalgamate.py -c single_include.json -s .
105159## References
106160This project implements data structures and algorithms derived from the
107161following publications:
108- * Alla Sheffer and Eric de Sturler. Parameterization of faceted surfaces for meshing using angle-based flattening. Engineering with Computers , 17(3):326–337, 2001.
109- * Bruno Lévy, Sylvain Petitjean, Nicolas Ray, and Jérome Maillot. Least squares conformal maps for automatic texture atlas generation. ACM Transactions on Graphics (TOG), 21(3):362–371, 2002.
110- * Alla Sheffer, Bruno Lévy, Maxim Mogilnitsky, and Alexander Bogomyakov. Abf++: fast and robust angle based flattening. ACM Transactions on Graphics (TOG), 24(2):311–330, 2005.
111- * S. Marschner, P. Shirley, M. Ashikhmin, M. Gleicher, N. Hoffman, G. Johnson, T. Munzner, E. Reinhard, W.B. Thompson, P. Willemsen, and B. Wyvill. Fundamentals of computer graphics. 4th edition, 2015.
162+ * Alla Sheffer and Eric de Sturler. Parameterization of faceted surfaces for meshing using angle-based flattening. _ Engineering with Computers _ , 17(3):326–337, 2001.
163+ * Bruno Lévy, Sylvain Petitjean, Nicolas Ray, and Jérome Maillot. Least squares conformal maps for automatic texture atlas generation. _ ACM Transactions on Graphics (TOG)_ , 21(3):362–371, 2002.
164+ * Alla Sheffer, Bruno Lévy, Maxim Mogilnitsky, and Alexander Bogomyakov. Abf++: fast and robust angle based flattening. _ ACM Transactions on Graphics (TOG)_ , 24(2):311–330, 2005.
165+ * S. Marschner, P. Shirley, M. Ashikhmin, M. Gleicher, N. Hoffman, G. Johnson, T. Munzner, E. Reinhard, W.B. Thompson, P. Willemsen, and B. Wyvill. _ Fundamentals of computer graphics._ 4th edition, 2015.
0 commit comments