// ====================================================================== // // Copyright (c) 2002 The CGAL Consortium // // This software and related documentation is part of an INTERNAL release // of the Computational Geometry Algorithms Library (CGAL). It is not // intended for general use. // // ---------------------------------------------------------------------- // // release : // release_date : // // file : include/CGAL/Kd_tree_traits_point.h // package : ASPAS // revision : 1.4 // revision_date : 2002/16/08 // authors : Hans Tangelder () // maintainer : Hans Tangelder () // coordinator : Utrecht University // // ====================================================================== #ifndef CGAL_KD_TREE_TRAITS_POINT_H #define CGAL_KD_TREE_TRAITS_POINT_H #include namespace CGAL { template class Kd_tree_traits_point { public: typedef Separator_ Separator; typedef Item_ Item; typedef Item** Item_iterator; // CGAL dependency typedef typename Kernel_traits::Kernel K; // CGAL dependency typedef typename K::FT NT; typedef typename Item::R::FT NT; typedef std::pair Item_with_distance; typedef typename Split_rules::Split_rule split_rule; private: unsigned int the_bucket_size; split_rule the_selected_split_rule; NT the_aspect_ratio; bool use_extended_nodes_option; public: Kd_tree_traits_point(unsigned int bucket_size=1, split_rule Selected_split_rule=Split_rules::SLIDING_MIDPOINT, NT aspect_ratio=NT(3), bool use_extended_nodes=true) { the_bucket_size = bucket_size; the_selected_split_rule = Selected_split_rule; the_aspect_ratio = aspect_ratio; use_extended_nodes_option = use_extended_nodes; } NT aspect_ratio() const {return the_aspect_ratio;} split_rule selected_split_rule() const {return the_selected_split_rule;} unsigned int bucket_size() const {return the_bucket_size;} bool use_extended_nodes() const {return use_extended_nodes_option;} // split c0 in c0 and c1 Separator* split(Point_container& c0, Point_container& c1) { Separator* sep; switch (the_selected_split_rule) { case Split_rules::SLIDING_MIDPOINT: {Sliding_midpoint M; sep=M.rule(c0); c0.split_container(c1,sep,true);} break; case Split_rules::SLIDING_FAIR: {Sliding_fair M; sep=M.rule(c0,aspect_ratio()); c0.split_container(c1,sep,true);} break; case Split_rules::FAIR: {Fair M; sep=M.rule(c0,aspect_ratio()); c0.split_container(c1,sep);} break; case Split_rules::MEDIAN_OF_MAX_SPREAD: {Median_of_max_spread M; sep=M.rule(c0); c0.split_container(c1,sep);} break; case Split_rules::MEDIAN_OF_RECTANGLE: {Median_of_rectangle M; sep=M.rule(c0); c0.split_container(c1,sep);} break; case Split_rules::MIDPOINT_OF_MAX_SPREAD: {Midpoint_of_max_spread M; sep=M.rule(c0); c0.split_container(c1,sep);} break; case Split_rules::MIDPOINT_OF_RECTANGLE: {Midpoint_of_rectangle M; sep=M.rule(c0); c0.split_container(c1,sep);} break; default: std::cerr << "Split rule corrupted\n"; } return sep; } }; } // namespace CGAL #endif // KD_TREE_TRAITS_POINT_H