Skip to content
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

Orthtree generalization #7672

Merged
merged 311 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
311 commits
Select commit Hold shift + click to select a range
ed9266e
Add parallel node system using properties
JacksonCampolattaro Jun 22, 2023
1154524
Ensure moved-from properties are reset
JacksonCampolattaro Jun 22, 2023
08b418b
Ensure properties of a moved-from tree are also moved-from
JacksonCampolattaro Jun 22, 2023
bfe5845
Orthtree no longer instantiates Node types
JacksonCampolattaro Jun 22, 2023
774aa1f
Add node-access convenience functions, and simplify tests
JacksonCampolattaro Jun 22, 2023
01aad4a
Add a minimal test of custom node properties
JacksonCampolattaro Jun 25, 2023
c41faf1
Delete independent `Node` type, move relevant typedefs to Orthtree.h
JacksonCampolattaro Jun 25, 2023
b08eaba
Move point-specific functionality to traits class
JacksonCampolattaro Jun 26, 2023
22e76aa
Adapt 2D & dD traits for the new system
JacksonCampolattaro Jun 26, 2023
dc18e1b
Replace `tree.points(node)` with `tree.data(node)`
JacksonCampolattaro Jun 27, 2023
6e1aa89
Add documentation for new features of the OrthtreeTraits concept
JacksonCampolattaro Jun 27, 2023
3e4120c
Merge branch 'master' into orthtree-generalization
sloriot Jul 3, 2023
4e1dabe
version version of traits for triangle meshes
sloriot Jul 3, 2023
02e10bf
add TODO
sloriot Jul 6, 2023
03cda70
Replace boost::optional with std::optional
JacksonCampolattaro Jul 9, 2023
dccda38
Reference type of traversal iterator is a Node_index (and not a refer…
JacksonCampolattaro Jul 9, 2023
533f088
fix dump
sloriot Jul 10, 2023
cfdb167
Fix a couple of small issues which came up during LCC conversion
JacksonCampolattaro Jul 18, 2023
61a29f0
Fix an issue where side-per-depth wasn't updated when a node was manu…
JacksonCampolattaro Jul 26, 2023
7027d5b
Adapt several examples to use the new interface
JacksonCampolattaro Jul 26, 2023
50006c9
Fix an issue with file loading where adding normals would cause addit…
JacksonCampolattaro Jul 26, 2023
85e03d1
Merge branch 'property-maps' into orthtree-generalization
JacksonCampolattaro Jul 26, 2023
4998f7b
Adapt remaining examples to use the generalized orthtree
JacksonCampolattaro Jul 26, 2023
5bc0962
Eliminate non-index versions of split predicates & traversals
JacksonCampolattaro Jul 26, 2023
8fe57f5
Rename traverse_indices to traverse (now that it's the only traversal…
JacksonCampolattaro Jul 27, 2023
6f31cbd
Point traits now share the generic reassign_points method
JacksonCampolattaro Jul 27, 2023
282180d
Add an example which builds a tree that doesn't contain anything
JacksonCampolattaro Jul 27, 2023
b950c6c
Add base traits classes with common typedefs for convenience
JacksonCampolattaro Jul 27, 2023
07c671e
Convert methods to functor objects for consistency (proof-of-concept)
JacksonCampolattaro Aug 29, 2023
2d8f7d4
Rename Properties.h for clarity
JacksonCampolattaro Aug 30, 2023
4a379e5
Delete old Properties system, no longer in use anywhere
JacksonCampolattaro Aug 30, 2023
77f240b
Delete Orthtree::Node class, now used nowhere
JacksonCampolattaro Aug 31, 2023
28dc304
Merge branch 'cgal/master'
sloriot Sep 1, 2023
aae6c1b
add missing license/copyright and fix protection macro
sloriot Sep 1, 2023
6de261e
Rename test_Properties to resolve naming collision
JacksonCampolattaro Sep 1, 2023
40a08f1
add missing license include
sloriot Sep 1, 2023
59fafe8
Fix issues with superfluous Node typedefs
JacksonCampolattaro Sep 1, 2023
599a10c
Merge remote-tracking branch 'origin/orthtree-generalization' into or…
JacksonCampolattaro Sep 1, 2023
e9ca3cc
Update face graph traits to use functors
JacksonCampolattaro Sep 1, 2023
b7a8571
Update empty quadtree to use functors
JacksonCampolattaro Sep 1, 2023
40b2c0d
Convert nearest neighbor methods to free functions
JacksonCampolattaro Sep 1, 2023
d0fa6ed
Add missing license header
JacksonCampolattaro Sep 1, 2023
1566750
Switch license to GPL
JacksonCampolattaro Sep 1, 2023
99a2d56
Replace bbox with Iso_rectangle/_cuboid/_box
JacksonCampolattaro Sep 2, 2023
51aae3a
Bbox construction functor is no longer necessary; Bbox_d type must be…
JacksonCampolattaro Sep 2, 2023
fd34fb5
`root_node_contents` now produces a Bbox directly
JacksonCampolattaro Sep 2, 2023
039b693
Add support for trees with non-cubic bounding boxes
JacksonCampolattaro Sep 2, 2023
2488668
adaptation of Efficient_RANSAC to changed Orthtree interface
soesau Sep 5, 2023
bf5bbcc
Add `construct_point_d_object` to traits classes
JacksonCampolattaro Sep 6, 2023
32c6d61
Eliminate Array and Construct_point_d_from_array
JacksonCampolattaro Sep 7, 2023
750ca57
Combine 2d, 3d, and d-d points traits into one template
JacksonCampolattaro Sep 7, 2023
ea59877
Automatically determine the correct typedefs for an ambient dimension…
JacksonCampolattaro Sep 7, 2023
3e20800
Update documentation for Traits concepts
JacksonCampolattaro Sep 8, 2023
ed32969
Prefer `using` over `typedef` universally, for consistency
JacksonCampolattaro Sep 8, 2023
c4e6ad7
Update documentation for Orthtree member functions.
JacksonCampolattaro Sep 13, 2023
d169adb
Update benchmarks to account for recent changes
JacksonCampolattaro Sep 13, 2023
da33014
Merge remote-tracking branch 'cgal/master'
sloriot Sep 14, 2023
97ed41f
do not document Property_container for now
sloriot Sep 14, 2023
33dce33
fix some doc issues
sloriot Sep 14, 2023
4681f17
Fix a small issue with the Octree definition
JacksonCampolattaro Sep 16, 2023
759905b
Merge remote-tracking branch 'origin/orthtree-generalization' into or…
JacksonCampolattaro Sep 16, 2023
37d60b4
Replace pointer with std::optional
JacksonCampolattaro Sep 16, 2023
25790f6
Replace nullable pmap types with std::optionals
JacksonCampolattaro Sep 16, 2023
e552b0d
Replace pointers to umap and vmap with optionals
JacksonCampolattaro Sep 16, 2023
bae28c3
Fix a typo: Gt is not a dependent type, so typename is unnecessary
JacksonCampolattaro Sep 16, 2023
ce2c7a9
Use optionals for more maps
JacksonCampolattaro Sep 16, 2023
48b502e
Add no-op collect_garbage(visitor) method for backwards compatibility
JacksonCampolattaro Sep 16, 2023
c67bec2
More optionals for non-nullable maps
JacksonCampolattaro Sep 16, 2023
38c35d8
Update orthtree documentation and manual
JacksonCampolattaro Sep 24, 2023
332e4b2
Replace `typedef` with `using` for consistency
JacksonCampolattaro Sep 24, 2023
4c60841
Add boost::span to STL_Extension for compatibility with older version…
JacksonCampolattaro Sep 24, 2023
fbc49ad
Replace boost::tie with optional type
JacksonCampolattaro Sep 24, 2023
9a1701c
More optional non-nullable maps
JacksonCampolattaro Sep 24, 2023
aced885
More optional non-nullable maps
JacksonCampolattaro Sep 24, 2023
f021c0c
Use optional vpm for all property maps
JacksonCampolattaro Sep 24, 2023
6747609
Add a simple test for shared vertices
JacksonCampolattaro Sep 24, 2023
d930a95
Use structured bindings instead of boost::tie
JacksonCampolattaro Sep 24, 2023
ffeb2ae
Remove reference to Node type in traversal concept
JacksonCampolattaro Sep 24, 2023
e39ca2a
Replace more `boost::tie`s with structured bindings
JacksonCampolattaro Sep 24, 2023
3ac8ddf
More accounting for non-nullable maps
JacksonCampolattaro Sep 24, 2023
bf3bc03
Eliminate another `boost::tie`
JacksonCampolattaro Sep 24, 2023
9b738cb
Eliminate more instances of boost::tie found with a global search
JacksonCampolattaro Sep 24, 2023
c575cd2
Remove a couple of default initializations
JacksonCampolattaro Sep 24, 2023
6f86c93
Update function documentation for consistency
JacksonCampolattaro Sep 27, 2023
047a949
Fix mismatched parameter names in documentation
JacksonCampolattaro Sep 30, 2023
44cae21
Merge remote-tracking branch 'CGAL/master' into orthtree-generalization
JacksonCampolattaro Sep 30, 2023
feb87c7
Eliminate most whitespace changes
JacksonCampolattaro Oct 5, 2023
6963e7f
fix emplace_group on MSVC
soesau Oct 5, 2023
f797ae7
fix compilation on MSVC
soesau Oct 5, 2023
047a223
Revert Surface_mesh to the old memory management scheme
JacksonCampolattaro Oct 8, 2023
1b5ebd3
Merge remote-tracking branch 'origin/orthtree-generalization' into or…
JacksonCampolattaro Oct 8, 2023
999ad9b
Merge remote-tracking branch 'cgal/master' into HEAD
sloriot Nov 7, 2023
6383bf9
revert changes to not block the integration of new Orthtree
sloriot Nov 7, 2023
c8cc615
removing trailing whitespaces
soesau Nov 7, 2023
696fb83
moving new property system into CGAL::Experimental namespace
soesau Nov 7, 2023
6cdfbfe
restored é
soesau Nov 7, 2023
8274313
fix ci
soesau Nov 15, 2023
dceff13
added missing header
soesau Nov 15, 2023
b2ac701
dependencies update
soesau Nov 15, 2023
de06eb0
fixing orthtree bbox coordinates
soesau Jan 2, 2024
d5a764c
fixed test
soesau Jan 8, 2024
2d295ac
Merge remote-tracking branch 'cgal/master' into orthtree-generalization
soesau Jan 8, 2024
d2754d3
update dependencies
soesau Jan 8, 2024
24a937e
add missing deps
sloriot Jan 8, 2024
626a23a
fixed exact corners, multi dimension example
soesau Jan 10, 2024
85e5987
pass on doc
soesau Jan 12, 2024
eb84593
switching to Property_array_handle
soesau Jan 12, 2024
64b232e
deleted unused traits base classes
soesau Jan 12, 2024
d43432d
adding locate_halfspace_object to traits
soesau Jan 12, 2024
172044b
removing old references
soesau Jan 12, 2024
beea3f2
fixing comment for Node_index_range
soesau Jan 12, 2024
add12f5
small fixes
afabri Jan 14, 2024
8097ba8
PointSet -> PointRange
afabri Jan 14, 2024
f7eaa95
Remove one group layer
afabri Jan 15, 2024
da9cec8
update deps
sloriot Jan 15, 2024
fa8e09e
backtick
afabri Jan 15, 2024
25d658f
doc the real type
sloriot Jan 15, 2024
cec138c
Update QP_solver/include/CGAL/QP_solver/basic.h
afabri Jan 15, 2024
825029a
improve doc
sloriot Jan 15, 2024
95e06dd
Update Orthtree/include/CGAL/Orthtree_traits_face_graph.h
afabri Jan 16, 2024
552209e
Add the operators in the concept
afabri Jan 16, 2024
cdea8cf
Update Orthtree/include/CGAL/Orthtree_traits_face_graph.h
afabri Jan 18, 2024
620a78c
CGAL_USE
afabri Jan 24, 2024
832389a
property handles are returned by copy
sloriot Jan 24, 2024
f29e307
Add Node_index to the traits concept
afabri Jan 24, 2024
b9a2556
use variable
afabri Jan 24, 2024
876865b
use variable
afabri Jan 24, 2024
f650c6f
Add typedef to base class
afabri Jan 24, 2024
f014326
Use Traits::Node_index
afabri Jan 24, 2024
33a58fa
Do not output just the x-coord of the min of the bbox
afabri Jan 24, 2024
77d9509
protect min/max
afabri Jan 24, 2024
33e09bf
Switch back to the wrong coordinate system
afabri Jan 24, 2024
d078a34
fix warnings
sloriot Jan 24, 2024
5e67892
If smaller is true we want to go in the 0-half space not 1
afabri Jan 24, 2024
0c93490
Revert "If smaller is true we want to go in the 0-half space not 1"
sloriot Jan 24, 2024
91b4a7a
fix zip iterator
sloriot Jan 24, 2024
95d8d8c
clean up axis and commodity enum to work in both 2D and 3D
sloriot Jan 24, 2024
58d26ed
Make parameter const&
afabri Jan 25, 2024
b5945b4
Fix warning
afabri Jan 25, 2024
585467a
As the bbox of nodes gets constructed from Epeck::FT we have to take …
afabri Jan 25, 2024
d515e42
fix doc warning
sloriot Jan 25, 2024
787fb84
pass on the user manual
sloriot Jan 25, 2024
57fbda8
pass on the doc but the Orthtree class
sloriot Jan 25, 2024
caad3b3
pass on Orthtree class
sloriot Jan 25, 2024
f155ad8
please MSVC 2017
sloriot Jan 26, 2024
88f01a5
get rid of EPECK
sloriot Jan 26, 2024
ffb32d9
fix dependencies
sloriot Jan 29, 2024
546c0c8
small doc corrections
soesau Jan 30, 2024
11f0a84
changing dimension and degree in orthtree(_traits) to int
soesau Jan 30, 2024
2802d58
removing Maybe_node_index
soesau Jan 30, 2024
434d3e9
draft for an implementation of bbox corner that are consistent between
sloriot Jan 30, 2024
ef1fc52
clean up implementation and also use it in barycenter
sloriot Jan 30, 2024
3763feb
fix compilation issues
sloriot Jan 30, 2024
85dd768
handle calls to barycenter for leaf nodes
sloriot Jan 30, 2024
a9a37c1
Fix conversion warning
afabri Jan 31, 2024
ecc30d8
removing Locate_halfspace
soesau Jan 31, 2024
7bf9672
spelling
soesau Jan 31, 2024
c8661d0
renaming Orthtree_traits_base_for_dimension to Orthtree_traits_base
soesau Feb 1, 2024
019be3f
some updates on documentation
soesau Feb 1, 2024
834b405
adding surface mesh to examples
soesau Feb 1, 2024
3c55548
traversals are now templated by OrthtreeTraits
soesau Feb 2, 2024
da04410
shortening doc of simple functions
soesau Feb 2, 2024
73bf4ed
moving definition of Node_index into traits
soesau Feb 2, 2024
79eaf04
doc split predicate with bucket_size needs Node_data with random access
soesau Feb 2, 2024
ad5807f
doc locates behaviour
soesau Feb 2, 2024
bd11275
removing Get_geometric_object_for_element and adding Squared_distance…
soesau Feb 2, 2024
6e7587a
fixing tests
soesau Feb 2, 2024
3f361a4
fixes for ci
soesau Feb 2, 2024
f781012
fix for ci
soesau Feb 2, 2024
d9756dd
added missing include
soesau Feb 2, 2024
47bbc08
Revert "traversals are now templated by OrthtreeTraits"
soesau Feb 2, 2024
6f8b3ef
add surface mesh to doc dependencies
soesau Feb 2, 2024
b265ee9
fixing tests
soesau Feb 2, 2024
eb24ac1
Update Orthtree/doc/Orthtree/PackageDescription.txt
soesau Feb 2, 2024
cde61a5
changed property interface of Orthtree to be closer to Surface mesh
soesau Feb 5, 2024
3310585
added Pair_optional_adaptor (WIP)
soesau Feb 5, 2024
e4686a2
removed _node from Orthtree property API
soesau Feb 5, 2024
59ab399
license fix (GPL -> LGPL)
soesau Feb 6, 2024
4c1cf8d
working version of Pair_optional_adaptor
soesau Feb 6, 2024
75d1519
fixed test
soesau Feb 7, 2024
a5aba5b
removing Pair_optional_adaptor
soesau Feb 7, 2024
7b5e2be
switching Property_container to multimap to allow properties that sha…
soesau Feb 8, 2024
9c93b60
removing trailing whitespaces
soesau Feb 8, 2024
8f106bf
removed old occurrence of m_property_arrays
soesau Feb 8, 2024
009791f
adaptation of Orthtree interface to allow OrthtreeTraits without data
soesau Feb 13, 2024
ae18495
simplify implementation of no data case to make it work with non MSVC…
sloriot Feb 13, 2024
6fd4a02
use a wrapper for node data
sloriot Feb 13, 2024
1c6fdbd
undo some changes from b241bc8594ada289b1ed1b3f239dfb5bdc0cee31
sloriot Feb 13, 2024
83d0f63
add missing assignment
sloriot Feb 13, 2024
446d396
return data by ref
sloriot Feb 13, 2024
c04b584
added concept for orthtree without data
soesau Feb 13, 2024
d3fdd5e
update doc of nearest neighbors search
soesau Feb 14, 2024
d5a92a4
renaming OrthtreeTraitsWithoutData and OrthtreeTraits
soesau Feb 14, 2024
20e3cb8
remove no longer needed boost headers
sloriot Feb 15, 2024
c580e30
small doc update
soesau Feb 19, 2024
b503b42
typos + clean up
sloriot Feb 19, 2024
14089f5
clean up
sloriot Feb 19, 2024
c954092
renaming Orthtree_traits_without_data
soesau Feb 20, 2024
6d84c07
pass on doc
soesau Feb 20, 2024
d95d650
added parameter to Orthtree_traits_point to use square/cubic space
soesau Feb 20, 2024
0419507
missing template parameter
soesau Feb 20, 2024
ca4d146
fix for ci
soesau Feb 20, 2024
fc95354
Update Orthtree/doc/Orthtree/Concepts/OrthtreeTraitsWithData.h
soesau Feb 21, 2024
2fb6c40
bug fix
soesau Feb 21, 2024
7b907d5
pass on doc
soesau Feb 21, 2024
5ad3d90
added requirements for Node_data
soesau Feb 21, 2024
2bbf5b8
added functors for accessing Sphere_d
soesau Feb 21, 2024
95ba635
renamed getter for functors in CollectionPartitioningOrthtreeTraits
soesau Feb 21, 2024
9ee06f2
ci fix for msvc2017
soesau Feb 22, 2024
aec5818
re-adding nearest_neighbors as deprecated method in Orthtree
soesau Feb 26, 2024
a628773
ci fix
soesau Feb 26, 2024
9e6fefa
missing header
soesau Feb 26, 2024
a3a102c
more missing headers
soesau Feb 26, 2024
99104e5
replaced call to CGAL::squared_distance
soesau Feb 27, 2024
84d17b6
renaming _3 functors in CollectionPartitioningOrthtreeTraits to _d
soesau Feb 27, 2024
3251248
reintegrated nearest neighbors into Orthtree
soesau Feb 27, 2024
08a7a66
bugfix nearest neighbor search
soesau Feb 28, 2024
b3b9bf0
doc section on migration
soesau Feb 28, 2024
c622af1
add mesh orthtree picture
sloriot Feb 28, 2024
3da1087
try to improve phrasing
sloriot Feb 29, 2024
dffac51
restore old behavior with a forward constructor
sloriot Feb 29, 2024
3714189
Update Orthtree/include/CGAL/Orthtree_traits_base.h
soesau Mar 1, 2024
ff5f855
Update Orthtree/include/CGAL/Orthtree_traits_face_graph.h
soesau Mar 1, 2024
d85edb3
Update Orthtree/include/CGAL/Orthtree_traits_base.h
soesau Mar 1, 2024
d49529d
Update Orthtree/include/CGAL/Orthtree.h
soesau Mar 1, 2024
b5741aa
Update Orthtree/include/CGAL/Orthtree.h
soesau Mar 1, 2024
8574b1c
Update Orthtree/include/CGAL/Orthtree.h
soesau Mar 1, 2024
87d8952
Update Orthtree/include/CGAL/Orthtree_traits_base.h
soesau Mar 1, 2024
020f323
Update Orthtree/include/CGAL/Orthtree.h
soesau Mar 1, 2024
683be7a
Update Orthtree/include/CGAL/Orthtree.h
soesau Mar 1, 2024
5bf13e8
Update Orthtree/include/CGAL/Octree.h
soesau Mar 1, 2024
f90dfba
Update Orthtree/include/CGAL/Quadtree.h
soesau Mar 1, 2024
37220d4
Update Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h
soesau Mar 1, 2024
159bd6d
Update Orthtree/doc/Orthtree/PackageDescription.txt
soesau Mar 1, 2024
48c1fef
moving package headers to front
soesau Mar 1, 2024
77622a6
renamed nearest_neighbors to neighbors_in_radius
soesau Mar 1, 2024
fd20d98
functor parameter fix
soesau Mar 1, 2024
546888c
lower number of sample points to 20
soesau Mar 1, 2024
a8fd56c
using 'contained elements' instead of elements to descripe split pred…
soesau Mar 1, 2024
caa833f
renaming nearest_neighbors to nearest_k_neighbors
soesau Mar 1, 2024
fcbb922
making benchmark compilable
soesau Mar 1, 2024
130cf57
created local copy of point before using Cartesian_ranges
soesau Mar 1, 2024
7bf227d
removed wrong model which is actually a concept
soesau Mar 5, 2024
22e5a3f
renaming nearest_k_neighbors_in_radius and neighbors_in_radius
soesau Mar 5, 2024
0abf031
doc update on migration
soesau Mar 5, 2024
0f532d7
ws
sloriot Mar 5, 2024
786b015
doc copy and move constructors
sloriot Mar 6, 2024
1e71bbe
update changes
sloriot Mar 6, 2024
426f506
workaround warning
sloriot Mar 13, 2024
3471add
simplify disambiguation
sloriot Mar 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Orthtree/include/CGAL/Orthtree.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class Orthtree {


// init bbox with first values found
auto [bbox_min, bbox_max] = m_traits.root_node_bbox();
auto [bbox_min, bbox_max] = m_traits.root_node_bbox_object()();

// Dilate the bounding box
Array bbox_centroid;
Expand All @@ -246,7 +246,7 @@ class Orthtree {
// save orthtree attributes
m_bbox_min = construct_point_d_from_array(bbox_min);
m_side_per_depth.push_back(bbox_max[0] - bbox_min[0]);
data(root()) = m_traits.root_node_contents();
data(root()) = m_traits.root_node_contents_object()();
}

/// @}
Expand Down Expand Up @@ -830,7 +830,7 @@ class Orthtree {
Point center = barycenter(n);

// Add the node's points to its children
m_traits.distribute_node_contents(n, *this, center);
m_traits.distribute_node_contents_object()(n, *this, center);
}

/*!
Expand Down Expand Up @@ -1031,7 +1031,7 @@ class Orthtree {

// Pair that point with its distance from the search point
Node_element_with_distance current_point_with_distance =
{p, squared_distance(m_traits.get_element(p), search_bounds.center())};
{p, squared_distance(m_traits.get_element_object()(p), search_bounds.center())};

// Check if the new point is within the bounds
if (current_point_with_distance.distance < search_bounds.squared_radius()) {
Expand Down
2 changes: 1 addition & 1 deletion Orthtree/include/CGAL/Orthtree_traits_3_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct Orthtree_traits_3_base {
using Bbox_d = Bbox_3;
using FT = typename K::FT;
using Point_d = typename K::Point_3;
using Sphere_d = typename K::Circle_3;
using Sphere_d = typename K::Sphere_3;
using Cartesian_const_iterator_d = typename K::Cartesian_const_iterator_3;
using Array = std::array<FT, Dimension::value>; // todo: This should have a more descriptive name

Expand Down
74 changes: 42 additions & 32 deletions Orthtree/include/CGAL/Orthtree_traits_point_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct Orthtree_traits_point_2 : public Orthtree_traits_2_base<GeomTraits> {
/// @{

using Self = Orthtree_traits_point_2<GeomTraits, PointSet, PointMap>;
using Tree = Orthtree<Self>;

// todo: looking for better names
using Node_data = boost::iterator_range<typename PointSet::iterator>;
Expand Down Expand Up @@ -108,46 +109,55 @@ struct Orthtree_traits_point_2 : public Orthtree_traits_2_base<GeomTraits> {
*/
Construct_bbox_d construct_bbox_d_object() const { return Construct_bbox_d(); }

std::pair<typename Self::Array, typename Self::Array> root_node_bbox() const {

typename Self::Array bbox_min;
typename Self::Array bbox_max;
Orthtrees::internal::Cartesian_ranges<Self> cartesian_range;

// init bbox with first values found
{
const typename Self::Point_d& point = get(m_point_map, *(m_point_set.begin()));
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = x;
bbox_max[i] = x;
++i;
auto root_node_bbox_object() const {
return [&]() -> std::pair<typename Self::Array, typename Self::Array> {

typename Self::Array bbox_min;
typename Self::Array bbox_max;
Orthtrees::internal::Cartesian_ranges<Self> cartesian_range;

// init bbox with first values found
{
const typename Self::Point_d& point = get(m_point_map, *(m_point_set.begin()));
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = x;
bbox_max[i] = x;
++i;
}
}
}
// Expand bbox to contain all points
for (const auto& p: m_point_set) {
const typename Self::Point_d& point = get(m_point_map, p);
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = (std::min)(x, bbox_min[i]);
bbox_max[i] = (std::max)(x, bbox_max[i]);
++i;
// Expand bbox to contain all points
for (const auto& p: m_point_set) {
const typename Self::Point_d& point = get(m_point_map, p);
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = (std::min)(x, bbox_min[i]);
bbox_max[i] = (std::max)(x, bbox_max[i]);
++i;
}
}
}

return {bbox_min, bbox_max};
return {bbox_min, bbox_max};
};
}

Node_data root_node_contents() const { return {m_point_set.begin(), m_point_set.end()}; }
auto root_node_contents_object() const {
return [&]() -> typename Self::Node_data {
return {m_point_set.begin(), m_point_set.end()};
};
}

template <typename Node_index, typename Tree>
void distribute_node_contents(Node_index n, Tree& tree, const typename Self::Point_d& center) {
CGAL_precondition(!tree.is_leaf(n));
reassign_points(tree, m_point_map, n, center, tree.data(n));
auto distribute_node_contents_object() const {
return [&](typename Tree::Node_index n, Tree& tree, const typename Self::Point_d& center) {
CGAL_precondition(!tree.is_leaf(n));
reassign_points(tree, m_point_map, n, center, tree.data(n));
};
}

typename Self::Point_d get_element(const Node_data_element& index) const {
return get(m_point_map, index);
auto get_element_object() const {
return [&](const Node_data_element& index) -> typename Self::Point_d {
return get(m_point_map, index);
};
}

/// @}
Expand Down
78 changes: 44 additions & 34 deletions Orthtree/include/CGAL/Orthtree_traits_point_3.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct Orthtree_traits_point_3 : public Orthtree_traits_3_base<GeomTraits> {
/// @{

using Self = Orthtree_traits_point_3<GeomTraits, PointSet, PointMap>;
using Tree = Orthtree<Self>;

// todo: looking for better names
using Node_data = boost::iterator_range<typename PointSet::iterator>;
Expand Down Expand Up @@ -80,8 +81,8 @@ struct Orthtree_traits_point_3 : public Orthtree_traits_3_base<GeomTraits> {

struct Construct_bbox_d {
typename Self::Bbox_d operator()(const typename Self::Array& min,
const typename Self::Array& max) const {
return Bbox_d(min[0], min[1], min[2], max[0], max[1], max[2]);
const typename Self::Array& max) const {
return typename Self::Bbox_d(min[0], min[1], min[2], max[0], max[1], max[2]);
}
};

Expand All @@ -107,46 +108,55 @@ struct Orthtree_traits_point_3 : public Orthtree_traits_3_base<GeomTraits> {
*/
Construct_bbox_d construct_bbox_d_object() const { return Construct_bbox_d(); }

std::pair<typename Self::Array, typename Self::Array> root_node_bbox() const {

typename Self::Array bbox_min;
typename Self::Array bbox_max;
Orthtrees::internal::Cartesian_ranges<Self> cartesian_range;

// init bbox with first values found
{
const typename Self::Point_d& point = get(m_point_map, *(m_point_set.begin()));
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = x;
bbox_max[i] = x;
++i;
auto root_node_bbox_object() const {
return [&]() -> std::pair<typename Self::Array, typename Self::Array> {

typename Self::Array bbox_min;
typename Self::Array bbox_max;
Orthtrees::internal::Cartesian_ranges<Self> cartesian_range;

// init bbox with first values found
{
const typename Self::Point_d& point = get(m_point_map, *(m_point_set.begin()));
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = x;
bbox_max[i] = x;
++i;
}
}
}
// Expand bbox to contain all points
for (const auto& p: m_point_set) {
const typename Self::Point_d& point = get(m_point_map, p);
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = (std::min)(x, bbox_min[i]);
bbox_max[i] = (std::max)(x, bbox_max[i]);
++i;
// Expand bbox to contain all points
for (const auto& p: m_point_set) {
const typename Self::Point_d& point = get(m_point_map, p);
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = (std::min)(x, bbox_min[i]);
bbox_max[i] = (std::max)(x, bbox_max[i]);
++i;
}
}
}

return {bbox_min, bbox_max};
return {bbox_min, bbox_max};
};
}

typename Self::Node_data root_node_contents() const { return {m_point_set.begin(), m_point_set.end()}; }
auto root_node_contents_object() const {
return [&]() -> typename Self::Node_data {
return {m_point_set.begin(), m_point_set.end()};
};
}

template <typename Node_index, typename Tree>
void distribute_node_contents(Node_index n, Tree& tree, const typename Self::Point_d& center) {
CGAL_precondition(!tree.is_leaf(n));
reassign_points(tree, m_point_map, n, center, tree.data(n));
auto distribute_node_contents_object() const {
return [&](typename Tree::Node_index n, Tree& tree, const typename Self::Point_d& center) {
CGAL_precondition(!tree.is_leaf(n));
reassign_points(tree, m_point_map, n, center, tree.data(n));
};
}

typename Self::Point_d get_element(const Node_data_element& index) const {
return get(m_point_map, index);
auto get_element_object() const {
return [&](const Node_data_element& index) -> typename Self::Point_d {
return get(m_point_map, index);
};
}
JacksonCampolattaro marked this conversation as resolved.
Show resolved Hide resolved

/// @}
Expand Down
77 changes: 44 additions & 33 deletions Orthtree/include/CGAL/Orthtree_traits_point_d.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct Orthtree_traits_point_d : public Orthtree_traits_d_base<GeomTraits, Dimen
/// @{

using Self = Orthtree_traits_point_d<GeomTraits, DimensionTag, PointSet, PointMap>;
using Tree = Orthtree<Self>;

using Node_data = boost::iterator_range<typename PointSet::iterator>;
using Node_data_element = typename std::iterator_traits<typename PointSet::iterator>::value_type;
Expand Down Expand Up @@ -116,7 +117,8 @@ struct Orthtree_traits_point_d : public Orthtree_traits_d_base<GeomTraits, Dimen

struct Construct_bbox_d {
typename Self::Bbox_d operator()(const typename Self::Array& min, const typename Self::Array& max) const {
return typename Self::Bbox_d(typename Self::Point_d(min.begin(), min.end()), typename Self::Point_d(max.begin(), max.end()));
return typename Self::Bbox_d(typename Self::Point_d(min.begin(), min.end()),
typename Self::Point_d(max.begin(), max.end()));
}
};

Expand All @@ -142,46 +144,55 @@ struct Orthtree_traits_point_d : public Orthtree_traits_d_base<GeomTraits, Dimen
*/
Construct_bbox_d construct_bbox_d_object() const { return Construct_bbox_d(); }

std::pair<typename Self::Array, typename Self::Array> root_node_bbox() const {

typename Self::Array bbox_min;
typename Self::Array bbox_max;
Orthtrees::internal::Cartesian_ranges<Self> cartesian_range;

// init bbox with first values found
{
const auto& point = get(m_point_map, *(m_point_set.begin()));
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = x;
bbox_max[i] = x;
++i;
auto root_node_bbox_object() const {
return [&]() -> std::pair<typename Self::Array, typename Self::Array> {

typename Self::Array bbox_min;
typename Self::Array bbox_max;
Orthtrees::internal::Cartesian_ranges<Self> cartesian_range;

// init bbox with first values found
{
const typename Self::Point_d& point = get(m_point_map, *(m_point_set.begin()));
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = x;
bbox_max[i] = x;
++i;
}
}
}
// Expand bbox to contain all points
for (const auto& p: m_point_set) {
const auto& point = get(m_point_map, p);
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = (std::min)(x, bbox_min[i]);
bbox_max[i] = (std::max)(x, bbox_max[i]);
++i;
// Expand bbox to contain all points
for (const auto& p: m_point_set) {
const typename Self::Point_d& point = get(m_point_map, p);
std::size_t i = 0;
for (const typename Self::FT& x: cartesian_range(point)) {
bbox_min[i] = (std::min)(x, bbox_min[i]);
bbox_max[i] = (std::max)(x, bbox_max[i]);
++i;
}
}
}

return {bbox_min, bbox_max};
return {bbox_min, bbox_max};
};
}

Node_data root_node_contents() const { return {m_point_set.begin(), m_point_set.end()}; }
auto root_node_contents_object() const {
return [&]() -> typename Self::Node_data {
return {m_point_set.begin(), m_point_set.end()};
};
}

template <typename Node_index, typename Tree>
void distribute_node_contents(Node_index n, Tree& tree, const typename Self::Point_d& center) {
CGAL_precondition(!tree.is_leaf(n));
reassign_points(tree, m_point_map, n, center, tree.data(n));
auto distribute_node_contents_object() const {
return [&](typename Tree::Node_index n, Tree& tree, const typename Self::Point_d& center) {
CGAL_precondition(!tree.is_leaf(n));
reassign_points(tree, m_point_map, n, center, tree.data(n));
};
}

typename Self::Point_d get_element(const Node_data_element& index) const {
return get(m_point_map, index);
auto get_element_object() const {
return [&](const Node_data_element& index) -> typename Self::Point_d {
return get(m_point_map, index);
};
}

/// @}
Expand Down