1 #ifndef SPARSE_VOLUME_GRID_H 2 #define SPARSE_VOLUME_GRID_H 4 #include "GridSubdivision.h" 5 #include "MultiVolumeGrid.h" 6 #include <KrisLibrary/meshing/TriMesh.h> 33 inline bool IsEmpty()
const {
return hash.buckets.empty(); }
35 int AddChannel(
const std::string& name);
36 int GetChannel(
const std::string& name)
const;
37 size_t GetNumChannels()
const {
return channelNames.size(); }
38 inline void SetBlockSize(
int m,
int n,
int p) { SetBlockSize(
IntTriple(m,n,p)); }
40 inline IntTriple GetBlockSize()
const {
return blockSize; }
41 void SetBlockRes(
const Vector3& blockRes);
42 inline void SetBlockRes(Real blockRes) { SetBlockRes(
Vector3(blockRes)); }
44 inline void SetDefaultValue(Real _defaultValue) { defaultValue.set(_defaultValue); }
45 inline void SetDefaultValue(
const Vector& _defaultValue) { defaultValue = _defaultValue; }
50 void GetCell(
int i,
int j,
int k,
AABB3D& cell)
const;
51 void GetCellCenter(
int i,
int j,
int k,
Vector3& center)
const;
52 inline Vector3 GetCellSize()
const {
return cellRes; }
53 void GetIndex(
const Vector3& pt,
int& i,
int& j,
int& k)
const;
56 inline void GetCell(
const IntTriple& index,
AABB3D& cell)
const { GetCell(index.a,index.b,index.c,cell); }
57 inline void GetCenter(
const IntTriple& index,
Vector3& center)
const { GetCellCenter(index.a,index.b,index.c,center); }
58 inline void GetIndex(
const Vector3& pt,
IntTriple& index)
const { GetIndex(pt,index.a,index.b,index.c); }
60 void SetValue(
int i,
int j,
int k,Real value,
int channel=0);
62 void SetValue(
const Vector3& pt,Real value,
int channel=0);
64 void SetValue(
int i,
int j,
int k,
const Vector& values);
68 Real GetValue(
int i,
int j,
int k,
int channel=0)
const;
70 Real GetValue(
const Vector3& pt,
int channel=0)
const;
72 void GetValue(
int i,
int j,
int k,
Vector& values)
const;
76 void GetBlock(
int i,
int j,
int k,
IntTriple& blockIndex)
const;
88 bool MakeBlock(
const IntTriple& blockIndex);
90 bool EraseBlock(
const IntTriple& blockIndex);
94 void SubdivideBlock(
const IntTriple& block);
111 Real TrilinearInterpolate(
const Vector3& pt,
int channel=0)
const;
112 void TrilinearInterpolate(
const Vector3& pt,
Vector& values)
const;
114 Real Average(
const AABB3D& range,
int channel=0)
const;
118 void Gradient(
const Vector3& pt,
Vector3& grad,
int channel=0)
const;
124 void Add(Real val,
int channel=0);
125 void Multiply(Real val,
int channel=0);
126 void Max(Real val,
int channel=0);
127 void Min(Real val,
int channel=0);
135 std::vector<std::string> channelNames;
A lightweight integer 3-tuple class.
Definition: IntTriple.h:9
A grid containing objects (referenced by void pointers)
Definition: GridSubdivision.h:32
A 3D vector class.
Definition: math3d/primitives.h:136
A 3D array over a sparse, axis aligned 3D volume. Has a similar interface as VolumeGrid, but uses a hash grid data structure to achieve better performance in large grids with infinite domain.
Definition: SparseVolumeGrid.h:20
A 3D axis-aligned bounding box.
Definition: AABB3D.h:13
Contains all the definitions in the Math3D package.
Definition: AnyGeometry.h:13
Definition: SparseVolumeGrid.h:23
A basic triangle mesh.
Definition: TriMesh.h:41
A 3D array over an axis-aligned 3D volume, containing one or more channels.
Definition: MultiVolumeGrid.h:20
Contains all definitions in the Geometry package.
Definition: AnyGeometry.cpp:26