Blender V5.3
blender::bounds Namespace Reference

Namespaces

namespace  detail

Functions

template<typename T>
Bounds< T > merge (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 > > min_max (const VArray< T > &varray)
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< T > max (const VArray< T > &values)
template<typename T>
std::array< VecBase< T, 3 >, 8 > corners (const Bounds< VecBase< T, 3 > > &bounds)
template<typename T>
std::array< VecBase< T, 2 >, 4 > corners (const Bounds< VecBase< T, 2 > > &bounds)
template<typename T, int D>
Bounds< VecBase< T, 3 > > transform_bounds (const MatBase< T, D, D > &matrix, const Bounds< VecBase< T, 3 > > &bounds)
template<typename T, int D>
Bounds< VecBase< T, 2 > > transform_bounds (const MatBase< T, D, D > &matrix, const Bounds< VecBase< T, 2 > > &bounds)

Function Documentation

◆ corners() [1/2]

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

Return the four corners of a 2D bounding box.


Y
|
|
.-----X

 3----------2
 |          |
 |          |
 |          |
 |          |
 0----------1

Definition at line 343 of file BLI_bounds.hh.

References corners().

◆ corners() [2/2]

◆ intersect() [1/2]

◆ 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 256 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 49 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 33 of file BLI_bounds.hh.

References b, and merge().

◆ min_max() [1/4]

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

◆ min_max() [2/4]

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

◆ min_max() [3/4]

◆ min_max() [4/4]

◆ 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 189 of file BLI_bounds.hh.

References b, blender::BLI_assert(), blender::Default, blender::Span< T >::first(), blender::Span< T >::index_range(), blender::bke::subdiv::init(), blender::Span< T >::is_empty(), min_max_with_radii(), blender::threading::parallel_reduce(), PRF_scope_with_name, and blender::Span< T >::size().

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

◆ transform_bounds() [1/2]

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

Transform a 2D bounding box.

See the note on the 3D variant.

Definition at line 380 of file BLI_bounds.hh.

References corners(), blender::math::max(), blender::math::min(), Span< T >::Span(), transform_bounds(), and blender::math::transform_point().

◆ transform_bounds() [2/2]

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 364 of file BLI_bounds.hh.

References corners(), blender::math::max(), blender::math::min(), Span< T >::Span(), transform_bounds(), and blender::math::transform_point().

Referenced by blender::BKE_object_minmax_dupli(), blender::BKE_pchan_minmax(), blender::compositor::Domain::realize_transformation(), transform_bounds(), transform_bounds(), and blender::view3d_calc_minmax_selected().