fix 2D case

This commit is contained in:
Laurent Rineau 2025-05-20 17:29:36 +02:00
parent 73fd95ab6b
commit c419f74c23
2 changed files with 5 additions and 8 deletions

View File

@ -302,12 +302,11 @@ public:
typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond) const
{
typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm);
for(++first; first != beyond; ++first)
{
bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm);
}
return bbox;
return std::accumulate(first, beyond,
typename AT::Bounding_box{} /* empty bbox */,
[this](const typename AT::Bounding_box& bbox, const Primitive& pr) {
return bbox + m_traits.compute_bbox(pr, m_traits.bbm);
});
}
};

View File

@ -199,9 +199,7 @@ namespace CGAL {
}
/// returns the axis-aligned bounding box of the whole tree.
/// \pre `!empty()`
const Bounding_box bbox() const {
CGAL_precondition(!empty());
if(size() > 1)
return root_node()->bbox();
else