CGAL::bounding_box

Definition

The function bounding_box computes the axis-aligned bounding box of a set of 2D or 3D points. The bounding box is returned either as an iso rectangle in 2D or as an iso cuboid in 3D, the type being deduced automatically from the value type of the iterator range.

#include <CGAL/bounding_box.h>

There is a set of overloaded bounding_box functions for 2D and 3D points. The user can also optionally pass an explicit kernel, in case the default, based on Kernel_traits is not sufficient. The dimension is also deduced automatically.

template < typename InputIterator >
K::Iso_rectangle_2 bounding_box ( InputIterator first, InputIterator beyond)
computes the bounding box of a non-empty set of 2D points. K is Kernel_traits<std::iterator_traits<InputIterator>::value_type>::Kernel. The value type must be K::Point_2.
Precondition: first != beyond.

template < typename InputIterator, typename K >
K::Iso_rectangle_2 bounding_box ( InputIterator first, InputIterator beyond, K k)
computes the bounding box of a non-empty set of 2D points. The value type must be K::Point_2.
Precondition: first != beyond.

template < typename InputIterator >
K::Iso_cuboid_3 bounding_box ( InputIterator first, InputIterator beyond)
computes the bounding box of a non-empty set of 3D points. K is Kernel_traits<std::iterator_traits<InputIterator>::value_type>::Kernel. The value type must be K::Point_3.
Precondition: first != beyond.

template < typename InputIterator, typename K >
K::Iso_cuboid_3 bounding_box ( InputIterator first, InputIterator beyond, K k)
computes the bounding box of a non-empty set of 3D points. The value type must be K::Point_3.
Precondition: first != beyond.