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, typename AT::Bounding_box operator()(ConstPrimitiveIterator first,
ConstPrimitiveIterator beyond) const ConstPrimitiveIterator beyond) const
{ {
typename AT::Bounding_box bbox = m_traits.compute_bbox(*first,m_traits.bbm); return std::accumulate(first, beyond,
for(++first; first != beyond; ++first) typename AT::Bounding_box{} /* empty bbox */,
{ [this](const typename AT::Bounding_box& bbox, const Primitive& pr) {
bbox = bbox + m_traits.compute_bbox(*first,m_traits.bbm); return bbox + m_traits.compute_bbox(pr, m_traits.bbm);
} });
return bbox;
} }
}; };

View File

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