From f1077798a69cd65704c262986c609ac2686deb49 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Fri, 19 Jun 2015 09:42:59 +0200 Subject: [PATCH] [GL] OctTree::createOctTree returns pointer instead of obj. At the moment it is not possible to write oct_tree = createOctTree() because the copy constructor is explicitely deleted. In my point of view it does not make sense to implement a copy constructor. Sometimes it is necessary to recreate the OctTree, for instance if the spatial size has changed. --- GeoLib/OctTree-impl.h | 4 ++-- GeoLib/OctTree.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/GeoLib/OctTree-impl.h b/GeoLib/OctTree-impl.h index 1387933378e..8a4553758ef 100644 --- a/GeoLib/OctTree-impl.h +++ b/GeoLib/OctTree-impl.h @@ -15,7 +15,7 @@ namespace GeoLib { template <typename POINT, std::size_t MAX_POINTS> template <typename T> -OctTree<POINT, MAX_POINTS> OctTree<POINT, MAX_POINTS>::createOctTree(T ll, T ur, +OctTree<POINT, MAX_POINTS>* OctTree<POINT, MAX_POINTS>::createOctTree(T ll, T ur, double eps) { // compute an axis aligned cube around the points ll and ur @@ -49,7 +49,7 @@ OctTree<POINT, MAX_POINTS> OctTree<POINT, MAX_POINTS>::createOctTree(T ll, T ur, ur[k] += eps; } } - return OctTree<POINT, MAX_POINTS>(ll, ur, eps); + return new OctTree<POINT, MAX_POINTS>(ll, ur, eps); } template <typename POINT, std::size_t MAX_POINTS> diff --git a/GeoLib/OctTree.h b/GeoLib/OctTree.h index a87eff58775..4d6045c544c 100644 --- a/GeoLib/OctTree.h +++ b/GeoLib/OctTree.h @@ -45,7 +45,7 @@ public: /// inside a OctTree leaf may be more expensive. The value should be /// choosen application dependend. [default 8] template <typename T> - static OctTree<POINT, MAX_POINTS> createOctTree(T ll, T ur, + static OctTree<POINT, MAX_POINTS>* createOctTree(T ll, T ur, double eps = std::numeric_limits<double>::epsilon()); /// Destroys the children of this node. @attention Does not destroy the -- GitLab