1 #ifndef __cpInstances__BoundingBox__h__
2 #define __cpInstances__BoundingBox__h__
4 #include <cpInstances/cpPluginsDataObjects_Export.h>
6 #include <cpPlugins/BaseObjects/DataObject.h>
7 #include <vtkOutlineSource.h>
8 #include <vtkSmartPointer.h>
14 class cpPluginsDataObjects_EXPORT BoundingBox
15 : public cpPlugins::BaseObjects::DataObject
18 typedef BoundingBox Self;
19 typedef cpPlugins::BaseObjects::DataObject Superclass;
20 typedef itk::SmartPointer< Self > Pointer;
21 typedef itk::SmartPointer< const Self > ConstPointer;
25 itkTypeMacro( BoundingBox, DataObject );
26 cpPlugins_Id_Macro( BoundingBox, Object );
27 cpPlugins_Compatibility_Macro;
30 void SetDataObject( DataObject* o );
32 void Copy( Self* other );
33 void Blend( Self* other );
35 template< class _TPoint >
36 inline void SetMinimum( const _TPoint& p )
38 this->_SetPoint( 0, p );
41 template< class _TPoint >
42 inline void SetMaximum( const _TPoint& p )
44 this->_SetPoint( 1, p );
47 template< class _TPoint >
48 inline _TPoint GetMinimum( ) const
50 return( this->_GetPoint< _TPoint >( 0 ) );
53 template< class _TPoint >
54 inline _TPoint GetMaximum( ) const
56 return( this->_GetPoint< _TPoint >( 1 ) );
61 virtual ~BoundingBox( );
65 template< class _TPoint >
66 inline void _SetPoint( unsigned int m, const _TPoint& p )
68 this->m_Points[ m ].clear( );
69 for( unsigned int d = 0; d < _TPoint::PointDimension; ++d )
70 this->m_Points[ m ].push_back( double( p[ d ] ) );
75 template< class _TPoint >
76 inline _TPoint _GetPoint( unsigned int m ) const
78 unsigned int dim = this->m_Points[ m ].size( );
80 ( _TPoint::PointDimension < dim )? _TPoint::PointDimension: dim;
83 for( unsigned int d = 0; d < dim; ++d )
84 p[ d ] = this->m_Points[ m ][ d ];
89 // Purposely not implemented
90 BoundingBox( const Self& );
91 Self& operator=( const Self& );
94 std::vector< double > m_Points[ 2 ];
95 vtkSmartPointer< vtkOutlineSource > m_Outline;
100 #endif // __cpInstances__BoundingBox__h__