cgv
Loading...
Searching...
No Matches
cgv::media::axis_aligned_box< T, N > Class Template Reference

An axis aligned box, defined by to points: min and max. More...

#include <axis_aligned_box.h>

Public Types

typedef cgv::math::fvec< T, N > fpnt_type
 internally fixed sized points and vectors are used
 
typedef cgv::math::fvec< T, N > fvec_type
 
typedef cgv::math::vec< T > pnt_type
 the interface allows also to work with variable sized points
 
typedef cgv::math::vec< T > vec_type
 

Public Member Functions

 axis_aligned_box ()
 standard constructor does not initialize
 
template<typename S >
 axis_aligned_box (const axis_aligned_box< S, N > &B)
 type conversion copy constructor
 
 axis_aligned_box (const fpnt_type &_minp, const fpnt_type &_maxp)
 construct from min point and max point
 
 axis_aligned_box (const pnt_type &_minp, const pnt_type &_maxp)
 construct from min point and max point
 
void invalidate ()
 set to invalid min and max points
 
const fpnt_typeget_min_pnt () const
 return a const reference to corner 0
 
const fpnt_typeget_max_pnt () const
 return a const reference to corner 7
 
fpnt_typeref_min_pnt ()
 return a reference to corner 0
 
fpnt_typeref_max_pnt ()
 return a reference to corner 7
 
fpnt_type get_corner (int i) const
 return the i-th corner where the lower N bits of i are used to select between min (bit = 0) and max (bit = 1) coordinate
 
fvec_type get_alpha (const fvec_type &p) const
 return a vector containing linear interpolation parameter values in the different dimensions
 
fvec_type get_extent () const
 return a vector with the extents in the different dimensions
 
fpnt_type get_center () const
 return the center of the box
 
bool is_valid () const
 check if aab is valid
 
bool inside (const fpnt_type &p) const
 check whether a point is inside the aabb
 
void add_point (const fpnt_type &p)
 extent box to include given point
 
void add_point (const pnt_type &p)
 extent box to include given point
 
void add_axis_aligned_box (const axis_aligned_box< T, N > &aab)
 extent box to include given axis alinged box
 
axis_aligned_box< T, N > intersect (const axis_aligned_box< T, N > &aab)
 returns intersection of this aab with the provided aab
 
void scale (const T &f)
 scale the complete box with respect to the world coordinate origin
 
void translate (const fpnt_type &v)
 translate box by vector
 
unsigned get_max_extent_coord_index () const
 return the index of the coordinte with maximum extend
 

Protected Attributes

fpnt_type minp
 
fpnt_type maxp
 

Detailed Description

template<typename T, cgv::type::uint32_type N>
class cgv::media::axis_aligned_box< T, N >

An axis aligned box, defined by to points: min and max.

Definition at line 14 of file axis_aligned_box.h.

Member Typedef Documentation

◆ fpnt_type

template<typename T , cgv::type::uint32_type N>
typedef cgv::math::fvec<T,N> cgv::media::axis_aligned_box< T, N >::fpnt_type

internally fixed sized points and vectors are used

Definition at line 18 of file axis_aligned_box.h.

◆ fvec_type

template<typename T , cgv::type::uint32_type N>
typedef cgv::math::fvec<T,N> cgv::media::axis_aligned_box< T, N >::fvec_type

Definition at line 19 of file axis_aligned_box.h.

◆ pnt_type

template<typename T , cgv::type::uint32_type N>
typedef cgv::math::vec<T> cgv::media::axis_aligned_box< T, N >::pnt_type

the interface allows also to work with variable sized points

Definition at line 21 of file axis_aligned_box.h.

◆ vec_type

template<typename T , cgv::type::uint32_type N>
typedef cgv::math::vec<T> cgv::media::axis_aligned_box< T, N >::vec_type

Definition at line 22 of file axis_aligned_box.h.

Constructor & Destructor Documentation

◆ axis_aligned_box() [1/4]

template<typename T , cgv::type::uint32_type N>
cgv::media::axis_aligned_box< T, N >::axis_aligned_box ( )
inline

standard constructor does not initialize

Definition at line 28 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::invalidate().

◆ axis_aligned_box() [2/4]

template<typename T , cgv::type::uint32_type N>
template<typename S >
cgv::media::axis_aligned_box< T, N >::axis_aligned_box ( const axis_aligned_box< S, N > &  B)
inline

type conversion copy constructor

Definition at line 31 of file axis_aligned_box.h.

◆ axis_aligned_box() [3/4]

template<typename T , cgv::type::uint32_type N>
cgv::media::axis_aligned_box< T, N >::axis_aligned_box ( const fpnt_type _minp,
const fpnt_type _maxp 
)
inline

construct from min point and max point

Definition at line 35 of file axis_aligned_box.h.

◆ axis_aligned_box() [4/4]

template<typename T , cgv::type::uint32_type N>
cgv::media::axis_aligned_box< T, N >::axis_aligned_box ( const pnt_type _minp,
const pnt_type _maxp 
)
inline

construct from min point and max point

Definition at line 37 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::invalidate(), and cgv::math::vec< T >::size().

Member Function Documentation

◆ add_axis_aligned_box()

template<typename T , cgv::type::uint32_type N>
void cgv::media::axis_aligned_box< T, N >::add_axis_aligned_box ( const axis_aligned_box< T, N > &  aab)
inline

extent box to include given axis alinged box

Definition at line 118 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::add_point(), and cgv::media::axis_aligned_box< T, N >::is_valid().

◆ add_point() [1/2]

◆ add_point() [2/2]

template<typename T , cgv::type::uint32_type N>
void cgv::media::axis_aligned_box< T, N >::add_point ( const pnt_type p)
inline

extent box to include given point

Definition at line 105 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::is_valid(), and cgv::math::vec< T >::size().

◆ get_alpha()

template<typename T , cgv::type::uint32_type N>
fvec_type cgv::media::axis_aligned_box< T, N >::get_alpha ( const fvec_type p) const
inline

return a vector containing linear interpolation parameter values in the different dimensions

Definition at line 78 of file axis_aligned_box.h.

◆ get_center()

template<typename T , cgv::type::uint32_type N>
fpnt_type cgv::media::axis_aligned_box< T, N >::get_center ( ) const
inline

◆ get_corner()

template<typename T , cgv::type::uint32_type N>
fpnt_type cgv::media::axis_aligned_box< T, N >::get_corner ( int  i) const
inline

return the i-th corner where the lower N bits of i are used to select between min (bit = 0) and max (bit = 1) coordinate

Definition at line 68 of file axis_aligned_box.h.

Referenced by cgv::render::clipped_view::compute_clipping_planes(), cgv::render::gl::gl_implicit_surface_drawable_base::draw(), cgv::render::gl::gl_implicit_surface_drawable_base::finish_frame(), and cgv::plot::plot_base::get_corner().

◆ get_extent()

◆ get_max_extent_coord_index()

template<typename T , cgv::type::uint32_type N>
unsigned cgv::media::axis_aligned_box< T, N >::get_max_extent_coord_index ( ) const
inline

return the index of the coordinte with maximum extend

Definition at line 156 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::get_extent().

Referenced by cgv::render::gl::mesh_drawable::center_view().

◆ get_max_pnt()

◆ get_min_pnt()

◆ inside()

template<typename T , cgv::type::uint32_type N>
bool cgv::media::axis_aligned_box< T, N >::inside ( const fpnt_type p) const
inline

check whether a point is inside the aabb

Definition at line 86 of file axis_aligned_box.h.

◆ intersect()

template<typename T , cgv::type::uint32_type N>
axis_aligned_box< T, N > cgv::media::axis_aligned_box< T, N >::intersect ( const axis_aligned_box< T, N > &  aab)
inline

returns intersection of this aab with the provided aab

Definition at line 125 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::is_valid().

◆ invalidate()

◆ is_valid()

◆ ref_max_pnt()

template<typename T , cgv::type::uint32_type N>
fpnt_type & cgv::media::axis_aligned_box< T, N >::ref_max_pnt ( )
inline

return a reference to corner 7

Definition at line 66 of file axis_aligned_box.h.

Referenced by cgv::render::performance_monitor::performance_monitor(), and cgv::media::axis_aligned_box< T, N >::translate().

◆ ref_min_pnt()

template<typename T , cgv::type::uint32_type N>
fpnt_type & cgv::media::axis_aligned_box< T, N >::ref_min_pnt ( )
inline

◆ scale()

template<typename T , cgv::type::uint32_type N>
void cgv::media::axis_aligned_box< T, N >::scale ( const T &  f)
inline

scale the complete box with respect to the world coordinate origin

Definition at line 138 of file axis_aligned_box.h.

References cgv::media::axis_aligned_box< T, N >::is_valid().

◆ translate()

Member Data Documentation

◆ maxp

template<typename T , cgv::type::uint32_type N>
fpnt_type cgv::media::axis_aligned_box< T, N >::maxp
protected

Definition at line 25 of file axis_aligned_box.h.

◆ minp

template<typename T , cgv::type::uint32_type N>
fpnt_type cgv::media::axis_aligned_box< T, N >::minp
protected

Definition at line 24 of file axis_aligned_box.h.


The documentation for this class was generated from the following file: