cgal icon indicating copy to clipboard operation
cgal copied to clipboard

Add Linear Cell Complex octree generation functionality

Open ybellargui opened this issue 5 months ago • 5 comments

Summary of Changes

This PR implements octree generation functionality for CGAL's Linear Cell Complex package. It adds the ability to generate hexahedral octrees from OFF mesh files using AABB tree-based intersection testing. The implementation provides a simple 4-line API for easy integration and supports both Combinatorial Map and Generalized Map backends.

Release Management

  • Affected package(s): Linear_cell_complex
  • Feature/Small Feature (if any): Small Feature - Linear Cell Complex octree generation
  • Link to compiled documentation (obligatory for small feature): Documentation will be generated after merge
  • License and copyright ownership: GPL v3+ / LGPL v3+ (same as CGAL), Copyright (c) 2025 CNRS and LIRIS' Establishments (France)

Technical Details

New API Function:

template<typename LCC>
void CGAL::compute_octree(LCC& lcc,
                         const std::string& off_filename,
                         unsigned int max_level = 5,
                         unsigned int init = 3,
                         bool create_all_voxels = false,
                         bool display_statistics = false,
                         bool use_binary_OFF = false);

Files Added:

  • Linear_cell_complex/include/CGAL/Linear_cell_complex_octree_generation.h
  • Linear_cell_complex/examples/Linear_cell_complex/lcc_octree_generation.cpp
  • Linear_cell_complex/test/Linear_cell_complex/test_octree_generation.cpp

Testing Status:

  • 12 unit tests passing (6 for CMap + 6 for GMap)
  • Validates hexahedral topology, parameter effects, and error handling

This implementation is based on the distributed-hexahedral-subdivision research project by Guillaume Damiand.

ybellargui avatar Aug 13 '25 16:08 ybellargui

Instead of taking a filename as second parameter, it is probably better to take a surface mesh (any model of facegraph).

gdamiand avatar Aug 14 '25 13:08 gdamiand

There is another bool wich is interesting to add: -regularized which guaranty to have only one level of difference between two adjacent hex.

gdamiand avatar Aug 14 '25 13:08 gdamiand

I tried to address your comments:

  • Added a main overload that takes a Surface_mesh (any FaceGraph) instead of relying on a filename.
  • Kept the filename overloads only as convenience wrappers.
  • Added the regularized boolean parameter. Right now it’s only a stub (no balancing yet); the hook is there to implement 1‑irregular balancing (difference of at most one level between adjacent hexes) later.
  • Added a simple type constraint so string literals don’t get treated as a FaceGraph.
  • Updated tests and an example to cover both FaceGraph and filename cases.

ybellargui avatar Aug 15 '25 16:08 ybellargui

What is the relationship to the Octree package ?

afabri avatar Aug 22 '25 07:08 afabri

please remove trailing whitespace as reported in the CI.

afabri avatar Aug 22 '25 07:08 afabri