Blender V4.5
blender::Bounds< T > Struct Template Reference

#include <BLI_bounds_types.hh>

Public Member Functions

 Bounds ()=default
 Bounds (const T &value)
 Bounds (const T &min, const T &max)
bool is_empty () const
T center () const
T size () const
void translate (const T &offset)
void scale_from_center (const T &scale)
void resize (const T &new_size)
void recenter (const T &new_center)
template<typename PaddingT>
void pad (const PaddingT &padding)

Public Attributes

T min
T max

Detailed Description

template<typename T>
struct blender::Bounds< T >

Definition at line 13 of file BLI_bounds_types.hh.

Constructor & Destructor Documentation

◆ Bounds() [1/3]

template<typename T>
blender::Bounds< T >::Bounds ( )
default

◆ Bounds() [2/3]

template<typename T>
blender::Bounds< T >::Bounds ( const T & value)
inline

Definition at line 17 of file BLI_bounds_types.hh.

References max, min, and T.

◆ Bounds() [3/3]

template<typename T>
blender::Bounds< T >::Bounds ( const T & min,
const T & max )
inline

Definition at line 18 of file BLI_bounds_types.hh.

References max, min, and T.

Member Function Documentation

◆ center()

template<typename T>
T blender::Bounds< T >::center ( ) const
inline

Return the center (i.e. the midpoint) of the bounds. This matches the behavior of #BLI_rctf_cent/#BLI_rcti_cent.

Definition at line 254 of file BLI_bounds.hh.

References max, blender::math::midpoint(), min, and T.

Referenced by blender::ed::greasepencil::fit_strokes_to_view(), blender::draw::overlay::Bounds::object_sync(), recenter(), resize(), scale_from_center(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().

◆ is_empty()

template<typename T>
bool blender::Bounds< T >::is_empty ( ) const
inline

Returns true when the size of the bounds is zero (or negative). This matches the behavior of BLI_rcti_is_empty/BLI_rctf_is_empty.

Definition at line 244 of file BLI_bounds.hh.

References blender::detail::any_less_or_equal_than(), max, and min.

Referenced by blender::ed::sculpt_paint::grease_pencil_erase_box_exec(), blender::tests::TEST(), and blender::tests::TEST().

◆ pad()

template<typename T>
template<typename PaddingT>
void blender::Bounds< T >::pad ( const PaddingT & padding)
inline

Adds some padding to the bounds. This matches the behavior of BLI_rcti_pad/BLI_rctf_pad.

Definition at line 292 of file BLI_bounds.hh.

References max, min, and padding().

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

◆ recenter()

template<typename T>
void blender::Bounds< T >::recenter ( const T & new_center)
inline

Translate the bounds such that their center is #new_center. This matches the behavior of BLI_rctf_recenter/BLI_rcti_recenter.

Definition at line 284 of file BLI_bounds.hh.

References center(), T, and translate().

Referenced by blender::tests::TEST().

◆ resize()

template<typename T>
void blender::Bounds< T >::resize ( const T & new_size)
inline

Resize the bounds in-place to ensure their size is #new_size. The center of the bounds doesn't change. This matches the behavior of BLI_rctf_resize/BLI_rcti_resize.

Definition at line 278 of file BLI_bounds.hh.

References center(), max, min, and T.

Referenced by blender::tests::TEST().

◆ scale_from_center()

template<typename T>
void blender::Bounds< T >::scale_from_center ( const T & scale)
inline

Scale the bounds from the center. This matches the behavior of BLI_rctf_scale/BLI_rcti_scale.

Definition at line 270 of file BLI_bounds.hh.

References center(), max, min, size(), and T.

Referenced by blender::tests::TEST().

◆ size()

template<typename T>
T blender::Bounds< T >::size ( ) const
inline

Return the size of the bounds. E.g. for a Bounds<float3> this would return the dimensions of bounding box as a float3. This matches the behavior of #BLI_rctf_size/#BLI_rcti_size.

Definition at line 259 of file BLI_bounds.hh.

References blender::math::abs(), max, min, and T.

Referenced by blender::ed::greasepencil::fit_strokes_to_view(), blender::eevee::Camera::sync(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().

◆ translate()

template<typename T>
void blender::Bounds< T >::translate ( const T & offset)
inline

Translate the bounds by #offset. This matches the behavior of BLI_rctf_translate/BLI_rcti_translate.

Definition at line 264 of file BLI_bounds.hh.

References max, min, and T.

Referenced by recenter(), and blender::tests::TEST().

Member Data Documentation

◆ max

◆ min


The documentation for this struct was generated from the following files: