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 > &other)
 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_type & get_min_pnt () const
 return a const reference to corner 0
const fpnt_type & get_max_pnt () const
 return a const reference to corner 7
fpnt_type & ref_min_pnt ()
 return a reference to corner 0
fpnt_type & ref_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.

Referenced by cgv::media::axis_aligned_box< T, 2 >::add_point(), and cgv::media::axis_aligned_box< T, 2 >::intersect().

◆ 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 > & other)
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 33 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 35 of file axis_aligned_box.h.

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 114 of file axis_aligned_box.h.

Referenced by cgv::data::bvh::build().

◆ add_point() [1/2]

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

◆ 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 101 of file axis_aligned_box.h.

◆ 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 74 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

return the center of the box

Definition at line 78 of file axis_aligned_box.h.

Referenced by cgv::render::volume_renderer::draw().

◆ 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 64 of file axis_aligned_box.h.

◆ 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 152 of file axis_aligned_box.h.

◆ 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 82 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 121 of file axis_aligned_box.h.

◆ 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 62 of file axis_aligned_box.h.

Referenced by cgv::media::axis_aligned_box< T, 2 >::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

return a reference to corner 0

Definition at line 60 of file axis_aligned_box.h.

Referenced by vr_test::init_frame(), and cgv::media::axis_aligned_box< T, 2 >::translate().

◆ 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 134 of file axis_aligned_box.h.

◆ translate()

template<typename T, cgv::type::uint32_type N>
void cgv::media::axis_aligned_box< T, N >::translate ( const fpnt_type & v)
inline

translate box by vector

Definition at line 144 of file axis_aligned_box.h.

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: