### Install Miniconda on Linux Source: https://github.com/avaxman/directional/blob/master/docs/website.md Downloads and installs the latest version of Miniconda3 for Linux x86_64. This is a prerequisite for managing the project's environment. ```bash wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh ``` -------------------------------- ### Example Usage of libigl with Compressed Files Source: https://github.com/avaxman/directional/blob/master/optional/index.html A C++ example demonstrating how to use the libigl library with its compressed header and source files. It includes reading a triangle mesh and highlights the necessary include paths and preprocessor definitions for compilation. ```cpp #include #include int main(int argc, char * argv[]) { Eigen::MatrixXd V; Eigen::MatrixXi F; return (argc>=2 && igl::read_triangle_mesh(argv[1],V,F)?0:1); } ``` -------------------------------- ### Serve Directional Website Locally Source: https://github.com/avaxman/directional/blob/master/docs/website.md Starts a local development server to preview the Directional website. This command should be run from the root directory of the Directional repository. ```bash mkdocs serve ``` -------------------------------- ### CMake Project Setup and Compiler Information Source: https://github.com/avaxman/directional/blob/master/tutorial/CMakeLists.txt Initializes the CMake build system, sets the project name, and displays information about the C and C++ compilers being used. This is standard practice for CMake projects to ensure the correct toolchain is detected. ```cmake cmake_minimum_required(VERSION 3.16) project(Directional_tutorials) message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}") message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}") ``` -------------------------------- ### Install Embree 2.0 library on Mac OS X Source: https://github.com/avaxman/directional/blob/master/optional/index.html This code snippet details the steps to build and install the Embree 2.0 library on Mac OS X. It involves navigating to the embree directory within the external dependencies, creating a build directory, changing into it, and then running CMake to configure the build. An alternative command is provided for using different C and C++ compilers. ```bash cd external/embree mkdir build cd build cmake .. # Or using a different compiler #cmake .. -DCMAKE_C_COMPILER=/opt/local/bin/gcc -DCMAKE_CXX_COMPILER=/opt/local/bin/g++ make # Could also install embree to your root, but libigl examples don't expect # this #sudo make install ``` -------------------------------- ### Add Explicit Template Instantiation for C++ Source: https://github.com/avaxman/directional/blob/master/optional/index.html Example of how to add an explicit template instantiation for a C++ function within a .cpp file, guarded by IGL_STATIC_LIBRARY. This is done to resolve linker errors related to missing template instantiations. ```cpp #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation template Eigen::Matrix igl::cat >(int, Eigen::Matrix const&, Eigen::Matrix const&); #endif ``` -------------------------------- ### Directional Field Representation Conversion Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Highlights the availability of conversion functions within the Directional project to switch between different field representations (Raw, Power Field, PolyVector). Examples include `polyvector_to_raw()`. Not all conversions are possible. ```text Directional provides a number of conversion functions to switch between different representations. Each of the functions is of the form `rep1_to_rep2`, where `rep1` and `rep2` are the representation names in the above list. e.g., `polyvector_to_raw()`. Some possible combinations are given by composing two functions in sequence. However, note that not every conversion is possible; for instance, it is not possible to convert from PolyVectors to power fields, as they do not possess the same power of expression. Converting into the more explicit raw representation is often needed for I/O and visualization. ``` -------------------------------- ### Directional Library Renaming and Feature Updates (C++) Source: https://github.com/avaxman/directional/blob/master/docs/RELEASE_HISTORY.md Documents the change in the library's name from "libdirectional" to "Directional". It also details full compatibility with libigl 2.0, the introduction of seamless parameterization, and changes in how visualization components are rendered separately. Functionality renaming is also noted, with examples of former and new names for specific features. ```cpp libdirectional ``` ```cpp Directional ``` ```cpp libigl 2.0 ``` -------------------------------- ### Configuring Tutorial Shared Path and Interface Library Source: https://github.com/avaxman/directional/blob/master/tutorial/CMakeLists.txt Defines a shared path for tutorial resources and creates an interface library 'tutorials'. This library is used to propagate compile definitions and include directories across different parts of the project, simplifying dependency management. ```cmake set(TUTORIAL_SHARED_PATH ${CMAKE_CURRENT_SOURCE_DIR}/shared CACHE PATH "location of shared tutorial resources") add_library(tutorials INTERFACE) target_compile_definitions(tutorials INTERFACE "-DTUTORIAL_SHARED_PATH=\"${TUTORIAL_SHARED_PATH}\"") target_include_directories(tutorials INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) ``` -------------------------------- ### Running Test Program with Mesh Input (Bash) Source: https://github.com/avaxman/directional/blob/master/optional/README.md This command executes the compiled test program, providing a path to a mesh file (e.g., 'path/to/mesh.obj') as a command-line argument. The program will attempt to read the mesh using libigl. ```bash ./test path/to/mesh.obj ``` -------------------------------- ### Integrating External Libraries and Setting Output Directories Source: https://github.com/avaxman/directional/blob/master/tutorial/CMakeLists.txt Includes the 'libigl' and 'Directional' projects and configures output directories for runtime binaries based on the build environment (MSVC or others). This ensures that compiled executables and libraries are placed in the expected locations. ```cmake include(libigl) include(Directional) if(MSVC) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}) else() set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../") endif() ``` -------------------------------- ### Compiling Test Program Linking Against libigl Source: https://github.com/avaxman/directional/blob/master/optional/index.html This command compiles the test C++ program, linking it against the libigl library. It specifies include paths for Eigen and libigl, and uses preprocessor definitions to match the compilation of igl.cpp, ensuring compatibility. ```bash g++ -g -I/opt/local/include/eigen3/ -I/usr/local/igl/libigl/ -L/usr/local/igl/libigl/ -ligl -DIGL_NO_OPENGL -DIGL_NO_ANTTWEAKBAR -o test ``` -------------------------------- ### Compile libigl Tutorial with Static Library Source: https://github.com/avaxman/directional/blob/master/before-submitting-pull-request.md This C++ compilation process specifically targets the libigl tutorial using a static library build. It involves navigating to the tutorial directory, creating a build directory, configuring CMake with static library usage, and then compiling. ```bash cd tutorial/ mkdir build-use-static cd build-use-staticcmake -DCMAKE_BUILD_TYPE=Release -DLIBIGL_USE_STATIC_LIBRARY=ON .. make ``` -------------------------------- ### Initialize and Trace Streamlines (C++) Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Supports interactive streamline tracing on vector fields. It shows how to initialize streamline seeds and trace them using viewer functions, allowing for dynamic rendering as lines extend through triangles. ```cpp DirectionalViewer::init_streamlines(); DirectionalViewer::streamlines_next(); DirectionalViewer::advance_streamlines(); ``` -------------------------------- ### Compute Permutationally and Fully Seamless Integrations - C++ Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Demonstrates the computation of both permutationally and fully seamless N-functions. It utilizes the `directional::IntegrationData` structure and the `directional::integrate` function. The output for each integration is a transformed UV map. ```cpp directional::IntegrationData intData(N); directional::setup_integration(rawField, intData, meshCut, combedField); intData.verbose=true; intData.integralSeamless=false; directional::integrate(combedField, intData, meshCut, cutUVRot ,cornerWholeUV); cutUVRot=cutUVRot.block(0,0,cutUVRot.rows(),2); intData.integralSeamless = true; directional::integrate(combedField, intData, meshCut, cutUVFull,cornerWholeUV); cutUVFull=cutUVFull.block(0,0,cutUVFull.rows(),2); ``` -------------------------------- ### Run Exhaustive Build Test for libigl Source: https://github.com/avaxman/directional/blob/master/before-submitting-pull-request.md This bash script clones the libigl repository and builds the static library, the default header-only tutorial, and the tutorial using the static library. It's designed to catch a wide range of compilation errors. ```bash # In scripts/clone_and_build.sh add your email address to the line: # `recipients="alecjacobson@gmail.com,youremail@domain.com" # In your email client (e.g. gmail) create a filter to prevent emails # from your local machine from going to spam scripts/clone_and_build.sh ``` -------------------------------- ### Compile libigl static library (Linux/Mac OS X/Cygwin) Source: https://github.com/avaxman/directional/blob/master/optional/index.html This snippet demonstrates the commands to compile libigl as a static library on Linux, Mac OS X, or Cygwin. It involves creating a directory, changing into it, configuring the build with CMake specifying a Release build type, and then executing the make command. This process generates libigl.a and potentially other static libraries. ```bash mkdir -p ../lib cd ../lib cmake -DCMAKE_BUILD_TYPE=Release ../optional make ``` -------------------------------- ### Conditional Module Compilation and Library Options Source: https://github.com/avaxman/directional/blob/master/tutorial/CMakeLists.txt Configures conditional compilation of specific modules and sets build options for various libIGL features. Users can enable or disable specific tutorial chapters and libIGL components like Embree, GLFW, ImGui, OpenGL, and PNG support. ```cmake list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) option(TUTORIALS_CHAPTER1 "Compile chapter 1" ON) option(TUTORIALS_CHAPTER2 "Compile chapter 2" ON) option(TUTORIALS_CHAPTER3 "Compile chapter 3" ON) option(TUTORIALS_CHAPTER4 "Compile chapter 4" ON) option(TUTORIALS_CHAPTER5 "Compile chapter 5" ON) option(TUTORIALS_CHAPTER6 "Compile chapter 6" ON) option(LIBIGL_EMBREE "Build target igl::embree" ON) option(LIBIGL_GLFW "Build target igl::glfw" ON) option(LIBIGL_IMGUI "Build target igl::imgui" ON) option(LIBIGL_OPENGL "Build target igl::opengl" ON) option(LIBIGL_PNG "Build target igl::png" ON) if(TUTORIALS_CHAPTER5) option(LIBIGL_COPYLEFT_CGAL "Build target igl_copyleft::cgal" ON) endif() ``` -------------------------------- ### Zip Project Directory using Git Archive Source: https://github.com/avaxman/directional/blob/master/optional/index.html Command to create a zip archive of the project directory, excluding .git files and binaries. It prefixes the contents with 'libigl/'. ```bash git archive -prefix=libigl/ -o libigl.zip master ``` -------------------------------- ### Activate Conda Environment Source: https://github.com/avaxman/directional/blob/master/docs/website.md Activates the 'directional-website' conda environment. This must be done before running any website-related commands. ```bash conda activate directional-website ``` -------------------------------- ### Compile Static Library with Make Source: https://github.com/avaxman/directional/blob/master/optional/index.html Command to compile the libigl static library using make. This is a prerequisite for encountering template instantiation errors. ```bash cd $LIBIGL make ``` -------------------------------- ### Create Conda Environment Source: https://github.com/avaxman/directional/blob/master/docs/website.md Creates a new conda environment using the specified YAML file. This environment contains all necessary dependencies for building and running the Directional website. ```bash conda env create -f directional-website.yml ``` -------------------------------- ### Compile Directional Tutorial Source: https://github.com/avaxman/directional/blob/master/docs/index.md Builds the Directional tutorial project. It involves creating a build directory, navigating into it, and using CMake to configure the build for release, followed by compilation using 'make'. ```shell mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release ../ make ``` -------------------------------- ### Conditional Subdirectory Inclusion for Tutorial Chapters Source: https://github.com/avaxman/directional/blob/master/tutorial/CMakeLists.txt Conditionally includes subdirectories for each tutorial chapter based on the previously defined options. This allows users to build only the chapters they are interested in, reducing build times and complexity. ```cmake # Chapter 1 if(TUTORIALS_CHAPTER1) add_subdirectory("101_GlyphRendering") add_subdirectory("102_DiscreteTangentBundles") add_subdirectory("103_PickingEditing") add_subdirectory("104_StreamlineTracing") add_subdirectory("105_FaceVertexEdgeData") add_subdirectory("106_Sparsity") endif() # Chapter 2 if(TUTORIALS_CHAPTER2) add_subdirectory("201_PrincipalMatching") add_subdirectory("202_Sampling") add_subdirectory("203_Combing") endif() # Chapter 3 if(TUTORIALS_CHAPTER3) add_subdirectory("301_PowerFields") add_subdirectory("302_PolyVectors") add_subdirectory("303_PolyCurlReduction") add_subdirectory("304_ConjugateFields") endif() # Chapter 4 if(TUTORIALS_CHAPTER4) add_subdirectory("401_IndexPrescription") endif() # Chapter 5 if(TUTORIALS_CHAPTER5) add_subdirectory("501_SeamlessIntegration") add_subdirectory("502_DifferentOrders") add_subdirectory("503_SeamsSingsRounding") add_subdirectory("504_LinearReductions") add_subdirectory("505_Meshing") endif() # Chapter 6 if(TUTORIALS_CHAPTER6) add_subdirectory("601_SubdivisionFields") endif() ``` -------------------------------- ### Automate Explicit Instantiation with autoexplicit.sh Source: https://github.com/avaxman/directional/blob/master/optional/index.html A sequence of commands to automate the process of creating explicit template instantiations using a script named 'autoexplicit.sh'. It involves redirecting compiler errors, processing them, and recompiling. ```bash cd /to/your/project make 2>$LIBIGL/make.err cd $LIBIGL cat make.err | ./autoexplicit.sh make clean make ``` -------------------------------- ### Compiling Compressed libigl.cpp with Dependency Exclusion Source: https://github.com/avaxman/directional/blob/master/optional/index.html This command compiles the compressed igl.cpp file. It uses preprocessor macros like -DIGL_NO_OPENGL and -DIGL_NO_ANTTWEAKBAR to exclude specific library dependencies, reducing compile-time and the final executable size. ```bash g++ -o igl.o -c igl.cpp -I/opt/local/include/eigen3 -DIGL_NO_OPENGL -DIGL_NO_ANTTWEAKBAR ``` -------------------------------- ### Finding Source Files with OpenGL Dependencies Source: https://github.com/avaxman/directional/blob/master/optional/index.html A bash one-liner to find all source files within the 'include/igl/' directory that use OpenGL but do not have the IGL_NO_OPENGL guard defined. This helps in identifying potential dependency issues. ```bash grep OpenGL `grep -L IGL_NO_OPENGL include/igl/*` ``` -------------------------------- ### Setting up Mesh Function Isolines Data Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Shows the function to translate 'IntegratorData' into the format required by the meshing unit. This function is crucial for bridging the integration and meshing components of the library. ```cpp setup_mesh_function_isolines(IntegratorData integratorData) ``` -------------------------------- ### Compressing C++ Source Files with scripts/compress.sh Source: https://github.com/avaxman/directional/blob/master/optional/index.html This script is used to compress C++ header and source files into a single header and a single cpp file. It simplifies project integration by reducing the number of files to manage. ```bash scripts/compress.sh igl.h igl.cpp ``` ```bash scripts/compress.sh igl.h ``` -------------------------------- ### IntegrationData Structure Parameters - C++ Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Defines the `IntegrationData` structure used for controlling the seamless integration process. Key parameters include global scaling (`lengthRatio`), seamlessness flags (`integralSeamless`, `roundSeams`), verbosity (`verbose`), and local injectivity enforcement (`localInjectivity`). ```cpp double lengthRatio; //global scaling of functions //Flags bool integralSeamless; //Whether to do full translational seamless. bool roundSeams; //Whether to round seams or round singularities bool verbose; //output the integration log. bool localInjectivity; //Enforce local injectivity; might result in failure! ``` -------------------------------- ### Read and Visualize Mesh with Directional Field (C++) Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Reads a mesh and its associated directional field from files and visualizes them using DirectionalViewer. It handles raw field formats and singularity data. Dependencies include the Directional library and its associated I/O functions. ```cpp directional::readOFF(TUTORIAL_SHARED_PATH "/bumpy.off",mesh); directional::read_raw_field(TUTORIAL_SHARED_PATH "/bumpy.rawfield", mesh, N, field); directional::read_singularities(TUTORIAL_SHARED_PATH "/bumpy.sings", field); directional::DirectionalViewer viewer; viewer.set_mesh(mesh); viewer.set_field(field); ``` -------------------------------- ### Meshing with Isolines using libhedra Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Provides the function signature for meshing based on isoline arrangements. It takes the 'MeshFunctionIsolinesData' structure as input and requires CGAL (via libigl) as a dependency for processing. ```cpp mesh_function_isolines(MeshFunctionIsolinesData data) ``` -------------------------------- ### Directional Initial Functionality (C++) Source: https://github.com/avaxman/directional/blob/master/docs/RELEASE_HISTORY.md Details the core functionalities introduced in the alpha version of Directional (formerly "libdirectional"). This includes Glyph Drawing with singularities, Trivial connection, Globally optimal fields, Polyvectors + integrable polyvectors, and Principal matching and combing. ```cpp libdirectional ``` ```cpp Glyph Drawing ``` ```cpp Trivial connection ``` ```cpp Globally optimal fields ``` ```cpp Polyvectors ``` ```cpp integrable polyvectors ``` ```cpp Principal matching ``` ```cpp combing ``` -------------------------------- ### Extract Undefined Symbols with Make and Grep Source: https://github.com/avaxman/directional/blob/master/optional/index.html Command to filter make output to show only lines containing 'referenced from', helping to identify undefined symbols for template instantiation. ```bash make 2>&1 | grep "referenced from" | sed -e "s/, referenced from.*//" ``` -------------------------------- ### Holonomy Calculation from Connection Matrices Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Demonstrates the calculation of holonomy for a cycle by multiplying connection matrices. Holonomy quantifies the failure of a vector to return to its original state after parallel transport around a closed loop. ```python import numpy as np def calculate_holonomy(cycle_connections): """Calculates holonomy as the logarithm of the product of connection matrices.""" product_matrix = np.identity(cycle_connections[0].shape[0]) for matrix in cycle_connections: product_matrix = np.dot(product_matrix, matrix) # Logarithm of the product matrix gives holonomy holonomy = np.log(product_matrix) return holonomy ``` -------------------------------- ### Check for Dead Links Source: https://github.com/avaxman/directional/blob/master/docs/website.md Uses the LinkChecker tool to scan the locally served Directional website for broken links. It targets the default mkdocs serve address and port. ```bash linkchecker http://127.0.0.1:8000 ``` -------------------------------- ### Select Faces and Vectors for Editing (C++) Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Demonstrates the picking and editing paradigm in Directional by setting selected faces and a specific vector within a face. This functionality allows interactive modification of directional fields on a mesh. ```cpp directionalViewer->set_selected_faces(selectedFaces); directionalViewer->set_selected_vector(currF, currVec); ``` -------------------------------- ### CMake: Set Output Directory and Add Subdirectory Source: https://github.com/avaxman/directional/blob/master/optional/CMakeLists.txt Configures CMake to place archive output (static libraries) in the binary directory. It then adds the shared CMake directory as a subdirectory, likely to include common build configurations or library definitions. ```cmake # libigl*.a libraries should be built directly into libigl/lib/ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") add_subdirectory("${PROJECT_SOURCE_DIR}/../shared/cmake" "libigl") ``` -------------------------------- ### Visualize Scalar Quantities on Meshes Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Allows setting and visualizing scalar quantities on mesh elements like faces, vertices, and edges. It supports defining the viewable range for these quantities, with data outside this range being clipped. Dependencies include the DirectionalViewer class. ```cpp DirectionalViewer::set_X_data() ``` -------------------------------- ### Combing Directional Fields - directional::combing() Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Demonstrates the 'combing' operation on a directional field using the `directional::combing()` function. This process re-indexes faces to align vector indexing with the matching to neighbors, resulting in a trivial matching in combed regions and correct matching across seams. It's crucial for preparing fields for integration and handles singularities by forming seams. ```cpp directional::combing() ``` -------------------------------- ### Index Prescription Algorithm in Directional Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md This snippet refers to the core function for performing index prescription within the Directional library. It outlines the function signature and its role in solving for the smoothest field that adheres to prescribed curvature constraints, potentially utilizing precomputed solver information. ```cpp directional::index_prescription() ``` -------------------------------- ### Connection Matrix Representation Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Illustrates how connections between adjacent tangent spaces can be represented as orthogonal matrices, facilitating parallel transport and derivative calculations. ```python # Example of a connection matrix (orthogonal) import numpy as np # Assuming d=2 for simplicity connection_matrix = np.array([[np.cos(theta), -np.sin(theta)], [np.sin(theta), np.cos(theta)]]) ``` -------------------------------- ### Set Triangular Symmetry for Directional Fields Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Demonstrates how to set triangular symmetry for directional fields using the `set_triangular_symmetry` function. This is a pre-made function to configure the linear reduction matrix (U) for compatible integration on surfaces, ensuring correct permutation around singularities. ```python intData.linRed = set_triangular_symmetry(N) ``` -------------------------------- ### C++: Add Explicit Template Instantiation in .cpp File Source: https://github.com/avaxman/directional/blob/master/optional/README.md Demonstrates how to add an explicit template instantiation for a function at the end of its corresponding .cpp file, guarded by an IGL_STATIC_LIBRARY preprocessor directive. This is crucial for functions intended to be compiled into the libigl static library. ```cpp #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation template Eigen::Matrix igl::cat >(int, Eigen::Matrix const&, Eigen::Matrix const&); #endif ``` -------------------------------- ### Compute Discrete Tangent Bundles with Power Fields (C++) Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Computes Cartesian fields using the power field method on either vertex-based or face-based tangent bundles. It demonstrates the process of reading a mesh, initializing a tangent bundle, computing the power field, and converting it to a raw representation for visualization. ```cpp directional::readOBJ(TUTORIAL_SHARED_PATH "/elephant.obj", mesh); powerFaceField.init(mesh, POWER_FIELD, N); powerVertexField.init(mesh, POWER_FIELD, N); ... directional::power_field(mesh, constFaces, constVectors, Eigen::VectorXd::Constant(constFaces.size(),-1.0), N, powerFaceField); directional::power_field(mesh, constVertices, constVectors, Eigen::VectorXd::Constant(constVertices.size(),-1.0), N, powerVertexField); //computing power fields directional::power_to_raw(powerFaceField, N, rawFaceField,true); directional::power_to_raw(powerVertexField, N, rawVertexField,true); ``` -------------------------------- ### IntrinsicFaceTangentBundle Implementation Details Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Details the implementation of IntrinsicFaceTangentBundle, including parameterization, adjacency, connection, cycles, cochain complex, inner product, sources, normals, and projection. It requires an orientable, single-component triangle mesh. ```text 1. Intrinsic parameterization: a local basis in every face. 2. Adjacency: dual (inner) edges between any two faces. 3. Connection: the rotation matrix between the bases of any two adjacent faces. 4. Cycles: the local cycles are around vertex $1$-rings, where singularities are then defined as (dual) vertex values, and global cycles are dual loops of generators and boundaries. 5. Cochain complex: the classical FEM face-based gradient and curl. 6. Inner product: the natural face-based mass matrix (just a diagonal matrix of face areas). 7. Sources are face barycenters, and normals are just face normals. 8. The projection to the supporting plane of the face and encoding in local coordinates. 9. Vertices and vertex normals (area-weighted from adjacent faces). ``` -------------------------------- ### CMake: Configure Build Options for Libigl Source: https://github.com/avaxman/directional/blob/master/optional/CMakeLists.txt Defines CMake options to control the build process of libigl. These options allow users to enable or disable support for various external libraries and features, such as static library usage, AntTweakBar, CGAL, Embree, OpenGL, PNG, Tetgen, Triangle, and XML parsing. ```cmake option(LIBIGL_USE_STATIC_LIBRARY "Use LibIGL as static library" ON) option(LIBIGL_WITH_ANTTWEAKBAR "Use AntTweakBar" ON) find_package(CGAL QUIET COMPONENTS Core) option(LIBIGL_WITH_CGAL "Use CGAL" "${CGAL_FOUND}") option(LIBIGL_WITH_COMISO "Use CoMiso" ON) ### Cork is off by default since it fails to build out-of-the-box on windows option(LIBIGL_WITH_CORK "Use Cork" OFF) option(LIBIGL_WITH_EMBREE "Use Embree" ON) option(LIBIGL_WITH_LIM "Use LIM" ON) find_package(MATLAB QUIET) option(LIBIGL_WITH_MATLAB "Use Matlab" "${MATLAB_FOUND}") find_package(MOSEK QUIET) option(LIBIGL_WITH_MOSEK "Use MOSEK" "${MOSEK_FOUND}") ### Nanogui is off by default because it has many dependencies and generates ### many issues option(LIBIGL_WITH_NANOGUI "Use Nanogui menu" OFF) option(LIBIGL_WITH_OPENGL "Use OpenGL" ON) option(LIBIGL_WITH_OPENGL_GLFW "Use GLFW" ON) option(LIBIGL_WITH_PNG "Use PNG" ON) option(LIBIGL_WITH_TETGEN "Use Tetgen" ON) option(LIBIGL_WITH_TRIANGLE "Use Triangle" ON) option(LIBIGL_WITH_VIEWER "Use OpenGL viewer" ON) option(LIBIGL_WITH_XML "Use XML" ON) ``` -------------------------------- ### Helmholtz-Hodge Decomposition Formula Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Presents the Helmholtz-Hodge decomposition formula, which breaks down a vector field into exact, coexact, and harmonic components using gradient, curl, and mass operators. ```latex $$v = Gf + M^{-1}C^Tg + h$$ ``` -------------------------------- ### Explicit Template Instantiation for C++ Compilation Issues Source: https://github.com/avaxman/directional/blob/master/before-submitting-pull-request.md This C++ code snippet demonstrates how to resolve a common 'symbol not found' error in libigl by explicitly instantiating templates. The provided text from a compiler error is used to construct the correct instantiation statement, which should be added to the relevant .cpp file. ```cpp #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation template void igl::cgal::points_inside_component, -1, 3, 0, -1, 3>, Eigen::Matrix, Eigen::Matrix, -1, 3, 0, -1, 3>, Eigen::Matrix >(Eigen::PlainObjectBase, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase, -1, 3, 0, -1, 3> > const&, Eigen::PlainObjectBase >&); #endif ``` -------------------------------- ### Conjugate Fields Functionality Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md This section explains the concept of conjugate vector fields, their importance in architectural geometry for creating planar quad meshes, and a method for finding conjugate fields by deforming a PolyVector field. ```text This functionality only works with face-based fields via ```IntrinsicFaceTangentBundle```. ... conjugate vector fields are very important in architectural geometry: their integral lines form, informally speaking, an infinitesimal planar quad mesh. As such, the finite quad mesh that results from discretizing conjugate networks is a good candidate for consequent planarity parameterization [^liu_2011]. Finding a conjugate vector field that satisfies given directional constraints is a standard problem in architectural geometry, which can be tackled by deforming a $2^2$ PolyVector field to the closest conjugate field. Such an algorithm was presented in [^diamanti_2014], which alternates between a global smoothness and orthogonality step, and a local step that projects the field on every face to the closest conjugate field. ``` -------------------------------- ### PolyCurl Reduction Functionality Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md This section describes the PolyCurl reduction method for improving the integrability of vector fields. It highlights the dependency on face-based fields via ```IntrinsicFaceTangentBundle``` and mentions an alternative matching function ```curl_matching()```. ```text This functionality only works with face-based fields via ```IntrinsicFaceTangentBundle```. ... Note that this tutorial demonstrates an alternative matching ```curl_matching()```with that minimizes curl instead of rotation. ``` -------------------------------- ### Control Glyph Density with Sparsity Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Enables controlling the density of glyphs displayed on mesh faces by using a sparsity parameter. This is useful for improving visualization performance on large meshes. The sparsity parameter is part of the set_field function. ```cpp DirectionalViewer::set_field(sparsity_parameter) ``` -------------------------------- ### CMake: Include CGAL Support Source: https://github.com/avaxman/directional/blob/master/optional/CMakeLists.txt Conditionally finds and includes the CGAL (Computational Geometry Algorithms Library) package if the `LIBIGL_WITH_CGAL` option is enabled. It sets `CGAL_DONT_OVERRIDE_CMAKE_FLAGS` to prevent conflicts with CGAL's build system and includes CGAL's use file. ```cmake if(LIBIGL_WITH_CGAL) # Do not remove or move this block, cgal strange build system fails without it find_package(CGAL REQUIRED COMPONENTS Core) set(CGAL_DONT_OVERRIDE_CMAKE_FLAGS TRUE CACHE BOOL "CGAL's CMAKE Setup is super annoying ") include(${CGAL_USE_FILE}) endif() ``` -------------------------------- ### Clone Directional Repository Source: https://github.com/avaxman/directional/blob/master/docs/index.md Clones the Directional library repository, including its recursive submodules. This is the initial step to obtain the library's source code. ```git git clone --recursive https://github.com/avaxman/Directional.git ``` -------------------------------- ### Discrete Divergence Operator Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Shows the definition of the discrete divergence operator, derived from the metric and the transpose of the curl operator, used in vector calculus on discrete manifolds. ```python # Discrete divergence operator definition # divergence = G^T * M (where G is gradient, M is metric) # This is conceptual and depends on the implementation of G and M ``` -------------------------------- ### Matching (.matching) Format Source: https://github.com/avaxman/directional/blob/master/docs/file_formats.md Explains the .matching file format for defining the connections between neighboring tangent spaces. It specifies how matching information is stored for edges between tangent spaces. ```plaintext [Degree] [#dual_edges] [face_i] [face_j] [vertex_e] [vertex_f] [matching_k] ... #dual_edges rows ``` -------------------------------- ### CartesianField Representations: Power Field Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Explains the 'Power Field' representation, specific to $d=2$. It encodes an $N$-rotational-symmetric ($N$-RoSy) object as a single complex number $y=u^N$, where $u$ are the roots. Memory complexity is $2|V_{TB}|$. ```text This is a unique type to $d=2$. It encodes an $N$-rotational-symmetric ($N$-RoSy) object as a single complex number $y=u^N$ relative to the local basis in the tangent space, where the $N$-RoSy is the set of roots $u \cdot e^{\frac{2\pi i k}{N}}, k \in [0,N-1]$. The magnitude is also encoded this way, though it may be neglected in some applications. The memory complexity is then $2|V_{TB}|$. ``` -------------------------------- ### CartesianField Representations: Raw Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Describes the 'Raw' representation for Cartesian fields in Directional. It uses a dimension-dominant ordering of vectors in each tangent plane and is indicated by `CartesianField::fieldType` set to `directional::RAW_FIELD`. Memory complexity is $dN|V_{TB}|$. ```text A vector of $d\times N$ entries represents an intrinsic $1^N$-vector (a directional with $N$ independent vectors in each tangent plane) a dimension-dominant ordering: $(X_{1,1},\ldots, X_{1,d}),(X_{1,2},\ldots,X_{2,d}),\ldots (X_{N,1},\ldots, X_{N,d})$ per face. Vectors are assumed to be ordered in counterclockwise order in most Directional functions that process raw fields. the memory complexity is then $dN|V_{TB}|$ for the entire directional field. A Cartesian Field indicates being a raw-field by setting `CartesianField::fieldType` to `directional::RAW_FIELD`. ``` -------------------------------- ### Singularities (.sing) Format Source: https://github.com/avaxman/directional/blob/master/docs/file_formats.md Details the .sing file format for specifying prescribed singularities. It outlines the structure for storing vertex indices and their fractional indices relative to a degree. ```plaintext [Degree] [#singularities] [vertex_i] [index_i] ... #singularities rows ``` -------------------------------- ### Directional Viewer Overhaul (C++) Source: https://github.com/avaxman/directional/blob/master/docs/RELEASE_HISTORY.md Details the encapsulation of viewer operations within a new DirectionalViewer class. This class allows association of mesh properties like isolines, vertex, face, and edge data, abstracting direct control over shapes and colors to focus on geometric quantities. It introduces thinner arrows for glyphs and other visualization enhancements. ```cpp DIrectionalViewer ``` ```cpp directional::line_cylinders() ``` ```cpp directional\visualization_schemes.h ``` -------------------------------- ### Compute Power Field using directional::power_field() Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md This function computes a Power Field representation for directional fields. It interpolates directional constraints by minimizing a quadratic Dirichlet energy. The function is part of the directional library and is used for applications requiring N-RoSy fields with specific constraint satisfaction. ```C++ directional::power_field() ``` -------------------------------- ### CartesianField Representations: PolyVector Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Details the 'PolyVector' representation, also for $d=2$. It generalizes power fields by representing an $N$-directional object as coefficients of a monic complex polynomial, whose roots are the $1^N$-vector field. Memory complexity is $2N|V_{TB}|$. ```text Also unique to $d=2$, this is a generalization of power fields that represents an $N$-directional object in a tangent space as the coefficients $a$ of a monic complex polynomial $f(z)=z^N+\sum_{i=0}^{N-1}{a_iz^i}$, which roots $u$ are the encoded $1^N$-vector field. In case where the field is an $N$-RoSy, all coefficients but $a_0$ are zero. ***Note***: A PolyVector that represents a perfect $N$-RoSy would have all $a_i=0,\ \forall i>0$, but $a_0$ would have opposite sign from the power-field representation of the same $N$-RoSy. This is since the power field represents $u^N$ directly, whereas a PolyVector represents the coefficients of $z^N-U^N$ in this case. The memory complexity is $2N|V_{TB}|$. ``` -------------------------------- ### Compute Principal Matching for Vector Fields Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md Calculates the principal matching for directional fields, which defines correspondences between vectors in adjacent tangent spaces. This process aims to minimize 'effort' and places matchings within a specific range. It also identifies singular local cycles and their indices. The function accepts a Cartesian field as input and stores results in the field's members. ```cpp principal_matching(cartesian_field) ``` -------------------------------- ### TangentBundle Class in Directional Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md The primary data structure for discrete tangent bundles in the Directional project. It represents tangent spaces as nodes in a graph and encodes their relationships. ```python class TangentBundle: """Represents a discrete tangent bundle.""" pass ``` -------------------------------- ### CMake: Set CXX Flags for MSVC and GCC/Clang Source: https://github.com/avaxman/directional/blob/master/optional/CMakeLists.txt Configures C++ compiler flags based on the operating system. For MSVC, it enables parallel compilation (/MP, /bigobj) and suppresses warnings. For GCC/Clang, it sets the C++11 standard and disables specific warnings to avoid compilation issues. ```cmake cmake_minimum_required(VERSION 2.8.12) project(libigl) set (CMAKE_MODULE_PATH #${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/../shared/cmake") ### Compilation flags: adapt to your needs ### if(MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /bigobj /w") ### Enable parallel compilation set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} ) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") #### Libigl requires a modern C++ compiler that supports c++11 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations -Wno-unused-parameter -Wno-deprecated-register -Wno-return-type-c-linkage") endif() ``` -------------------------------- ### Subdivide Field Functionality Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md This snippet illustrates the core functionality of subdividing a directional field. It takes a coarse field and produces a fine field, maintaining structural properties like gradients and curls. The process is designed for efficiency and works specifically with curl-reduced fields. ```python rawFieldFine = subdivide_field(rawFieldCoarse) ``` -------------------------------- ### Directional Functionality Changes (C++) Source: https://github.com/avaxman/directional/blob/master/docs/RELEASE_HISTORY.md Explains changes in the Directional library, including the removal of "appending" options for functions like directional::line_cylinders() due to rendering changes. It also notes that combing is now dependent on a given matching, removing separate curl_combing() or principal_combing() functions. ```cpp directional::line_cylinders() ``` ```cpp curl_combing() ``` ```cpp principal_combing() ``` -------------------------------- ### Raw Field (.rawfield) Format Source: https://github.com/avaxman/directional/blob/master/docs/file_formats.md Describes the .rawfield file format for uncompressed XYZ data. It specifies the structure for storing tangent spaces and their associated vectors, noting conventions for ordering and indexing. ```plaintext [Degree] [#tangent_spaces] [x] [y] [z] [x][y][z] .... N*Degree columns ... #faces rows ``` -------------------------------- ### Solve PolyVector Field using polyvector_field() Source: https://github.com/avaxman/directional/blob/master/docs/tutorial.md This function solves the linear PolyVector problem, a generalization of Power Fields. It allows for prescribing multiple vectors per tangent space and handles soft-alignment constraints. The function is capable of constraining the field to be a perfect Power Field by internally calling itself. ```C++ polyvector_field() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.