### Install Directional Tutorial Examples (CMake) Source: https://avaxman.github.io/Directional/tutorial Commands to build all Directional tutorial chapters using CMake. This process handles dependency appending and building automatically. For Windows, cmake-gui is used instead of command-line arguments. ```bash mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release ../ make ``` -------------------------------- ### Install Miniconda3 on Linux Source: https://avaxman.github.io/Directional/website Installs Miniconda3 on a Linux system by downloading the installer script and executing it. This is a prerequisite for managing Python environments for the project. ```bash wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh ``` -------------------------------- ### Serve Directional Website Locally Source: https://avaxman.github.io/Directional/website Starts a local development server to preview the Directional website. This command should be executed from the root folder of the Directional repository. ```bash mkdocs serve ``` -------------------------------- ### Mesh Function Isolines Setup Source: https://avaxman.github.io/Directional/tutorial Sets up data structures for meshing isolines from an integrator. This function translates `IntegratorData` to the meshing data format required by `mesh_function_isolines()`. It requires the `MeshFunctionIsolinesData` structure to be filled with input and depends on CGAL through libigl. ```cpp setup_mesh_function_isolines(); ``` -------------------------------- ### C++: Perform Permutationally and Fully Seamless Integration Source: https://avaxman.github.io/Directional/tutorial Demonstrates the computation of permutationally and fully seamless integration using the Directional library. It initializes integration data, sets parameters like verbose and integralSeamless flags, and calls the integrate function twice to obtain both types of seamless results. The output UV coordinates are then trimmed to two columns. ```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); ``` -------------------------------- ### Create Conda Environment for Directional Website Source: https://avaxman.github.io/Directional/website Creates a conda environment for the Directional website using a specified YAML file. This isolates project dependencies. ```bash conda env create -f directional-website.yml ``` -------------------------------- ### Compile Directional Tutorial Project Source: https://avaxman.github.io/Directional/index Sets up and compiles the tutorial project for the Directional library. This involves creating a build directory, configuring with CMake, and then building the project. ```bash mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release ../ make ``` -------------------------------- ### Activate Conda Environment Source: https://avaxman.github.io/Directional/website Activates the previously created conda environment named 'directional-website'. This command must be run before using project-specific tools. ```bash conda activate directional-website ``` -------------------------------- ### C++: IntegrationData Structure for Seamless Integration Source: https://avaxman.github.io/Directional/tutorial Defines the `IntegrationData` structure used in the Directional library for controlling seamless integration processes. It includes parameters such as `lengthRatio` for global scaling, `integralSeamless` to enable full translational seamlessness, `roundSeams` for handling seams or singularities, `verbose` for logging, and `localInjectivity` to enforce local injectivity. ```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! ``` -------------------------------- ### Check Dead Links with LinkChecker Source: https://avaxman.github.io/Directional/website Uses the LinkChecker tool to find broken links on the locally served Directional website. The website must be running at the specified address. ```bash linkchecker http://127.0.0.1:8000 ``` -------------------------------- ### Render Basic Directional Field Glyphs on Mesh Source: https://avaxman.github.io/Directional/tutorial Reads a mesh and a directional field from files and visualizes them using glyphs. Supports toggling field and singularity visibility. The field is face-based and singularities are vertex-based. ```C++ 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); ``` -------------------------------- ### Helmholtz-Hodge Decomposition Formula Source: https://avaxman.github.io/Directional/tutorial Illustrates the Helmholtz-Hodge decomposition of a vector field 'v' into its exact, coexact, and harmonic components using gradient 'G', curl 'C', and mass matrix 'M'. ```latex v = Gf + M^{-1}C^T g + h ``` -------------------------------- ### Trace Streamlines Interactively on Meshes Source: https://avaxman.github.io/Directional/tutorial Supports seeding and tracing streamlines for any type of directional field. Streamlines are initialized using `init_streamlines()` and advanced iteratively with `streamlines_next()` and `advance_streamlines()`. Colors fade from initial glyph color to white. ```C++ // Initialization viewer.init_streamlines(); // Tracing and advancing viewer.streamlines_next(); viewer.advance_streamlines(); ``` -------------------------------- ### Visualize Scalar Data on Meshes Source: https://avaxman.github.io/Directional/tutorial Allows visualization of scalar quantities on meshes at face, vertex, or edge discretization levels. Data can be set using `set_X_data()` functions, which also allow specifying the viewable range for clipping. ```C++ // Example for face-based data viewer.set_face_data(faceData, minVal, maxVal); // Example for vertex-based data viewer.set_vertex_data(vertexData, minVal, maxVal); // Example for edge-based data viewer.set_edge_data(edgeData, minVal, maxVal); ``` -------------------------------- ### Compute and Convert Discrete Tangent Fields Source: https://avaxman.github.io/Directional/tutorial Demonstrates computing Cartesian fields using the power field method on both vertex-based and face-based tangent bundles. The computed field is then converted to a raw representation for visualization. Requires mesh, constants, and vectors as input. ```C++ 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); ``` -------------------------------- ### Clone Directional Repository Source: https://avaxman.github.io/Directional/index Clones the Directional library repository, including recursive submodules, which is the first step to obtain the library. ```bash git clone --recursive https://github.com/avaxman/Directional.git ``` -------------------------------- ### Discrete Divergence Operator Source: https://avaxman.github.io/Directional/tutorial Introduces the discrete divergence operator, denoted as G^T \cdot M, which is derived from the metric and the gradient operator. ```latex G^T \cdot M ``` -------------------------------- ### libigl Data Structures Source: https://avaxman.github.io/Directional/file_formats Lists common data structures and file formats used by the libigl library for geometric processing. This includes formats for dense matrices, polyhedral meshes, Wavefront objects, and image files. ```text .dmat uncompressed ASCII/binary files for dense matrices .off Geomview’s polyhedral file format. .obj Wavefront object file format. Usually unsafe to assume anything more than vertex positions and triangle indices are supported .png Portable Network Graphics image file. IGLLIB (in the libiglpng extra) supports png image files via the yimg library. Alpha channels and compression are supported. ``` -------------------------------- ### Matching (.matching) Format Source: https://avaxman.github.io/Directional/file_formats Explains the .matching file format used for defining the correspondence between neighboring tangent spaces. It includes the degree, number of dual edges, and specifies pairs of faces, vertices, and a matching index. This index determines how vectors in one tangent space map to vectors in an adjacent one. ```text [Degree] [#dual_edges] [face_i] [face_j] [vertex_e] [vertex_f] [matching_k] ... #dual_edges rows ``` -------------------------------- ### Control Glyph View Sparsity with DirectionalViewer Source: https://avaxman.github.io/Directional/tutorial Allows selective viewing of glyphs on a subsample of faces in large meshes by adjusting the 'sparsity' parameter. This is useful for improving performance and clarity when dealing with dense glyph representations. It is a method within the `DirectionalViewer` class. ```C++ DirectionalViewer::set_field(field, sparsity); ``` -------------------------------- ### Select and Edit Vectors on Mesh Faces Source: https://avaxman.github.io/Directional/tutorial Enables interactive editing of directional fields by allowing users to select faces and specific vectors within those faces. Changes to a vector's direction are applied directly to the mesh. Uses libigl's picking functionality. ```C++ directionalViewer->set_selected_faces(selectedFaces); directionalViewer->set_selected_vector(currF, currVec); ``` -------------------------------- ### Directional Index Prescription Function Source: https://avaxman.github.io/Directional/tutorial The `directional::index_prescription()` function is used to solve for the smoothest field based on prescribed curvatures and singularity indices. It can accept a solver for precomputing the HH matrix, which defines basis cycle sums. ```cpp directional::index_prescription(solver) ``` -------------------------------- ### Minimize Curl using curl_matching() Source: https://avaxman.github.io/Directional/tutorial The `curl_matching()` function provides an alternative matching strategy that minimizes the curl of the directional field, differing from the default rotation minimization. This is used in conjunction with PolyCurl reduction. ```python curl_matching_result = curl_matching(initial_field, target_curl_reduction=True) ``` -------------------------------- ### Singularities (.sing) Format Source: https://avaxman.github.io/Directional/file_formats Describes the .sing file format for specifying prescribed singularities. It includes the degree and the number of singularities, followed by rows indicating the vertex index and its associated integer index. The fractional index is derived from these values and the degree. ```text [Degree] [#singularities] [vertex_i] [index_i] ... #singularities rows ``` -------------------------------- ### Compute Principal Matching for Directional Fields Source: https://avaxman.github.io/Directional/tutorial The `principal_matching()` function calculates the matching between vectors in adjacent tangent spaces for directional fields. It determines the orientation of TB-graph edges and encodes the matching, storing results in the 'matching' member. It also computes local cycle indices and stores them in 'singLocalCycles' and 'singIndices'. ```C++ principal_matching(field); ``` -------------------------------- ### Combing Directional Fields Source: https://avaxman.github.io/Directional/tutorial The `directional::combing()` function is used to re-index faces in a directional field, aligning vector indexing with neighbors. This prepares the field for integration and handles singularities by combing up to paths connecting them. The output `combedField` has a trivial matching in combed regions and correct matching across seams. ```c++ directional::combing() ``` -------------------------------- ### Exact Field Condition Source: https://avaxman.github.io/Directional/tutorial Defines an 'exact' or 'conservative' field as the result of applying the gradient operator 'G' to a scalar function 'f'. ```latex G \cdot f ``` -------------------------------- ### Implement Power Field using polyvector_field() Source: https://avaxman.github.io/Directional/tutorial The `power_field()` function is implemented by calling `polyvector_field()`. This allows for constraining the directional field to be a perfect power field, simplifying the PolyVector problem to a specific case. ```python power_field_result = polyvector_field(constraints=vb, soft_alignments=vc, alignment_weights=omega_c, lambda_S=lambda_S, lambda_R=lambda_R, lambda_C=lambda_C, constrain_to_power_field=True) ``` -------------------------------- ### TangentBundle Class Source: https://avaxman.github.io/Directional/tutorial The 'TangentBundle' class is the central data structure representing a discrete tangent bundle. It holds tangent spaces as nodes in a graph and encodes adjacency relations. ```python class TangentBundle: pass ``` -------------------------------- ### Cochain Complex Condition Source: https://avaxman.github.io/Directional/tutorial Defines the condition for a cochain complex where the composition of the curl operator 'C' and the gradient operator 'G' results in zero. ```latex C \cdot G = 0 ``` -------------------------------- ### Solve Linear PolyVector Problem with polyvector_field() Source: https://avaxman.github.io/Directional/tutorial The `polyvector_field()` function solves the linear PolyVector problem. It takes a set of prescribed constraints per tangent space and soft-alignment vectors with alignment weights. The function optimizes a quadratic objective function to interpolate constraints and achieve soft alignment, with parameters controlling energy terms for smoothness, alignment, and power vector preference. ```python polyvector_field(constraints=vb, soft_alignments=vc, alignment_weights=omega_c, lambda_S=lambda_S, lambda_R=lambda_R, lambda_C=lambda_C) ``` -------------------------------- ### Closed Field Condition Source: https://avaxman.github.io/Directional/tutorial Defines a 'closed' or 'curl-free' field as a vector field 'v' for which the curl operator 'C' results in zero. ```latex C \cdot v = 0 ``` -------------------------------- ### Subdivision Directional Fields Source: https://avaxman.github.io/Directional/tutorial Subdivides a coarse directional field into a fine one while preserving structure, suitable for subdivision surfaces. It optimizes a curl-free field and then subdivides it, ensuring the fine field is also curl-free by design. This process involves functions like `subdivide_field()` and relies on `IntrinsicFaceTangentBundle`. ```cpp rawFieldCoarse; rawFieldFine = subdivide_field(rawFieldCoarse); ``` -------------------------------- ### Power Field Representation Calculation Source: https://avaxman.github.io/Directional/tutorial The `directional::power_field()` function computes a power field representation using a complex basis in each tangent plane. It interpolates fields by minimizing face-based quadratic Dirichlet energy, optionally incorporating soft constraints with alignment weights. ```c++ directional::power_field() ``` -------------------------------- ### Raw Field (.rawfield) Format Source: https://avaxman.github.io/Directional/file_formats Defines the .rawfield file format for storing raw vector fields in uncompressed XYZ form. It specifies the number of columns per tangent space and the number of rows (faces). Vectors are assumed to be ordered CCW around the normal within each tangent space, and indices are independent per space. ```text [Degree] [#tangent_spaces] [x] [y] [z] [x][y][z] .... N*Degree columns ... #faces rows ``` -------------------------------- ### Coexact Part Divergence-Free Condition Source: https://avaxman.github.io/Directional/tutorial States that the coexact part of a vector field is divergence-free due to the property G^T \cdot C^T = 0. ```latex G^T \cdot C^T = 0 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.