13template <
typename Volume>
23 static constexpr bool cacheEffective =
true;
26 : accessor_( volume.data->getConstAccessor() )
27 , minCoord_(
fromVdb( volume.data->evalActiveVoxelBoundingBox().min() ) )
33 if ( !accessor_.probeValue(
toVdb( pos + minCoord_ ), res ) )
43 const Vector3i&
minCoord()
const {
return minCoord_; }
46 Vector3f
shift()
const {
return Vector3f( minCoord_ ); }
49 openvdb::FloatGrid::ConstAccessor accessor_;
55class VoxelsVolumeAccessor<VoxelsVolume<std::vector<T>>>
58 using VolumeType = VoxelsVolume<std::vector<T>>;
59 using ValueType =
typename VolumeType::ValueType;
60 static constexpr bool cacheEffective =
false;
62 explicit VoxelsVolumeAccessor(
const VolumeType& volume )
63 : data_( volume.data )
64 , indexer_( volume.dims )
67 ValueType
get(
const Vector3i& pos )
const
69 return data_[indexer_.toVoxelId( pos )];
72 ValueType
get(
const VoxelLocation & loc )
const
78 Vector3f shift()
const {
return Vector3f::diagonal( 0.5f ); }
81 const std::vector<T>& data_;
82 VolumeIndexer indexer_;
87class VoxelsVolumeAccessor<VoxelsVolumeMinMax<std::vector<T>>> :
public VoxelsVolumeAccessor<VoxelsVolume<std::vector<T>>>
89 using Base = VoxelsVolumeAccessor<VoxelsVolume<std::vector<T>>>;
91 using VolumeType = VoxelsVolumeMinMax<std::vector<T>>;
92 using ValueType =
typename VolumeType::ValueType;
93 using Base::cacheEffective;
104 static constexpr bool cacheEffective =
true;
107 : data_( volume.data )
121 Vector3f
shift()
const {
return Vector3f::diagonal( 0.5f ); }
124 const VoxelValueGetter<T>& data_;
ValueType get(const VoxelLocation &loc) const
Definition MRVoxelsVolumeAccess.h:38
const Vector3i & minCoord() const
Definition MRVoxelsVolumeAccess.h:43
VdbVolume VolumeType
Definition MRVoxelsVolumeAccess.h:21
Vector3f shift() const
this additional shift shall be added to integer voxel coordinates during transformation in 3D space
Definition MRVoxelsVolumeAccess.h:46
typename VolumeType::ValueType ValueType
Definition MRVoxelsVolumeAccess.h:22
ValueType get(const Vector3i &pos) const
Definition MRVoxelsVolumeAccess.h:30
VoxelsVolumeAccessor(const VolumeType &volume)
Definition MRVoxelsVolumeAccess.h:25
VoxelsVolumeAccessor(const VolumeType &volume)
Definition MRVoxelsVolumeAccess.h:106
ValueType get(const Vector3i &pos) const
Definition MRVoxelsVolumeAccess.h:110
ValueType get(const VoxelLocation &loc) const
Definition MRVoxelsVolumeAccess.h:115
Vector3f shift() const
this additional shift shall be added to integer voxel coordinates during transformation in 3D space
Definition MRVoxelsVolumeAccess.h:121
typename VolumeType::ValueType ValueType
Definition MRVoxelsVolumeAccess.h:103
helper class for generalized voxel volume data access
Definition MRVoxelsVolumeAccess.h:14
MR_BIND_IGNORE Vector3i fromVdb(const openvdb::Coord &v)
Definition MRVDBFloatGrid.h:37
MR_BIND_IGNORE openvdb::Coord toVdb(const Vector3i &v)
Definition MRVDBFloatGrid.h:42
constexpr const V & get(const Box< V > &box) noexcept
get<0> returns min, get<1> returns max
Definition MRMesh/MRBox.h:268
Vector3i pos
Definition MRVolumeIndexer.h:58
Definition MRCameraOrientationPlugin.h:8
constexpr float cQuietNan
Definition MRIsNaN.h:13
contains both linear Id and 3D coordinates of the same voxel
Definition MRVolumeIndexer.h:56
represents a box in 3D space subdivided on voxels stored in T
Definition MRVoxelsVolume.h:39
typename VoxelTraits< T >::ValueType ValueType
Definition MRVoxelsVolume.h:40