diff --git a/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h b/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h index b475ad5dedf..bd5e23f0bae 100755 --- a/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h +++ b/Snap_rounding_2/include/CGAL/Snap_rounding_traits_2.h @@ -1,5 +1,4 @@ -// Copyright (c) 2001 Tel-Aviv University (Israel). -// 2009,2014 Max-Planck-Institute Saarbruecken (Germany). +// Copyright (c) 2001,2009,2014 Tel-Aviv University (Israel), Max-Planck-Institute Saarbruecken (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -15,9 +14,9 @@ // // $URL$ // $Id$ -// // -// author(s) : Eli Packer , +// +// author(s) : Eli Packer , // Waqar Khan #ifndef CGAL_SNAP_ROUNDING_2_TRAITS_H @@ -58,7 +57,7 @@ public: // otherwise Segment_data cannot access the types typedef CGAL::Arr_segment_traits_2 Base_traits; typedef typename Base_traits::Compare_x_2 Compare_x_2; typedef CGAL::To_double To_double; - + public: /*! Functor */ class Snap_2 { diff --git a/Spatial_searching/include/CGAL/Kd_tree.h b/Spatial_searching/include/CGAL/Kd_tree.h index bbd62f1f310..30b92cdf2b6 100644 --- a/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Spatial_searching/include/CGAL/Kd_tree.h @@ -1,5 +1,4 @@ -// Copyright (c) 2002,2011 Utrecht University (The Netherlands). -// 2009,2014 Max-Planck-Institute Saarbruecken (Germany) +// Copyright (c) 2002,2011,2014 Utrecht University (The Netherlands), Max-Planck-Institute Saarbruecken (Germany). // All rights reserved. // // This file is part of CGAL (www.cgal.org). @@ -15,8 +14,8 @@ // // $URL$ // $Id$ -// -// Author(s) : Hans Tangelder (), +// +// Author(s) : Hans Tangelder (), // : Waqar Khan #ifndef CGAL_KD_TREE_H @@ -46,7 +45,7 @@ public: typedef Splitter_ Splitter; typedef typename SearchTraits::Point_d Point_d; typedef typename Splitter::Container Point_container; - + typedef typename SearchTraits::FT FT; typedef Kd_tree_node Node; typedef Kd_tree Tree; @@ -59,7 +58,7 @@ public: typedef typename Splitter::Separator Separator; typedef typename std::vector::const_iterator iterator; typedef typename std::vector::const_iterator const_iterator; - + typedef typename std::vector::size_type size_type; private: @@ -75,7 +74,7 @@ private: // Instead of storing the points in arrays in the Kd_tree_node // we put all the data in a vector in the Kd_tree. // and we only store an iterator range in the Kd_tree_node. - // + // std::vector data; @@ -95,7 +94,7 @@ private: // the allocation of the nodes. // The leaf node - Node_handle + Node_handle create_leaf_node(Point_container& c) { Node_handle nh = nodes.emplace(static_cast(c.size()), Node::LEAF); @@ -104,40 +103,40 @@ private: return nh; } - + // The internal node - Node_handle + Node_handle create_internal_node(Point_container& c, const Tag_true&) { return create_internal_node_use_extension(c); } - Node_handle + Node_handle create_internal_node(Point_container& c, const Tag_false&) { return create_internal_node(c); } - - + + // TODO: Similiar to the leaf_init function above, a part of the code should be // moved to a the class Kd_tree_node. // It is not proper yet, but the goal was to see if there is // a potential performance gain through the Compact_container - Node_handle + Node_handle create_internal_node_use_extension(Point_container& c) { Node_handle nh = nodes.emplace(Node::EXTENDED_INTERNAL); - + Point_container c_low(c.dimension(),traits_); split(nh->separator(), c, c_low); - + int cd = nh->separator().cutting_dimension(); - + nh->low_val = c_low.bounding_box().min_coord(cd); nh->high_val = c.bounding_box().max_coord(cd); - + CGAL_assertion(nh->separator().cutting_value() >= nh->low_val); CGAL_assertion(nh->separator().cutting_value() <= nh->high_val); @@ -151,21 +150,21 @@ private: }else{ nh->upper_ch = create_leaf_node(c); } - + return nh; } - + // Note also that I duplicated the code to get rid if the if's for // the boolean use_extension which was constant over the construction - Node_handle + Node_handle create_internal_node(Point_container& c) { Node_handle nh = nodes.emplace(Node::INTERNAL); - + Point_container c_low(c.dimension(),traits_); split(nh->separator(), c, c_low); - + if (c_low.size() > split.bucket_size()){ nh->lower_ch = create_internal_node(c_low); }else{ @@ -186,11 +185,11 @@ public: Kd_tree(Splitter s = Splitter(),const SearchTraits traits=SearchTraits()) : traits_(traits),split(s), built_(false) {} - + template Kd_tree(InputIterator first, InputIterator beyond, - Splitter s = Splitter(),const SearchTraits traits=SearchTraits()) - : traits_(traits),split(s), built_(false) + Splitter s = Splitter(),const SearchTraits traits=SearchTraits()) + : traits_(traits),split(s), built_(false) { pts.insert(pts.end(), first, beyond); } @@ -198,13 +197,13 @@ public: bool empty() const { return pts.empty(); } - - void + + void build() { const Point_d& p = *pts.begin(); typename SearchTraits::Construct_cartesian_const_iterator_d ccci=traits_.construct_cartesian_const_iterator_d_object(); - int dim = static_cast(std::distance(ccci(p), ccci(p,0))); + int dim = static_cast(std::distance(ccci(p), ccci(p,0))); data.reserve(pts.size()); for(unsigned int i = 0; i < pts.size(); i++){ @@ -215,12 +214,12 @@ public: if (c.size() <= split.bucket_size()){ tree_root = create_leaf_node(c); }else { - tree_root = create_internal_node(c, UseExtendedNode()); + tree_root = create_internal_node(c, UseExtendedNode()); } built_ = true; } -private: +private: //any call to this function is for the moment not threadsafe void const_build() const { #ifdef CGAL_HAS_THREADS @@ -231,7 +230,7 @@ private: const_cast(this)->build(); //THIS IS NOT THREADSAFE } public: - + bool is_built() const { return built_; @@ -246,22 +245,22 @@ public: built_ = false; } } - + void clear() { invalidate_built(); pts.clear(); } - + void insert(const Point_d& p) { invalidate_built(); pts.push_back(p); - } - + } + template - void + void insert(InputIterator first, InputIterator beyond) { invalidate_built(); @@ -276,11 +275,11 @@ public: template - OutputIterator + OutputIterator search(OutputIterator it, const FuzzyQueryItem& q) const { if(! pts.empty()){ - + if(! is_built()){ const_build(); } @@ -298,27 +297,27 @@ public: const SearchTraits& - traits() const + traits() const { return traits_; } - Node_const_handle - root() const - { + Node_const_handle + root() const + { if(! is_built()){ const_build(); } - return tree_root; + return tree_root; } - Node_handle + Node_handle root() { if(! is_built()){ build(); } - return tree_root; + return tree_root; } void @@ -331,12 +330,12 @@ public: } const Kd_tree_rectangle& - bounding_box() const + bounding_box() const { if(! is_built()){ const_build(); } - return *bbox; + return *bbox; } const_iterator @@ -351,23 +350,23 @@ public: return pts.end(); } - size_type - size() const + size_type + size() const { return pts.size(); } // Print statistics of the tree. - std::ostream& + std::ostream& statistics(std::ostream& s) const { if(! is_built()){ const_build(); } s << "Tree statistics:" << std::endl; - s << "Number of items stored: " + s << "Number of items stored: " << root()->num_items() << std::endl; - s << "Number of nodes: " + s << "Number of nodes: " << root()->num_nodes() << std::endl; s << " Tree depth: " << root()->depth() << std::endl; return s;