Go to the documentation of this file.00001 #ifndef OPENTISSUE_CORE_CONTAINERS_GRID_UTIL_GRID_VOXEL_PLANE_CLIP_H
00002 #define OPENTISSUE_CORE_CONTAINERS_GRID_UTIL_GRID_VOXEL_PLANE_CLIP_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 namespace OpenTissue
00013 {
00014 namespace grid
00015 {
00023 template < typename grid_type, typename plane_type >
00024 inline void voxel_plane_clip(
00025 grid_type const& voxels
00026 , plane_type const& plane
00027 , grid_type & below
00028 , grid_type & above
00029 )
00030 {
00031 typedef typename grid_type::value_type value_type;
00032 typedef typename grid_type::const_index_iterator const_index_iterator;
00033
00034 const_index_iterator voxel;
00035 for ( voxel=voxels.begin(); voxel!=voxels.end(); ++voxel )
00036 {
00037 if ( plane.signed_distance( voxel.get_coord() ) >= 0 )
00038 {
00039 above( voxel.get_index() ) = voxels( voxel.get_index() );
00040 below( voxel.get_index() ) = value_type(0);
00041 }
00042 else
00043 {
00044 below( voxel.get_index() ) = voxels( voxel.get_index() );
00045 above( voxel.get_index() ) = value_type(0);
00046 }
00047 }
00048 }
00049
00050 }
00051 }
00052
00053
00054 #endif