Commit Graph
1650 Commits
Author SHA1 Message Date
Sebastien Loriot f6014dcc26 Add functions to compute the kernel of a triangle mesh (#9131)
Add functions to compute the kernel of a mesh

## Release Management

* Affected package(s):  `PMP`, `BGL`
* Issue(s) solved (if any): 
* Feature/Small Feature (if any):
[Mesh_Kernel](https://cgalwiki.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Mesh_Kernel)
* Link to compiled documentation (obligatory for small feature) [*wrong
link name to be changed*]()
* License and copyright ownership: GF
2026-02-13 13:45:32 +01:00
Sébastien Loriot 62116800fc Merge pull request #9123 from lrineau/CDT_3-fix_v2-lrineau
CDT_3: fix v2
2026-02-12 15:52:32 +01:00
Sebastien Loriot f60daf05e4 Mesh_2: fix degenerate cases (#9290)
## Summary of Changes

This PR fixes the error reported in issue #781. The main two changes
are:

- in `Refine_edges.h`: allow the refinement point of a constrained edge
to be an existing close encroaching vertex,
- in `Refine_faces.h`: skip tiny bad faces when their bbox are smaller
than a few ulp.

## Release Management

* Affected package(s): Triangulation_2, Mesh_2
* Issue(s) solved (if any): fix #781
* Feature/Small Feature (if any):
* Link to compiled documentation (obligatory for small feature) [*wrong
link name to be changed*](httpssss://wrong_URL_to_be_changed/Manual/Pkg)
* License and copyright ownership: maintenance by GeometryFactory, now
copyright change
2026-02-12 15:01:59 +01:00
Sebastien Loriot 244d9dee08 STL_Extension: Add bisect_failures debugging utility (#9118)
## Summary

This PR adds a new debugging utility `bisect_failures` to the
STL_Extension package. This function helps identify minimal failing test
cases from complex input data by using a bisection-like approach.

**Small feature: [bisect failures debugging
utility](https://cgalwiki.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/bisect_failures_debugging_utility)**

## Features

- **Multiple failure type support**: Handles CGAL exceptions,
std::exceptions, and exit codes
- **Automatic granularity adjustment**: Starts with ratio=0.5,
automatically halves when no fault is found
- **Debug output**: Saves intermediate states (`current`, `bad`,
`error`, `final_bad`)
- **Template-based design**: Works with any copyable/assignable data
type

## Testing

Added comprehensive test suite (`test_bisect_failures.cpp`) with 14
tests:
-  Edge cases (empty data, no failures)
-  Single element failures (CGAL exception, std::exception, exit code)
-  Pair combinations (all 2-element permutations)
-  Triple combinations (all 3 failure types together)

All tests pass in both Debug and Release configurations.

## Use Case

This utility is particularly useful for:
- Debugging complex geometric algorithms with large input datasets
- Finding minimal reproducible test cases from failing inputs
- Isolating problematic elements in mesh processing, triangulation, etc.

## Example Usage

```cpp
auto get_size = [](const Mesh& m) { return m.number_of_faces(); };
auto simplify = [](Mesh& m, std::size_t start, std::size_t end) -> bool {
  // Remove faces from start to end
  for(std::size_t i = start; i < end && i < m.number_of_faces(); ++i) {
    m.remove_face(start);
  }
  return true;
};
auto run = [](const Mesh& m) -> int { return algorithm(m); };
auto save = [](const Mesh& m, const std::string& prefix) {
  std::ofstream out(prefix + ".off");
  out << m;
};

int result = bisect_failures(mesh, get_size, simplify, run, save);
```

## Files Changed

- `STL_Extension/include/CGAL/bisect_failures.h` (new) - Main utility
header
- `STL_Extension/test/STL_Extension/test_bisect_failures.cpp` (new) -
Test suite
- `STL_Extension/test/STL_Extension/CMakeLists.txt` (modified) - Added
test

## Checklist

- [x] Code compiles without errors (Debug and Release)
- [x] All tests pass
- [x] Comprehensive documentation with Doxygen comments
- [x] Example usage in documentation
- [x] Follows CGAL coding style conventions
- [x] Deal with false positive in the testsuite

## Release Management

* Affected package(s): `STL_Extension`
* Feature/Small Feature (if any): [bisect failures debugging
utility](https://cgalwiki.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/bisect_failures_debugging_utility)
* Link to compiled documentation (obligatory for small feature)
[doc](https://cgal.github.io/9118/v2/STL_Extension/group__PkgSTLExtensionUtilities.html#gad56d708faac9063d3de057394a6d8c52)
* License and copyright ownership: no change
2026-02-12 14:59:15 +01:00
Laurent Rineau 8040ab0475 Merge remote-tracking branch 'lrineau/STL_Extension-bisect_failures-lrineau' into CDT_3-fix_v2-lrineau 2026-02-12 10:07:59 +01:00
Laurent Rineau f498226561 fix conflicts (merge 'cgal/main') 2026-02-12 10:02:05 +01:00
Laurent Rineau 43c2ea7134 Merge branch 'STL_Extension-bisect_failures-lrineau' into Mesh_2-fix_degenerate_cases-GF 2026-02-05 17:00:33 +01:00
Laurent Rineau d9e4c42741 bisect failure: do not compare cgal_exception->message()
The `message()` of a CGAL exception might have been generated at runtime.
It makes no sense to compare messages: the CGAL assertion is already identified
by the filename, and line number (plus the expression that was tested).
2026-02-05 16:59:44 +01:00
lvalque d2c0d5e93f Merge branch 'main' into PMP-kernel 2026-02-05 10:14:12 +01:00
Sébastien Loriot b519d736cc Merge remote-tracking branch 'cgal/6.1.x-branch' into 'cgal/main' 2026-02-03 15:21:35 +01:00
Sebastien Loriot c5ce7e753a Adding 3D barycentric coordinates for convex polyhedra (#8267)
## Summary of Changes

New package for 3D barycentric coordinates in a convex polyhedron

## Release Management

* Affected package(s): New package
* Feature/Small Feature (if any):
[here](https://cgal.geometryfactory.com/CGAL/Members/wiki/Features/Barycentric_coordinates_3)
* Link to compiled documentation (obligatory for small feature) [*wrong
link name to be changed*](httpssss://wrong_URL_to_be_changed/Manual/Pkg)
* License and copyright ownership: GF

## TODO
- [x] check branch size (@sloriot)
- [x] check usage of `get_tolerance()` from
`Barycentric_coordinates_3/include/CGAL/Barycentric_coordinates_3/internal/utils_3.h`
2026-02-03 15:13:25 +01:00
Laurent Rineau d0a6e51554 fix conflicts (merge 'cgal/main' ) 2026-01-30 16:38:49 +01:00
Laurent Rineau b02f873254 apply suggestions during reviews 2026-01-26 12:03:57 +01:00
Jane Tournois 30047afa8a add new Surface_options in mesh options
before, using `mesh_3_dump().surface_only()` together was leading
the second one to reset the values of the 1st one in "options"
2026-01-23 16:07:11 +01:00
Valque Léo 7b05e71abf Documentation refined with Mael 2026-01-22 17:07:01 +01:00
Laurent Rineau 2adca86eef fix warnings 2026-01-22 11:43:20 +01:00
Laurent Rineau 0077f641b3 tie clog to cerr in bisect_failures
That will ensure that the `clog` buffer is flushed before any output to `cerr`.
2026-01-22 09:55:23 +01:00
Valque Léo 45cb44685b Apply suggestions from the review 2026-01-21 17:52:15 +01:00
Laurent Rineau d05e6ba244 rewrite the doc after review 2026-01-21 16:47:31 +01:00
Laurent Rineau 30699f66f0 remove the *Fn/*_fn suffixes 2026-01-21 16:02:32 +01:00
Laurent Rineau 67ee46f13f WIP: rewrite the documentation after review 2026-01-21 14:29:09 +01:00
Laurent Rineau 4bdc53020a With_offset_tag: add a comment
[skip ci]
2026-01-21 10:59:40 +01:00
Laurent Rineau 158d5616e4 fix conflicts 2026-01-21 10:16:00 +01:00
Laurent Rineau 088bf68675 tweak SKIP message 2026-01-20 21:24:13 +01:00
Laurent Rineau 2ee9b47a16 better debug messages 2026-01-20 17:58:58 +01:00
Valque Léo f13d75cf34 Solved conflict with master 2026-01-20 12:47:40 +01:00
Valque Léo 0a5ee5cf6f Transform kernel documentation and correct degenerate case implementation 2026-01-19 17:10:22 +01:00
Sebastien Loriot e4c7b16aea Spelling corrections (#9276)
Spelling corrections
2026-01-15 18:24:53 +01:00
Valque Léo dde58aadbe Clean clip_convex and make clip_convex a parameter of clip 2026-01-15 10:02:35 +01:00
Sebastien Loriot 93093e8dd4 CDT_3: ship <tl/expected.hpp> (#9145) (#9197)
Replaces the `FetchContent` mechanism with a vendored copy of
`tl/expected.hpp` (v1.1.0).

The header is placed in `CGAL/tl/expected.hpp` to avoid namespace
pollution.
This also removes the CMake module `CGAL_setup_tl-excepted.cmake`.

## Release Management

* Affected package(s): Constrained_triangulation_3
* Issue(s) solved (if any): #9145
* License and copyright ownership: CC0 1.0 Universal (tl/expected.hpp)
2026-01-14 17:18:26 +01:00
albert-github a223559d82 Spelling corrections
Spelling corrections
2026-01-13 18:10:02 +01:00
Laurent Rineau 156457c926 Merge remote-tracking branch 'lrineau/STL_Extension-bisect_failures-lrineau' into pr/afabri/8429 2026-01-13 17:31:29 +01:00
Laurent Rineau d32254417f commit suggestions 2026-01-13 10:41:07 +01:00
Laurent Rineau 4018d8e884 remove trailing whitespaces 2026-01-12 14:36:11 +01:00
Laurent Rineau 15e2d274b2 Add Id/URL 2026-01-12 14:34:00 +01:00
Laurent Rineau 0be2691dfa rename macros 2026-01-12 14:23:58 +01:00
Laurent Rineau 64ac096ffe fix the detectiong of pkg license 2026-01-12 14:23:53 +01:00
albert-github 3a42476cbc Spelling correction
Spelling correction
2026-01-12 10:09:08 +01:00
Sébastien Loriot b9916cbb58 Merge remote-tracking branch 'cgal/6.1.x-branch' into 'cgal/main' 2026-01-09 15:53:29 +01:00
Sebastien Loriot f2ba45ec86 STL_Extension: Use std::clamp instead of manual clamping in Spatial_lock_grid_3 (#9238)
## Summary of Changes

Replaced manual ternary operator logic with `std::clamp` in
`CGAL/Spatial_lock_grid_3.h`.

The changes include:
- Replacing manual index clamping (ternary operators) with C++17
`std::clamp`.
- Removing commented-out code and a `@TODO` comment suggesting this
exact change.

## Release Management

* Affected package(s): `STL_Extension`
* Issue(s) solved (if any): Resolves in-code `@TODO: use std::clamp`
* Feature/Small Feature (if any):
* Link to compiled documentation (obligatory for small feature):
* License and copyright ownership: I confirm that I have the right to
contribute these changes under the CGAL license terms.
2026-01-09 15:40:57 +01:00
Sven Oesau 3da1b48db7 introducing named parameters
adding test for concept
cleaning up examples
2026-01-09 12:33:56 +01:00
Laurent Rineau 795a790305 Add comment for lambda in Generator_ref
Add a comment to clarify lambda usage for MSVC 2017 compatibility.
2026-01-08 09:55:00 +01:00
Sebastien Loriot 7373de7fc7 improve TDS_3::is_valid (#9190)
## Summary of Changes

improve `TDS_3::is_valid`:
- for a vertex, verify that its `cell()` that is not removed from the
`Compact_container`,
- for a cell, verify that its `neighbor(i)` and `vertex(i)` are not
removed,
  - and display using `CGAL::IO::oformat`.

## Release Management

* Affected package(s): TDS_3, and all 3D triangulation packages
* License and copyright ownership: no change, maintenance by GF
2026-01-07 17:53:49 +01:00
Sven Oesau 2e040701d9 fix by lrineau for msvc2017 compatibility 2026-01-07 17:09:37 +01:00
Attaullah Ansari 800a41ae23 STL_Extension: Use std::clamp instead of manual clamping in Spatial_lock_grid_3
Replace verbose ternary clamping with std::clamp for index calculations. Improves readability and uses C++17's std::clamp. No functional changes.
2026-01-06 20:14:04 +05:30
Laurent Rineau f50808cfdf fix a compilation error 2026-01-05 17:07:57 +01:00
Sebastien Loriot 1485d2825f Shape_detection: Add a way to pass input normal to faces (#8638)
## Summary of Changes

Avoid computing them when they are known.

* Normals are only used for estimating the angle between neighbor faces.
PCA is used to estimate the plane.
* sorting should be reusing the triangulation of faces that is already
done in regions (pass the internal map to `sort()` for exemple). PCA is
also used here to estimate the flatness score of a face in its
neighborhood
* About sorting: I'm not sure it wouldn't be a better idea to simply
sort using the area of the faces and ignore flatness of the
neighborhood.

## Release Management

* Affected package(s): `Shape_detection`
* small feature:
[Pass_face_normals_for_region_growing](https://cgalwiki.geometryfactory.com/CGAL/Members/wiki/Features/Small_Features/Pass_face_normals_for_region_growing)
* Issue(s) solved (if any):
2025-12-29 11:09:20 +01:00
Sébastien Loriot 67d6244bde Merge remote-tracking branch 'cgal/6.1.x-branch' into 'cgal/main' 2025-12-19 18:34:02 +01:00
Laurent Rineau 524d34182c improve TDS_3::is_valid 2025-12-17 14:43:29 +01:00
Valque Léo 47c1a6b636 Clean kernel and small optimization 2025-12-17 10:16:15 +01:00