Skip to content

Commit c5ab9f9

Browse files
committed
Merge remote-tracking branch 'cgal/6.0.x-branch' into cgal/master
2 parents e04a859 + d5a2d33 commit c5ab9f9

File tree

9 files changed

+51
-20
lines changed

9 files changed

+51
-20
lines changed

Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ class Arr_conic_traits_2 {
127127
public:
128128
/*! constructs default.
129129
*/
130-
Arr_conic_traits_2() {}
130+
Arr_conic_traits_2()
131+
: m_rat_kernel(std::make_shared<Rat_kernel>()),
132+
m_alg_kernel(std::make_shared<Alg_kernel>()),
133+
m_nt_traits(std::make_shared<Nt_traits>())
134+
{}
131135

132136
/*! constructs from resources.
133137
*/

Lab/demo/Lab/Plugins/PCA/Basic_generator_plugin.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,17 @@ public :
142142
this, &Basic_generator_plugin::on_tab_changed);
143143
connect(dock_widget, &GeneratorWidget::visibilityChanged,
144144
this, &Basic_generator_plugin::on_tab_changed);
145+
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
146+
connect(dock_widget->prismCheckBox, &QCheckBox::checkStateChanged,
147+
this, &Basic_generator_plugin::on_tab_changed);
148+
connect(dock_widget->pyramidCheckBox, &QCheckBox::checkStateChanged,
149+
this, &Basic_generator_plugin::on_tab_changed);
150+
#else
145151
connect(dock_widget->prismCheckBox, &QCheckBox::stateChanged,
146152
this, &Basic_generator_plugin::on_tab_changed);
147153
connect(dock_widget->pyramidCheckBox, &QCheckBox::stateChanged,
148154
this, &Basic_generator_plugin::on_tab_changed);
155+
#endif
149156
}
150157

151158
bool applicable(QAction*) const

Polygon_mesh_processing/test/Polygon_mesh_processing/test_pmp_distance.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ struct Custom_traits_Hausdorff
2222
FT operator+(FT)const{return FT();}
2323
FT operator*(FT)const{return FT();}
2424
bool operator<=(FT)const{return false;}
25+
bool operator==(FT)const{return false;}
2526
bool operator>=(FT)const{return false;}
2627
bool operator!=(FT)const{return false;}
2728
bool operator<(FT)const{return false;}

Spatial_searching/doc/Spatial_searching/CGAL/Kd_tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ lot of cache misses, leading to non-optimal performance. This is the case
2020
for example when indices are stored inside the tree,
2121
or to a lesser extent when the points coordinates are stored
2222
in a dynamically allocated array (e.g., `Epick_d` with dynamic
23-
dimension) &mdash; we says "to a lesser extent" because the points
23+
dimension) &mdash; we say "to a lesser extent" because the points
2424
are re-created by the kd-tree in a cache-friendly order after its construction,
2525
so the coordinates are more likely to be stored in a near-optimal order on the
2626
heap. When `EnablePointsCache` is set to `Tag_true`, the points

Spatial_searching/doc/Spatial_searching/Spatial_searching.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ which is the case for point queries.
127127
The following two classes implement the standard
128128
search strategy for orthogonal distances like the weighted Minkowski
129129
distance. The second one is a specialization for incremental neighbor
130-
searching and distance browsing. Both require extendes nodes.
130+
searching and distance browsing. Both require extended nodes.
131131

132132
`Orthogonal_k_neighbor_search<Traits,
133133
OrthogonalDistance, Splitter, SpatialTree>`
@@ -175,9 +175,13 @@ because in general the query time will be less than using the default value.
175175
Instead of using the default splitting rule `Sliding_midpoint` described below,
176176
a user may, depending upon the data, select
177177
one from the following splitting rules,
178-
which determine how a separating hyperplane is computed. Every splitter has
178+
which determine how a separating hyperplane is computed. Some splitter have
179179
degenerated worst cases, which may lead to a linear tree and a stack overflow.
180180
Switching the splitting rule to one of a different kind will solve the problem.
181+
The `Median_of_rectangle` and `Median_of_max_spread` are robust sliders that will
182+
neither lead to a linear tree nor to a stack overflow. The `Median_of_rectangle`
183+
splitter will detect if the data in a node is degenerated and applies the
184+
`Median_of_max_spread` rule for that node to avoid a linear tree.
181185

182186
<DL>
183187

Spatial_searching/include/CGAL/Kd_tree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,15 @@ class Kd_tree {
196196
if (try_parallel_internal_node_creation (nh, c, c_low, tag))
197197
return;
198198

199-
if (c_low.size() > split.bucket_size())
199+
if (c_low.size() > split.bucket_size() && !CGAL::is_zero(c_low.max_tight_spread()))
200200
{
201201
nh->lower_ch = new_internal_node();
202202
create_internal_node (nh->lower_ch, c_low, tag);
203203
}
204204
else
205205
nh->lower_ch = create_leaf_node(c_low);
206206

207-
if (c.size() > split.bucket_size())
207+
if (c.size() > split.bucket_size() && !CGAL::is_zero(c.max_tight_spread()))
208208
{
209209
nh->upper_ch = new_internal_node();
210210
create_internal_node (nh->upper_ch, c, tag);
@@ -350,7 +350,7 @@ class Kd_tree {
350350

351351
Point_container c(dim_, data.begin(), data.end(),traits_);
352352
bbox = new Kd_tree_rectangle<FT,D>(c.bounding_box());
353-
if (c.size() <= split.bucket_size()){
353+
if (c.size() <= split.bucket_size() || CGAL::is_zero(c.max_tight_spread())){
354354
tree_root = create_leaf_node(c);
355355
}else {
356356
tree_root = new_internal_node();

Spatial_searching/include/CGAL/Kd_tree_rectangle.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,7 @@ namespace CGAL {
111111

112112
explicit
113113
Kd_tree_rectangle(const Kd_tree_rectangle& r)
114-
: max_span_coord_(r.max_span_coord_)
115-
{
116-
lower_ = r.lower_;
117-
upper_ = r.upper_;
118-
}
114+
: lower_(r.lower_), upper_(r.upper_), max_span_coord_(r.max_span_coord_) {}
119115

120116
template <class Construct_cartesian_const_iterator_d,class PointPointerIter>
121117
void update_from_point_pointers(PointPointerIter begin,
@@ -289,12 +285,6 @@ namespace CGAL {
289285
std::fill(coords_, coords_ + 2*dim, FT(0));
290286
}
291287

292-
Kd_tree_rectangle()
293-
: coords_(0), dim(0), max_span_coord_(-1)
294-
{
295-
}
296-
297-
298288
explicit
299289
Kd_tree_rectangle(const Kd_tree_rectangle& r)
300290
: coords_(new FT[2*r.dim]), dim(r.dim),

Spatial_searching/include/CGAL/Point_container.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,9 @@ class Point_container {
232232

233233
// building the container from a sequence of Point_d*
234234
Point_container(const int d, iterator begin, iterator end,const Traits& traits_) :
235-
traits(traits_),m_b(begin), m_e(end), bbox(d, begin, end,traits.construct_cartesian_const_iterator_d_object()), tbox(bbox)
235+
traits(traits_),m_b(begin), m_e(end), bbox(d, begin, end,traits.construct_cartesian_const_iterator_d_object()), tbox(d)
236236
{
237+
tbox = bbox;
237238
built_coord = max_span_coord();
238239
}
239240

@@ -419,7 +420,28 @@ class Point_container {
419420

420421
typename Traits::Cartesian_const_iterator_d mpit = construct_it((*(*mid)));
421422
FT val1 = *(mpit+split_coord);
423+
424+
// Avoid using the low coord value as it results in an empty split
425+
if (val1 == tbox.min_coord(split_coord)) {
426+
iterator it = std::min_element(mid, end(), [=](const Point_d* a, const Point_d* b) -> bool {
427+
FT a_c = *(construct_it(*a) + split_coord);
428+
FT b_c = *(construct_it(*b) + split_coord);
429+
430+
if (a_c == val1)
431+
return false;
432+
433+
if (b_c == val1)
434+
return true;
435+
436+
return a_c < b_c;
437+
});
438+
return *(construct_it(**it) + split_coord);
439+
}
440+
422441
mid++;
442+
if (mid == end())
443+
return val1;
444+
423445
mpit = construct_it((*(*mid)));
424446
FT val2 = *(mpit+split_coord);
425447
return (val1+val2)/FT(2);

Spatial_searching/include/CGAL/Splitters.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <CGAL/license/Spatial_searching.h>
2121

22+
#include <CGAL/number_utils.h>
2223
#include <CGAL/Point_container.h>
2324
#include <CGAL/Plane_separator.h>
2425

@@ -236,7 +237,9 @@ namespace CGAL {
236237
void
237238
operator() (Separator& sep, Container& c0, Container& c1) const
238239
{
239-
sep = Separator(c0.max_span_coord(),FT(0));
240+
if (!CGAL::is_zero(c0.tight_bounding_box().max_coord(c0.max_span_coord()) - c0.tight_bounding_box().min_coord(c0.max_span_coord())))
241+
sep = Separator(c0.max_span_coord(),FT(0));
242+
else sep = Separator(c0.max_tight_span_coord(), FT(0));
240243
sep.set_cutting_value(c0.median(sep.cutting_dimension()));
241244
c0.split(c1,sep,true);
242245
}

0 commit comments

Comments
 (0)