Blender V4.5
blender::bounds Namespace Reference

Functions

template<typename T>
Bounds< Tmerge (const Bounds< T > &a, const Bounds< T > &b)
template<typename T>
std::optional< Bounds< T > > merge (const std::optional< Bounds< T > > &a, const std::optional< Bounds< T > > &b)
template<typename T>
std::optional< Bounds< T > > merge (const std::optional< Bounds< T > > &a, const Bounds< T > &b)
template<typename T>
std::optional< Bounds< T > > min_max (const std::optional< Bounds< T > > &a, const T &b)
template<typename T>
std::optional< Bounds< T > > min_max (const Span< T > values)
template<typename T>
std::optional< Bounds< T > > min_max (const IndexMask &mask, const Span< T > values)
template<typename T, typename RadiusT>
std::optional< Bounds< T > > min_max_with_radii (const Span< T > values, const Span< RadiusT > radii)
template<typename T>
std::optional< Bounds< T > > intersect (const Bounds< T > &a, const Bounds< T > &b)
template<typename T>
std::optional< Bounds< T > > intersect (const std::optional< Bounds< T > > &a, const std::optional< Bounds< T > > &b)
template<typename T>
std::optional< Tmax (const VArray< T > &values)
template<typename T>
std::array< VecBase< T, 3 >, 8 > corners (const Bounds< VecBase< T, 3 > > &bounds)
template<typename T, int D>
Bounds< VecBase< T, 3 > > transform_bounds (const MatBase< T, D, D > &matrix, const Bounds< VecBase< T, 3 > > &bounds)

Function Documentation

◆ corners()

template<typename T>
std::array< VecBase< T, 3 >, 8 > blender::bounds::corners ( const Bounds< VecBase< T, 3 > > & bounds)
inline

Return the eight corners of a 3D bounding box.

Definition at line 191 of file BLI_bounds.hh.

References corners().

Referenced by corners(), and transform_bounds().

◆ intersect() [1/2]

template<typename T>
std::optional< Bounds< T > > blender::bounds::intersect ( const Bounds< T > & a,
const Bounds< T > & b )
inlinenodiscard

Returns a new bound that contains the intersection of the two given bound. Returns no box if there are no overlap.

Definition at line 144 of file BLI_bounds.hh.

References b, blender::Bounds< T >::max, blender::math::max(), blender::Bounds< T >::min, blender::math::min(), and result.

Referenced by blender::eevee::VolumeLayer::bounds_overlaps(), and blender::nodes::node_composite_crop_cc::CropOperation::compute_cropping_bounds().

◆ intersect() [2/2]

template<typename T>
std::optional< Bounds< T > > blender::bounds::intersect ( const std::optional< Bounds< T > > & a,
const std::optional< Bounds< T > > & b )
inlinenodiscard

Definition at line 153 of file BLI_bounds.hh.

References b, and intersect().

◆ max()

template<typename T>
std::optional< T > blender::bounds::max ( const VArray< T > & values)
inline

◆ merge() [1/3]

◆ merge() [2/3]

template<typename T>
std::optional< Bounds< T > > blender::bounds::merge ( const std::optional< Bounds< T > > & a,
const Bounds< T > & b )
inlinenodiscard

Definition at line 48 of file BLI_bounds.hh.

References b, and merge().

◆ merge() [3/3]

template<typename T>
std::optional< Bounds< T > > blender::bounds::merge ( const std::optional< Bounds< T > > & a,
const std::optional< Bounds< T > > & b )
inlinenodiscard

Definition at line 32 of file BLI_bounds.hh.

References b.

◆ min_max() [1/3]

template<typename T>
std::optional< Bounds< T > > blender::bounds::min_max ( const IndexMask & mask,
const Span< T > values )
inlinenodiscard

◆ min_max() [2/3]

template<typename T>
std::optional< Bounds< T > > blender::bounds::min_max ( const Span< T > values)
inlinenodiscard

Find the smallest and largest values element-wise in the span.

Definition at line 67 of file BLI_bounds.hh.

References blender::Span< T >::first(), blender::Span< T >::index_range(), init(), blender::Span< T >::is_empty(), blender::threading::parallel_reduce(), and result.

◆ min_max() [3/3]

◆ min_max_with_radii()

template<typename T, typename RadiusT>
std::optional< Bounds< T > > blender::bounds::min_max_with_radii ( const Span< T > values,
const Span< RadiusT > radii )
inlinenodiscard

Find the smallest and largest values element-wise in the span, adding the radius to each element first. The template type T is expected to have an addition operator implemented with RadiusT.

Definition at line 116 of file BLI_bounds.hh.

References BLI_assert, blender::Span< T >::first(), blender::Span< T >::index_range(), init(), blender::Span< T >::is_empty(), min_max_with_radii(), blender::threading::parallel_reduce(), result, and blender::Span< T >::size().

Referenced by blender::bke::CurvesGeometry::bounds_min_max(), min_max_with_radii(), and blender::tests::TEST().

◆ transform_bounds()

template<typename T, int D>
Bounds< VecBase< T, 3 > > blender::bounds::transform_bounds ( const MatBase< T, D, D > & matrix,
const Bounds< VecBase< T, 3 > > & bounds )
inline

Transform a 3D bounding box.

Note: this necessarily grows the bounding box, to ensure that the transformed bounding box fully contains the original. Therefore, calling this iteratively to transform from space A to space B, and then from space B to space C, etc., will also iteratively grow the bounding box on each call. Try to avoid doing that, and instead first compose the transform matrices and then use that to transform the bounding box.

Definition at line 216 of file BLI_bounds.hh.

References corners(), blender::math::max(), blender::math::min(), transform_bounds(), and blender::math::transform_point().

Referenced by transform_bounds(), and view3d_calc_minmax_selected().