Skip to content

add intersection of two AABB_tree and parallel build - #9501

Open
LeoValque wants to merge 76 commits into
CGAL:mainfrom
LeoValque:AABB-add_parallellization
Open

add intersection of two AABB_tree and parallel build#9501
LeoValque wants to merge 76 commits into
CGAL:mainfrom
LeoValque:AABB-add_parallellization

Conversation

@LeoValque

@LeoValque LeoValque commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary of Changes

Add a parallellization of AABB_tree::build() (without any mutex) to improve running time.

Add PMP::AABB_self_intersections(), a variant of PMP::self_intersections() that used an AABB_tree instead of CGAL::box_intersection_d.

Todo

  • Add proper benchmark

Release Management

@LeoValque LeoValque changed the title add parallellization of AABB_tree::build and add variant of PMP::self_intersections using AABB_tree add variant of PMP::self_intersections using AABB_tree May 28, 2026
@sloriot sloriot added the depends on another PR This pull-request should only be merged after other ones. label May 29, 2026
@LeoValque

Copy link
Copy Markdown
Contributor Author

/build:v0

@github-actions

Copy link
Copy Markdown

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/9501/v0/Manual/index.html

@LeoValque

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

Comment thread AABB_tree/include/CGAL/AABB_trees/intersection.h Outdated
Comment thread AABB_tree/include/CGAL/AABB_trees/intersection.h Outdated
Comment thread AABB_tree/include/CGAL/AABB_trees/intersection.h Outdated
typename OutputIterator,
typename NamedParameters1 = parameters::Default_named_parameters,
typename NamedParameters2 = parameters::Default_named_parameters>
void all_pairs_of_intersecting_primitives(const AABBTree1 &tree1,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are datum intersection tested? Should come from a traits. Are tree traits intersection function used? If so it should be documented

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tree traits are used, we can discussed the possibility to provide another traits through named parameters.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it is should be documented! primitive vs bbox is already working according to the traits but nothing about Datum1 vs Datum2 ( or Datum/Datum for the self version)


/*!
* \ingroup PkgAABBTreeRef
* Primitive type that uses as identifier an iterator with a range of three indices as `value_type`.

@sloriot sloriot Aug 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Primitive type that uses as identifier an iterator with a range of three indices as `value_type`.
* Primitive type that uses as identifier an iterator with a range of triplet of indices as `value_type`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really range of triple @sloriot ??

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing t

/*!
* \ingroup PkgAABBTreeRef
* Primitive type that uses as identifier an iterator with a range of three indices as `value_type`.
* The iterator from which the primitive is built should not be invalided

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are using an index internally. Why not directly an size_t?

@sloriot

sloriot commented Aug 6, 2026

Copy link
Copy Markdown
Member

I still do not see the replacement with new code in Rigid_triangle_mesh_collision_detection

@MaelRL MaelRL added Not yet approved The feature or pull-request has not yet been approved. Small feature CHANGES.md not updated labels Aug 6, 2026
Comment thread AABB_tree/benchmark/AABB_tree/old_bench_AABB_tree.cpp
intersecting pairs of objects. We refer to the component
\ref chapterBoxIntersection "Intersecting Sequences of dD Iso-oriented Boxes"
which can find all intersecting pairs of iso-oriented boxes.
Similarly to the package \ref chapterBoxIntersection "Intersecting Sequences of dD Iso-oriented Boxes",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure, but does the ref command not automatically put the text here?

Comment thread AABB_tree/doc/AABB_tree/aabb_tree.txt Outdated
\subsection aabb_tree_examples_9 Intersection of Two Trees

In the following example, we compute all the intersections between two tetrahedra. The tetrahedra
are stored as a vector of `Triangle_3`. We first compute if the tetrahedra do intersect and then we

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So four of such triangles form one tetrahedron ????

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, is it not clear?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we have a class Tetahedron_3.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to use something more generic than Tetrahedron_3 in an example.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe say two triangle soups/meshes both representing a tetrahedron (if that's Andreas' point)

Comment thread AABB_tree/doc/AABB_tree/aabb_tree.txt Outdated
Comment thread Kernel_23/include/CGAL/Bbox_3.h
Comment thread Minkowski_sum_2/include/CGAL/Minkowski_sum_2/AABB_collision_detector_2.h Outdated
Comment thread Polygon/include/CGAL/Polygon_2/Polygon_2_edge_iterator.h Outdated
PrimitiveIterator beyond,
const CGAL::Bbox_3& bbox) const
{
auto longest_axis=[](const CGAL::Bbox_3& bbox){

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also go in Bbox_2/3

get_const_property_map(vertex_point, tm2));

// Custom build functor using pointers
// TODO THIS IS SURFACE MESH SPECIFIC

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe grep for your todo, Todo, TODO

LeoValque and others added 4 commits August 10, 2026 09:28
Co-authored-by: Sebastien Loriot <sloriot.ml@gmail.com>
Co-authored-by: Andreas Fabri <andreas.fabri@geometryfactory.com>
@sloriot sloriot added pre-approved For pre-approved small features. After 15 days the feature will be accepted. Check size and removed CHANGES.md not updated labels Aug 10, 2026
@sloriot

sloriot commented Aug 17, 2026

Copy link
Copy Markdown
Member

PMP/tests fails + red CI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Check size Enhancement Not yet approved The feature or pull-request has not yet been approved. pre-approved For pre-approved small features. After 15 days the feature will be accepted. Small feature Speed Under Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parallel version of AABB_tree<Tr>::build()

4 participants