-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add intersection of two AABB_tree and parallel build #9501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LeoValque
wants to merge
76
commits into
CGAL:main
Choose a base branch
from
LeoValque:AABB-add_parallellization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 65 commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
c6f560e
Parallellized build of AABB_tree
LeoValque 5fadfb6
alternative version of PMP::self_intersections using AABB
LeoValque abca24c
Merge remote-tracking branch 'afabri/Kernel-combine_orientation-GF' i…
LeoValque a1fafcf
add example and benchmark of AABB_self_intersections
LeoValque 11100ee
add AABB_meshes_intersections of two different meshes
LeoValque 13b741f
Add two tree traversal intersection detection
LeoValque 9274515
Two tree intersection of meshes and mixed AABB box_intersection for i…
LeoValque 572bb8e
Benchmark meshes intersection
LeoValque d570a86
Improvement of AABB two tree traversals
LeoValque 2bbe6b5
Create a intersection meshes fonction using a callback instead of an …
LeoValque 68af801
Reorganize two_tree_traversal and AABB_two_tree_traversal_traits
LeoValque 2cebb83
Make API and Documentation of intersection of two AABB trees
LeoValque 233d5d3
Change traversal strategy to traverse biggest bbox first
LeoValque 6d958a3
Doc update
LeoValque 1fa9eb5
Add benchmark code in PMP
LeoValque c9e7a5a
remove benchmark code of two tree traversal in AABB_tree
LeoValque 65a76ee
Add test for AABB_trees::do_intersect and AABB_trees::all_pair_of_int…
LeoValque 827401b
Tree construction benchmarks
LeoValque 17aaeb3
Parallelization of kd-tree construction in AABB-tree
LeoValque 38b4eb9
Update performance in the user manual and apply first patch of sugges…
LeoValque 6c8a889
Second patch of suggestion from the review
LeoValque d4a984e
Solve a unused warning when not link with TBB
LeoValque b533687
Update documentation
LeoValque c1cec3c
Add figure of documentation
LeoValque 7349667
Add transformation parameter to CGALL::AABB_trees::do_intersect()
LeoValque 6021eba
Various cleanup
LeoValque ca78bf8
aabb_two_trees_intersection.cpp
LeoValque 9ed3515
Solve check headers error
LeoValque a8f5d08
<CGAL/Bbox_3.h> in Primive_helper.h
LeoValque 7e992cb
Use Aff_transformation_repC3 instead of Aff_transformation_3 in CGAL:…
LeoValque 91af779
Apply suggestions from the review
LeoValque 2e7ada2
Merge remote-tracking branch 'origin/main' into AABB-add_parallelliza…
LeoValque 89b449b
Solved aabb_two_trees_intersection error
LeoValque ec68ced
Solved warnings and errors in the testsuite
LeoValque 13618f2
Add primitives for AABB tree on a triangkle soup
LeoValque 66db995
Solved unused warning in the testsuite
LeoValque 72cb79b
Apply suggestions from the review
LeoValque ebdaa83
Clean Aff_transformation in intersection of AABB trees
LeoValque 2fef643
Add squared_diagonal_length to Bbox_2
LeoValque e1a8132
Correct compilation error when using AABB_segment_primitive_2 with Po…
LeoValque 036de9c
Remove aabb_tree_with_join
LeoValque d0d280f
Correct compilation error when using AABB_segment_primitive_2 with Po…
LeoValque 7aeca73
Merge branch 'AABB-add_parallellization' of github.com:LeoValque/cgal…
LeoValque b5ad15a
Remove unwanted modification of cmakelist
LeoValque 530e06f
Add rounding mode protection to traversal with transformation
LeoValque 18e497d
Merge branch 'Minkowski2-replace_AABB_tree_with_join' into AABB-add_p…
LeoValque 5144b77
Remove outdating asserts
LeoValque 6a9a7f8
Solved a compile bug with Protect_FPU_rounding
LeoValque f6222ed
Correct result error in a test
LeoValque 1d4dc30
Remove Protect_FPU_rounding and simply used interval_nt<true>
LeoValque 8b1d4f4
Solved a memory issue when gettint the transformation from the parameter
LeoValque 188e642
add missing dep
sloriot 257cb5c
Solved a mismatch bug between a defined type and the type return by t…
LeoValque 60e351a
Merge branch 'AABB-add_parallellization' of github.com:LeoValque/cgal…
LeoValque 75c8a56
Revert unwanted local change in test_minkoswki_sum
LeoValque acfbe78
Solved a compilation error with not default constructible PointMap
LeoValque 41019f9
Add test that produces VC warning
afabri 83cef1e
untabify
afabri 8fe54d2
assign to a reference and output
afabri 6b14899
Solved a bug of a dereference a temporary after construct_source_2
LeoValque 13e46fd
Merge branch 'AABB-add_parallellization' of github.com:LeoValque/cgal…
LeoValque 068035a
Add missing const in AABB_segment_primitive_2 and add a test on vecto…
LeoValque 3bbd97c
Avoid unused warnings
LeoValque 0926ddf
Solved a bug when using AABB_trees::do_intersect() with primitive tha…
LeoValque 82391e8
Merge remote-tracking branch 'cgal/main'
sloriot 7b22845
Apply suggestions from code review
LeoValque 7b36e62
Apply suggestions from the review
LeoValque 05e20f3
missing include
sloriot c056448
import change log from SF
sloriot 4a1de3f
Use new two trees intersection in Rigid collision
LeoValque edbfbf1
Merge branch 'AABB-add_parallellization' of github.com:LeoValque/cgal…
LeoValque fb25dc1
Fix an error in side_of_triangle_mesh
LeoValque 1e9082a
Update wrong assert
LeoValque 9961563
Compute intersection of two OBB directly in AABB traversal with trans…
LeoValque 2dd6f02
Solve unfound mesh error
LeoValque 5123e91
Remove unwanted leftover
LeoValque File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
|
|
||
| #include <cmath> | ||
| #include <fstream> | ||
| #include <iostream> | ||
| #include <vector> | ||
|
|
||
| #include <CGAL/Simple_cartesian.h> | ||
| #include <CGAL/IO/polygon_soup_io.h> | ||
|
|
||
| using Kernel = CGAL::Simple_cartesian<double>; | ||
| using Point = Kernel::Point_3; | ||
| using Vector = Kernel::Vector_3; | ||
| using Triangle = std::array<int, 3>; | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| const std::string filename = argc > 1 ? argv[1] : "knot.off"; | ||
|
|
||
| const int p = argc > 2 ? std::atoi(argv[2]) : 1; // Nb of major turns | ||
| const int q = argc > 3 ? std::atoi(argv[3]) : 6; // Nb of knot turns | ||
|
|
||
| const double R = argc > 4 ? std::atof(argv[4]) : 2.0; // major radius | ||
| const double r = argc > 5 ? std::atof(argv[5]) : 0.9; // knot radius | ||
| const double tube_radius = argc > 6 ? std::atof(argv[6]) : 0.4; | ||
|
|
||
| const int tubular_segments = argc > 7 ? std::atoi(argv[7]) : 120; | ||
| const int radial_segments = argc > 8 ? std::atoi(argv[8]) : 60; | ||
|
|
||
| const double exc = argc > 9 ? std::atof(argv[9]) : 1; // excentricity | ||
|
|
||
| std::vector<Point> vertices; | ||
| std::vector<Triangle> faces; | ||
|
|
||
| // Generate knot polyline | ||
| auto knot = [&](double t){ | ||
| double cq = std::cos(q * t); | ||
| double sq = std::sin(q * t); | ||
| double factor = R + r * cq; | ||
| return Point(factor * std::cos(p * t), | ||
| factor * std::sin(p * t), | ||
| r * sq); | ||
| }; | ||
| auto knot_derivative = [&](double t){ | ||
| double cq = std::cos(q * t); | ||
| double sq = std::sin(q * t); | ||
| double cp = std::cos(p * t); | ||
| double sp = std::sin(p * t); | ||
|
|
||
| double factor = R + r*cq; | ||
| double dfactor = -r*q*sq; | ||
|
|
||
| return Vector(dfactor*cp - factor*p*sp, | ||
| dfactor*sp + factor*p*cp, | ||
| r*q*cq); | ||
| }; | ||
|
|
||
| const double dt = 2.0 * M_PI / tubular_segments; | ||
| const double dr = 2.0 * M_PI / radial_segments; | ||
|
|
||
| // A normal to the knot axis | ||
| Vector N(1,0,0); | ||
| for(int i=0; i<tubular_segments; ++i) | ||
| { | ||
| double t = i * dt; | ||
|
|
||
| // knot point and its tangent | ||
| Point C = knot(t); | ||
| Vector T = knot_derivative(t); | ||
| // Compute bases of the plane on C | ||
| Vector B = CGAL::cross_product(N, T); | ||
| N = -CGAL::cross_product(B, T); | ||
| N /= CGAL::approximate_sqrt(N.squared_length()); | ||
| B /= CGAL::approximate_sqrt(B.squared_length()); | ||
|
|
||
| for(int j=0; j<radial_segments; ++j){ | ||
| double phi = j * dr; | ||
| vertices.push_back(C + tube_radius*(exc*std::cos(phi)*N + 1/exc*std::sin(phi)*B)); | ||
| } | ||
| } | ||
|
|
||
| auto idx = [&](int i, int j){ | ||
| i %= tubular_segments; | ||
| j %= radial_segments; | ||
| return i * radial_segments + j; | ||
| }; | ||
|
|
||
| for(int i=0; i<tubular_segments-1; ++i) | ||
| for(int j=0; j<radial_segments; ++j){ | ||
| int v00 = idx(i , j ); | ||
| int v10 = idx(i+1, j ); | ||
| int v01 = idx(i , j+1); | ||
| int v11 = idx(i+1, j+1); | ||
|
|
||
| faces.push_back({v00,v10,v11}); | ||
| faces.push_back({v00,v11,v01}); | ||
| } | ||
|
|
||
| // To avoid a twist, we compute the offset that minimize the distance between a point at tubular index N-1 and tubular index 0 | ||
| int n = tubular_segments-1; | ||
| int offset = 0; | ||
| double min = CGAL::squared_distance(vertices[idx(n, 0)], vertices[idx(0,0)]); | ||
| for(int j=1; j<radial_segments; ++j){ | ||
| double sq = CGAL::squared_distance(vertices[idx(n, 0)], vertices[idx(0,j)]); | ||
| if(min >sq){ | ||
| min = sq; | ||
| offset = j; | ||
| } | ||
| } | ||
| for(int j=0; j<radial_segments; ++j){ | ||
| int v00 = idx(n, j ); | ||
| int v10 = idx(0, j+offset); | ||
| int v01 = idx(n, j+1); | ||
| int v11 = idx(0, j+offset+1); | ||
|
|
||
| faces.push_back({v00,v10,v11}); | ||
| faces.push_back({v00,v11,v01}); | ||
| } | ||
|
|
||
| CGAL::IO::write_polygon_soup(filename, vertices, faces); | ||
|
|
||
| return 0; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.