MeshLib
 
Loading...
Searching...
No Matches
MRVoxelsVolume.h
Go to the documentation of this file.
1#pragma once
2#include "MRVector3.h"
3#include "MRHeapBytes.h"
4#include "MRExpected.h"
5#include <limits>
6#include <vector>
7
8namespace MR
9{
10
11template <typename T>
13
14template <typename T>
15struct VoxelTraits<std::vector<T>>
16{
17 using ValueType = T;
18};
19
20template <typename T>
21struct VoxelTraits<VoxelValueGetter<T>>
22{
23 using ValueType = T;
24};
25
26#ifndef MRMESH_NO_OPENVDB
27template <>
29{
30 using ValueType = float;
31};
32#endif
33
35template <typename T>
37{
39
42 Vector3f voxelSize{ 1.f, 1.f, 1.f };
43
44 [[nodiscard]] size_t heapBytes() const { return MR::heapBytes( data ); }
45};
46
49template <typename T>
51{
52 using typename VoxelsVolume<T>::ValueType;
53 using VoxelsVolume<T>::data;
54 using VoxelsVolume<T>::dims;
57
58 ValueType min = std::numeric_limits<ValueType>::max();
59 ValueType max = std::numeric_limits<ValueType>::lowest();
60};
61
62
64MRMESH_API Expected<SimpleVolume> functionVolumeToSimpleVolume( const FunctionVolume& volume, const ProgressCallback& callback = {} );
65
66} //namespace MR
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
represents a 3-dimentional float-typed vector
Definition MRDotNet/MRVector3.h:8
std::function< bool(float)> ProgressCallback
Definition MRMesh/MRMeshFwd.h:589
MRMESH_API size_t heapBytes(const FloatGrid &grid)
returns the amount of heap memory occupied by grid
Definition MRCameraOrientationPlugin.h:7
MRMESH_API Expected< SimpleVolume > functionVolumeToSimpleVolume(const FunctionVolume &volume, const ProgressCallback &callback={})
converts function volume into simple volume
std::shared_ptr< OpenVdbFloatGrid > FloatGrid
Definition MRMesh/MRMeshFwd.h:537
tl::expected< T, E > Expected
Definition MRExpected.h:49
float ValueType
Definition MRVoxelsVolume.h:30
T ValueType
Definition MRVoxelsVolume.h:23
Definition MRVoxelsVolume.h:12
Definition MRVoxelsVolume.h:51
ValueType max
Definition MRVoxelsVolume.h:59
ValueType min
Definition MRVoxelsVolume.h:58
represents a box in 3D space subdivided on voxels stored in T
Definition MRVoxelsVolume.h:37
Vector3f voxelSize
Definition MRVoxelsVolume.h:42
size_t heapBytes() const
Definition MRVoxelsVolume.h:44
T data
Definition MRVoxelsVolume.h:40
Vector3i dims
Definition MRVoxelsVolume.h:41
typename VoxelTraits< T >::ValueType ValueType
Definition MRVoxelsVolume.h:38