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 90 commits
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 BGL/include/CGAL/boost/graph/IO/Generic_facegraph_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ class Generic_facegraph_builder

// Construct the graph
VPM vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_property_map(CGAL::vertex_point, g));
VNM vnm = choose_parameter(get_parameter(np, internal_np::vertex_normal_map), VNM());
VCM vcm = choose_parameter(get_parameter(np, internal_np::vertex_color_map), VCM());
VTM vtm = choose_parameter(get_parameter(np, internal_np::vertex_texture_map), VTM());
FCM fcm = choose_parameter(get_parameter(np, internal_np::face_color_map), FCM());
VNM vnm = choose_parameter<VNM>(get_parameter(np, internal_np::vertex_normal_map));
VCM vcm = choose_parameter<VCM>(get_parameter(np, internal_np::vertex_color_map));
VTM vtm = choose_parameter<VTM>(get_parameter(np, internal_np::vertex_texture_map));
FCM fcm = choose_parameter<FCM>(get_parameter(np, internal_np::face_color_map));

const bool has_vertex_normals = (is_vnm_requested && !(vertex_normals.empty()));
const bool has_vertex_colors = (is_vcm_requested && !(vertex_colors.empty()));
Expand Down
71 changes: 71 additions & 0 deletions Orthtree/doc/Orthtree/Concepts/OrthtreeTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,34 @@ class OrthtreeTraits
typedef unspecified_type Cartesian_const_iterator_d;
typedef std::array<FT, Dimension::value> Array; ///< Array used for easy point constructions.


/*!
* \brief List-like or iterable type contained by each node
*
* Should provide begin() and end() iterators which span all the items contained by a node.
* Must also be default-constructible, because node data is allocated ahead of time.
* Many split predicates also expect a `Node_data::size()` method.
* For example, this could be a `boost::range` of point indices, or an `std::vector` containing primitives.
*
afabri marked this conversation as resolved.
Show resolved Hide resolved
* todo: For an empty tree, this should contain something like `std::array<Point_d, 0>`.
* This way, nearest_neighbors still compiles, and simply returns nothing because all nodes are empty.
* Eventually, nearest_neighbors will be removed and/or moved, and then this won't have to behave like a list.
* Once that's done, `boost::none_t` will work for an empty tree.
*/
typedef unspecified_type Node_data;

/*!
* \brief An element of the `Node_data` list-like type.
*
* Must be constructible from the type produced by dereferencing a `Node_data` iterator.
* Typically the same as that type, but can also be an `std::reference_wrapper<>` if the type is not copyable.
*
* todo: This is only used as part of the return type for `nearest_neighbors()`.
* Because `nearest_neighbors()` may be ill defined for empty node types,
* this can be omitted in the final version of Orthtree_traits.
*/
typedef unspecified_type Node_data_element;

typedef unspecified_type Adjacency; ///< Specify the adjacency directions

/*!
Expand Down Expand Up @@ -56,5 +84,48 @@ class OrthtreeTraits
*/
Construct_bbox_d construct_bbox_d_object() const;

/*!
* \brief Produces a bounding box which encloses the contents of the tree
*
* The bounding box must enclose all elements contained by the tree.
* It may be tight-fitting, the orthtree constructor produces a bounding cube surrounding this region.
* For traits which assign no data to each node, this can be defined to return a fixed region.
*
* @return std::pair<min, max>, where min and max represent cartesian corners which define a bounding box
*/
std::pair<Array, Array> root_node_bbox() const;

/*!
* \brief Initializes the contained elements for the root node.
*
* Typically produces a `Node_data` which contains all the elements in the tree.
* e.g. For a tree where each node contains a set of points,
* root_node_contents() will produce the list of all points.
*
* @return The `Node_data` instance to be contained by the root node
*/
Node_data root_node_contents() const;

/*!
* \brief Distributes the `Node_data` contents of a node to its immediate children.
*
* Invoked after a node is split.
* Adds the contents of the node n to each of its children.
* May rearrange or modify n's `Node_data`, but generally expected not to reset n.
* After distributing n's contents, n should still have an list of elements it encloses.
* Each of n's children should have an accurate list of the subset of elements within n they enclose.
*
* For an empty tree, this can be a null-op.
*
* @tparam Node_index The index type used by an orthtree implementation
* @tparam Tree An Orthree implementation
*
* @param n The index of the node who's contents must be distributed.
* @param tree The Orthtree which n belongs to
* @param center The coordinate center of the node n, which its contents should be split around.
*/
template <typename Node_index, typename Tree>
void distribute_node_contents(Node_index n, Tree& tree, const Point_d& center);

/// @}
};
2 changes: 1 addition & 1 deletion Orthtree/doc/Orthtree/Orthtree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ split.

\subsection Section_Orthtree_Point_Vector Building an Octree

The `Orthtree` class may be templated with `Orthtree_traits_3` and thus
The `Orthtree` class may be templated with `Orthtree_traits_point_3` and thus
behave as an %octree. For convenience, the alias `Octree` is provided.

The following example shows how to create an %octree from a vector of
Expand Down
2 changes: 1 addition & 1 deletion Orthtree/doc/Orthtree/PackageDescription.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

\cgalCRPSection{Traits}
- `CGAL::Orthtree_traits_2<GeomTraits>`
- `CGAL::Orthtree_traits_3<GeomTraits>`
- `CGAL::Orthtree_traits_point_3<GeomTraits>`
- `CGAL::Orthtree_traits_d<GeomTraits, Dimension>`

\cgalCRPSection{Split Predicates}
Expand Down
2 changes: 2 additions & 0 deletions Orthtree/examples/Orthtree/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ create_single_source_cgal_program("octree_traversal_manual.cpp")
create_single_source_cgal_program("octree_traversal_preorder.cpp")
create_single_source_cgal_program("octree_grade.cpp")
create_single_source_cgal_program("quadtree_build_from_point_vector.cpp")
create_single_source_cgal_program("octree_surface_mesh.cpp")
create_single_source_cgal_program("quadtree_build_manually.cpp")

find_package(Eigen3 3.1.91 QUIET) #(requires 3.1.91 or greater)
include(CGAL_Eigen_support)
Expand Down
4 changes: 2 additions & 2 deletions Orthtree/examples/Orthtree/octree_build_from_point_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ int main(int argc, char **argv) {
std::cout << "loaded " << points.number_of_points() << " points\n" << std::endl;

// Create an octree from the points
Octree octree(points, points.point_map());
Octree octree({points, points.point_map()});

// Build the octree with a small bucket size, using a more verbose method
octree.refine(CGAL::Orthtrees::Maximum_depth_and_maximum_number_of_inliers(5, 10));

// Print out the tree
std::cout << octree;
std::cout << octree << std::endl;

return EXIT_SUCCESS;
}
6 changes: 3 additions & 3 deletions Orthtree/examples/Orthtree/octree_build_from_point_vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Type Declarations
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;
typedef std::list<Point> Point_vector;
typedef std::vector<Point> Point_vector; // todo: this was changed to std::list at some point; why?

typedef CGAL::Octree<Kernel, Point_vector> Octree;

Expand All @@ -24,10 +24,10 @@ int main() {
points.emplace_back(-1, 1, 1);

// Create an octree from the points
Octree octree(points);
Octree octree({points});

// Build the octree
octree.refine(10, 20);
octree.refine(10, 1);

// Print out the tree
std::cout << octree;
Expand Down
12 changes: 7 additions & 5 deletions Orthtree/examples/Orthtree/octree_build_with_custom_split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ struct Split_by_ratio {

std::size_t ratio;

Split_by_ratio(std::size_t ratio) : ratio(ratio) {}
explicit Split_by_ratio(std::size_t ratio) : ratio(ratio) {}

template<class Node>
bool operator()(const Node &n) const {
return n.size() > (ratio * n.depth());
template<typename Node_index, typename Tree>
bool operator()(Node_index i, const Tree &tree) const {
std::size_t num_points = tree.data(i).size();
std::size_t depth = tree.depth(i);
return num_points > (ratio * depth);
}
};

Expand All @@ -45,7 +47,7 @@ int main(int argc, char **argv) {
std::cout << "loaded " << points.number_of_points() << " points" << std::endl;

// Create an octree from the points
Octree octree(points, points.point_map());
Octree octree({points, points.point_map()});

// Build the octree using our custom split predicate
octree.refine(Split_by_ratio(2));
Expand Down
30 changes: 14 additions & 16 deletions Orthtree/examples/Orthtree/octree_find_nearest_neighbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ typedef Point_set::Point_map Point_map;

typedef CGAL::Octree<Kernel, Point_set, Point_map> Octree;

int main(int argc, char **argv) {
int main(int argc, char** argv) {

// Point set will be used to hold our points
Point_set points;
Expand All @@ -32,28 +32,26 @@ int main(int argc, char **argv) {
std::cout << "loaded " << points.number_of_points() << " points" << std::endl;

// Create an octree from the points
Octree octree(points, points.point_map());
Octree octree({points, points.point_map()});

// Build the octree
octree.refine(10, 20);

// Find the nearest points to a few locations
std::vector<Point> points_to_find = {
{0, 0, 0},
{1, 1, 1},
{-1, -1, -1},
{-0.46026, -0.25353, 0.32051},
{-0.460261, -0.253533, 0.320513}
{0, 0, 0},
{1, 1, 1},
{-1, -1, -1},
{-0.46026, -0.25353, 0.32051},
{-0.460261, -0.253533, 0.320513}
};
for (const Point& p : points_to_find)
octree.nearest_neighbors
(p, 1, // k=1 to find the single closest point
boost::make_function_output_iterator
([&](const Point& nearest)
{
std::cout << "the nearest point to (" << p <<
") is (" << nearest << ")" << std::endl;
}));
for (const Point& p: points_to_find)
octree.nearest_neighbors(
p, 1, // k=1 to find the single closest point
boost::make_function_output_iterator([&](const Point_set::Index& nearest) {
std::cout << "the nearest point to (" << p << ") is (" << points.point(nearest) << ")" << std::endl;
})
);

return EXIT_SUCCESS;
}
2 changes: 1 addition & 1 deletion Orthtree/examples/Orthtree/octree_grade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int main() {
points.emplace_back(-1.0001, 1, 1);

// Create an octree from the points
Octree octree(points);
Octree octree({points});

// Build the octree with a small bucket size, so we get a deep node
octree.refine(10, 2);
Expand Down
69 changes: 69 additions & 0 deletions Orthtree/examples/Orthtree/octree_surface_mesh.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>

#include <CGAL/Octree.h>
#include <CGAL/Orthtree_traits_face_graph.h>

#include <CGAL/boost/graph/IO/polygon_mesh_io.h>

using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Mesh = CGAL::Surface_mesh<K::Point_3>;

using OTraits = CGAL::Orthtree_traits_face_graph<Mesh, Mesh::Property_map<Mesh::Vertex_index, K::Point_3>>;
using Octree = CGAL::Orthtree<OTraits>;

void dump_as_polylines(const Octree& ot)
{
// SL: I cheated for this part and looked at the implementation
std::ofstream out("octree.polylines.txt");
for (Octree::Node_index node : ot.traverse(CGAL::Orthtrees::Leaves_traversal<Octree>(ot)))
{
if (!ot.is_leaf(node))
continue;
CGAL::Bbox_3 bb = ot.bbox(node);
out << "2 " << bb.xmin() << " " << bb.ymin() << " " << bb.zmin()
<< " " << bb.xmax() << " " << bb.ymin() << " " << bb.zmin() << "\n";
out << "2 " << bb.xmin() << " " << bb.ymin() << " " << bb.zmin()
<< " " << bb.xmin() << " " << bb.ymax() << " " << bb.zmin() << "\n";
out << "2 " << bb.xmax() << " " << bb.ymin() << " " << bb.zmin()
<< " " << bb.xmax() << " " << bb.ymax() << " " << bb.zmin() << "\n";
out << "2 " << bb.xmin() << " " << bb.ymax() << " " << bb.zmin()
<< " " << bb.xmax() << " " << bb.ymax() << " " << bb.zmin() << "\n";
//
out << "2 " << bb.xmin() << " " << bb.ymin() << " " << bb.zmin()
<< " " << bb.xmin() << " " << bb.ymin() << " " << bb.zmax() << "\n";
out << "2 " << bb.xmax() << " " << bb.ymin() << " " << bb.zmin()
<< " " << bb.xmax() << " " << bb.ymin() << " " << bb.zmax() << "\n";
out << "2 " << bb.xmin() << " " << bb.ymax() << " " << bb.zmin()
<< " " << bb.xmin() << " " << bb.ymax() << " " << bb.zmax() << "\n";
out << "2 " << bb.xmax() << " " << bb.ymax() << " " << bb.zmin()
<< " " << bb.xmax() << " " << bb.ymax() << " " << bb.zmax() << "\n";
//
out << "2 " << bb.xmin() << " " << bb.ymin() << " " << bb.zmax()
<< " " << bb.xmax() << " " << bb.ymin() << " " << bb.zmax() << "\n";
out << "2 " << bb.xmin() << " " << bb.ymin() << " " << bb.zmax()
<< " " << bb.xmin() << " " << bb.ymax() << " " << bb.zmax() << "\n";
out << "2 " << bb.xmax() << " " << bb.ymin() << " " << bb.zmax()
<< " " << bb.xmax() << " " << bb.ymax() << " " << bb.zmax() << "\n";
out << "2 " << bb.xmin() << " " << bb.ymax() << " " << bb.zmax()
<< " " << bb.xmax() << " " << bb.ymax() << " " << bb.zmax() << "\n";
}
}

int main(int argc, char** argv)
{
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/elephant.off");

Mesh mesh;
if(!CGAL::IO::read_polygon_mesh(filename, mesh))
{
std::cerr << "Error: cannot read file" << std::endl;
return EXIT_FAILURE;
}

Octree tree({mesh, mesh.points()});
OTraits::Split_predicate_node_min_extent sp(0.01);
tree.refine(sp);

dump_as_polylines(tree);
}
37 changes: 23 additions & 14 deletions Orthtree/examples/Orthtree/octree_traversal_custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Octree.h>
#include <CGAL/Orthtree/IO.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/Point_set_3/IO.h>

Expand All @@ -15,22 +16,29 @@ typedef Point_set::Point_map Point_map;
typedef CGAL::Octree<Kernel, Point_set, Point_map> Octree;
typedef Octree::Node Node;

struct First_branch_traversal
{
Node first (Node root) const
{
return root;
template <typename Tree>
struct First_branch_traversal {

const Tree& m_orthtree;

explicit First_branch_traversal(const Tree& orthtree) : m_orthtree(orthtree) {}

typename Tree::Node_index first_index() const {
return m_orthtree.root();
}

Node next (Node n) const
{
if (n.is_leaf())
return Node();
return n[0];
typename Tree::Maybe_node_index next_index(typename Tree::Node_index n) const {

// Stop when we reach the base of the tree
if (m_orthtree.is_leaf(n))
return {};

// Always descend the first child
return m_orthtree.child(n, 0);
}
};

int main(int argc, char **argv) {
int main(int argc, char** argv) {

// Point set will be used to hold our points
Point_set points;
Expand All @@ -46,14 +54,15 @@ int main(int argc, char **argv) {
std::cout << "loaded " << points.number_of_points() << " points\n" << std::endl;

// Create an octree from the points
Octree octree(points, points.point_map());
Octree octree({points, points.point_map()});

// Build the octree
octree.refine();

// Print out the first branch using custom traversal
for (auto &node : octree.traverse<First_branch_traversal>())
std::cout << node << std::endl;
for (auto node: octree.traverse<First_branch_traversal<Octree>>()) {
std::cout << octree.to_string(node) << std::endl;
}

return EXIT_SUCCESS;
}
Loading