MeshLib C++ Docs
Loading...
Searching...
No Matches
MRVoxelsVolume.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRVoxelsFwd.h"
4#include "MRFloatGrid.h"
5
6#include "MRMesh/MRVector3.h"
7#include "MRMesh/MRBox.h"
9#include "MRMesh/MRExpected.h"
10#include "MRMesh/MRVector.h"
11#include "MRMesh/MRBitSet.h"
12
13#include <limits>
14
15namespace MR
16{
19
20
21template <typename T>
23
24template <typename T>
25struct VoxelTraits<Vector<T, VoxelId>>
26{
27 using ValueType = T;
28};
29
30template <>
31struct VoxelTraits<VoxelBitSet>
32{
33 using ValueType = bool;
34};
35
36template <typename T>
37struct VoxelTraits<VoxelValueGetter<T>>
38{
39 using ValueType = T;
40};
41
42template <>
44{
45 using ValueType = float;
46};
47
49template <typename T>
51{
53
55 Vector3i dims;
56 Vector3f voxelSize{ 1.f, 1.f, 1.f };
57
58 [[nodiscard]] size_t heapBytes() const { return MR::heapBytes( data ); }
59};
60
63template <typename T>
64struct VoxelsVolumeMinMax : VoxelsVolume<T>, MinMax<typename VoxelsVolume<T>::ValueType>
65{
66 using typename VoxelsVolume<T>::ValueType;
67 using VoxelsVolume<T>::data;
68 using VoxelsVolume<T>::dims;
71};
72
73
75MRVOXELS_API Expected<SimpleVolumeMinMax> functionVolumeToSimpleVolume( const FunctionVolume& volume, const ProgressCallback& callback = {} );
76
77}
wrapper class that helps mrbind to avoid excess MRVDBFloatGrid.h includes
Definition MRFloatGrid.h:21
std::vector<T>-like container that requires specific indexing type,
Definition MRVector.h:23
size_t heapBytes(const BitSet &bs)
returns the amount of memory given BitSet occupies on heap
Definition MRBitSet.h:313
float ValueType
Definition MRVoxelsVolume.h:45
Vector3f voxelSize
Definition MRVoxelsVolume.h:56
bool ValueType
Definition MRVoxelsVolume.h:33
T ValueType
Definition MRVoxelsVolume.h:39
MRVOXELS_API Expected< SimpleVolumeMinMax > functionVolumeToSimpleVolume(const FunctionVolume &volume, const ProgressCallback &callback={})
converts function volume into simple volume
size_t heapBytes() const
Definition MRVoxelsVolume.h:58
tl::expected< T, E > Expected
Definition MRExpected.h:31
T data
Definition MRVoxelsVolume.h:54
T ValueType
Definition MRVoxelsVolume.h:27
MRMESH_API double volume(const MeshTopology &topology, const VertCoords &points, const FaceBitSet *region=nullptr)
Vector3i dims
Definition MRVoxelsVolume.h:55
typename VoxelTraits< T >::ValueType ValueType
Definition MRVoxelsVolume.h:52
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRVoxelsVolume.h:22
Definition MRVoxelsVolume.h:65
represents a box in 3D space subdivided on voxels stored in T
Definition MRVoxelsVolume.h:51