Geogram C++ Geometry Processing Library

repository·main·Indexed 25 days ago

https://github.com/brunolevy/geogram

A comprehensive C++ library for geometry processing, providing high-level capabilities such as surface reconstruction, remeshing, and Boolean operations, alongside low-level tools including exact predicates, efficient mesh data structures, and parallel 3D Delaunay triangulations. It includes the FPG (Formal Program Generation) module for static analysis and formal verification using AST visitors and abstract interpretation, as well as xatlas for mesh charting and parameterization.

Tokens
17.1K
Snippets
23
Records
92
Agent score
82%

What's inside Geogram

  1. Overview of Geogram geometry-processing capabilities

    main

    Geogram is a programming library providing a wide range of geometric algorithms and geometry-processing functionalities. It is suitable for both high-level tasks and low-level algorithmic needs.

    High-level geometry processing:

    • Surface reconstruction
    • Remeshing
    • Parameterization and texturing
    • Intersections and Boolean operations
    • Constructive Solid Geometry (CSG)

    Low-level algorithms and data structures:

    • Exact numbers and exact predicates
    • 2D Delaunay triangulations and highly efficient parallel 3D Delaunay triangulations
    • Multithread-friendly 2D constrained Delaunay triangulation (supports intersecting constraints in arbitrary precision)
    • Memory-efficient mesh data structures (surfacic, volumetric, or hybrid)
    • Geometric search data structures for intersection and raytracing (e.g., AABBs, KdTrees)
    • Spectral mesh processing
    • Linear solvers for both CPU and GPU
  2. Overview of HLBFGS optimization framework

    main

    HLBFGS is a hybrid L-BFGS (Limited-memory Broyden–Fletcher–Goldfarb–Shanno) optimization framework. It integrates the ICFS software to modify the true Hessian when available, and utilizes line-search routines from the original L-BFGS code and TNPACK.

    Note on Licensing: HLBFGS is freely available for non-commercial purposes. The integrated ICFS software is subject to its own licensing terms.

  3. Access Geogram documentation and resources

    main

    To use Geogram effectively, you can access the following resources:

    • Wiki: Contains documentation, compilation guides, and tutorials.
    • Programmer's Reference Manuals: Detailed technical references for the API.
    • Releases: Official release history and versions.
    • Publications: A list of projects and research papers that utilize Geogram.
    • In-browser Demos: Examples of Geogram running in the browser via Emscripten.
  4. How to use xatlas for mesh charting and parameterization

    main

    xatlas is used for mesh charting, parameterization, and atlas packing, typically for generating unique texture coordinates (UVs) for lightmap baking. The workflow follows these steps:

    1. Initialize: Create an atlas instance using xatlas::Create.
    2. Input Meshes: Add one or more manifold meshes using xatlas::AddMesh.
    3. Segmentation: Segment meshes into roughly disk-shaped charts by calling xatlas::ComputeCharts.
    4. Flattening: Flatten charts into 2D parameterizations by calling xatlas::ParameterizeCharts.
    5. Packing: Pack charts into one or more atlases using xatlas::PackCharts. You can call this multiple times to adjust options like resolution or unit-to-texel scale.
    6. Retrieve Results: The xatlas::Atlas instance will contain the results. Note that the vertex count may increase because the new UV channel duplicates vertices that were previously shared between triangles to accommodate UV seams. The index coherence is maintained, though some indices will point to these new duplicated vertices.
    7. Cleanup: Release resources using xatlas::Destroy.
  5. Use standalone CGAL includes for FPG compilation

    main

    The src/bin/fpg/CGALmini/ directory provides standalone versions of specific CGAL components to simplify the compilation of FPG across different systems. These files are designed to be used without installing the full CGAL library, Boost, or any other CGAL dependencies.

    Included files:

    • FPU.h: Manages floating point unit operations and rounding modes.
    • Static_filter_error.h: Provides the number_type class used for computing error bounds in predicate filters.
    • basic.h: Provides replacements for the CGAL macros and functions required by FPG.

    All files in this directory are licensed under LGPL v3.

  6. Use GeoShade for shader authoring

    main

    GeoShade is a simple shader authoring application included with Geogram. It allows you to write, run, and live-edit GLSL shaders (specifically targeting a ShaderToy-like workflow).

    Key features:

    • ShaderToy Compatibility: If your shader includes <GLUP/ShaderToy.h>, it is compiled directly. Otherwise, the application automatically wraps your code with a fragment shader stage and the ShaderToy import header.
    • Built-in Uniforms: The application automatically provides the following uniforms to your shaders:
      • iTime: The elapsed time since the program started (float).
      • iFrame: The current frame count (float).
      • iDate: The current date as a vec4 (x: year, y: month, z: day, w: seconds since start of day).
    • File Support: It natively supports .glsl files for reading and writing.
    • Workflow: You can write code in the integrated text editor and use the Run program menu item (or [F5]) to compile and execute the shader.
  7. Use GeoBox for geometry processing

    main

    GeoBox is a graphic interface to the geometry processing functionalities of Geogram. It provides a GUI-based toolbox for point set processing, surface repair, remeshing, texture mapping, and volumetric meshing. It is built on top of SimpleMeshApplication and integrates various Geogram algorithms into a unified workflow.

    Key functional areas include:

    • Points: Smoothing, outlier filtering, and surface reconstruction (Co3Ne, Poisson).
    • Surface: Repairing meshes, merging vertices, resolving intersections, and remeshing.
    • Texture mapping: Generating texture atlases and normal maps.
    • Volume: Tetrahedral meshing (tetmeshing).
    • Mesh Editing: Statistics, topology viewing, element removal, and selection tools.
    • Attributes: Computing Local Feature Size (LFS), distance to border, ambient occlusion, and manifold harmonics.
  8. Surface repair and remeshing in GeoBox

    main

    GeoBox includes a suite of tools for cleaning and optimizing surface meshes:

    Repair

    • Repair surface: A comprehensive repair tool for fixing manifold issues, holes, and intersections.
    • Merge vertices: Merges vertices within a specified tolerance.
    • Intersect: Removes surface mesh intersections.
    • Keep largest part: Deletes all connected components except for the largest one.

    Remesh

    • Remesh smooth: Performs smooth remeshing with options for triangle shape and size adaptation.
    • Decimate: A quick vertex clustering decimator to reduce mesh complexity.

    Texture Mapping

    • Make texture atlas: Generates UV coordinates using XATLAS or angle-based flattening.
    • Remesh + normal map: Performs remeshing while simultaneously generating a high-resolution normal map.
  9. Point set processing in GeoBox

    main

    GeoBox provides several tools for managing and reconstructing surfaces from point sets:

    • Smooth point set: Applies smoothing to a point set.
    • Filter outliers: Removes points that are considered outliers based on their distance to their $N$-th nearest neighbor.
    • Reconstruct Co3Ne: Reconstructs a surface from a point set using the Co3Ne algorithm.
    • Reconstruct Poisson: Reconstructs a surface from a point set using Poisson reconstruction.

    Example command signatures (as seen in the GUI):

    void smooth(index_t nb_iterations=2, index_t nb_neighbors=30)
    void filter_outliers(index_t N=70, double R=0.01)
    void reconstruct_Co3Ne(double radius=5.0, index_t nb_smth_iter=2, index_t nb_neighbors=30)
    void reconstruct_Poisson(index_t depth=8)