#include <SparseField.h>
template<typename Data_T>
class LinearSparseFieldInterp< Data_T >
Definition at line 86 of file SparseField.h.
◆ value_type
template<typename Data_T >
◆ Ptr
template<typename Data_T >
◆ class_type
template<typename Data_T >
◆ base
template<typename Data_T >
Convenience typedef for referring to base class.
Definition at line 207 of file SparseField.h.
◆ staticClassName()
template<typename Data_T >
Definition at line 100 of file SparseField.h.
102 return "LinearSparseFieldInterp";
◆ staticClassType()
template<typename Data_T >
◆ sample()
template<typename Data_T >
Definition at line 112 of file SparseField.h.
117 FIELD3D_VEC3_T<double> p(vsP - FIELD3D_VEC3_T<double>(0.5));
120 V3i c1(static_cast<int>(
floor(p.x)),
121 static_cast<int>(
floor(p.y)),
122 static_cast<int>(
floor(p.z)));
126 FIELD3D_VEC3_T<double> f1(
static_cast<FIELD3D_VEC3_T<double>
>(c2) - p);
128 FIELD3D_VEC3_T<double> f2(
static_cast<FIELD3D_VEC3_T<double>
>(1.0) - f1);
141 int i = c1.x, j = c1.y, k = c1.z, vi, vj, vk, bi, bj, bk;
148 if (vi < blockSize - 1 && vj < blockSize - 1 && vk < blockSize - 1) {
151 const int blockId = field.
blockId(bi, bj, bk);
158 const Data_T *
const p = field.
blockData(bi, bj, bk);
159 const Data_T *
const c111 =
160 p + vi + vj * blockSize + vk * blockSize * blockSize;
161 const Data_T *
const c121 = c111 + blockSize * (c2.y - c1.y);
163 c112 = c111 + blockSize * blockSize * (c2.z - c1.z);
164 const Data_T *
const c122 = c112 + blockSize * (c2.y - c1.y);
165 int xInc = c2.x - c1.x;
166 Data_T value = static_cast<Data_T>
167 (f1.x * (f1.y * (f1.z * *c111 +
169 f2.y * (f1.z * *c121 +
171 f2.x * (f1.y * (f1.z * *(c111 + xInc) +
172 f2.z * *(c112 + xInc)) +
173 f2.y * (f1.z * *(c121 + xInc) +
174 f2.z * *(c122 + xInc))));
185 return static_cast<Data_T>
186 (f1.x * (f1.y * (f1.z * field.
fastValue(c1.x, c1.y, c1.z) +
187 f2.z * field.
fastValue(c1.x, c1.y, c2.z)) +
188 f2.y * (f1.z * field.
fastValue(c1.x, c2.y, c1.z) +
189 f2.z * field.
fastValue(c1.x, c2.y, c2.z))) +
190 f2.x * (f1.y * (f1.z * field.
fastValue(c2.x, c1.y, c1.z) +
191 f2.z * field.
fastValue(c2.x, c1.y, c2.z)) +
192 f2.y * (f1.z * field.
fastValue(c2.x, c2.y, c1.z) +
193 f2.z * field.
fastValue(c2.x, c2.y, c2.z))));
References SparseField< Data_T >::activateBlock(), SparseField< Data_T >::applyDataWindowOffset(), SparseField< Data_T >::blockData(), SparseField< Data_T >::blockId(), SparseField< Data_T >::blockIsAllocated(), SparseField< Data_T >::blockOrder(), FieldRes::dataWindow(), SparseField< Data_T >::decBlockRef(), SparseField< Data_T >::fastValue(), detail::floor(), SparseField< Data_T >::getBlockCoord(), SparseField< Data_T >::getBlockEmptyValue(), SparseField< Data_T >::getVoxelInBlock(), SparseField< Data_T >::incBlockRef(), SparseField< Data_T >::isDynamicLoad(), detail::max(), and detail::min().
◆ DEFINE_FIELD_RTTI_CONCRETE_CLASS
template<typename Data_T >
◆ ms_classType
template<typename Data_T >
The documentation for this class was generated from the following file:
const Box3i & dataWindow() const
Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field su...
const Data_T getBlockEmptyValue(int bi, int bj, int bk) const
Returns the constant value of an block, whether it's allocated already or not..
static TemplatedFieldType< LinearSparseFieldInterp< Data_T > > ms_classType
void getVoxelInBlock(int i, int j, int k, int &vi, int &vj, int &vk) const
Calculates the coordinates in a block for the given voxel index.
FIELD3D_VEC3_T< T > floor(const FIELD3D_VEC3_T< T > &v)
Floor function for Vec3.
T max(const T a, const T2 b)
Max operation on mixed types.
int blockId(int blockI, int blockJ, int blockK) const
Calculates the block number based on a block i,j,k index.
void activateBlock(const int blockId) const
Activates a given block.
void decBlockRef(const int blockId) const
Decrements the block ref count for the given block.
bool isDynamicLoad() const
Whether the field is dynamically loaded.
void getBlockCoord(int i, int j, int k, int &bi, int &bj, int &bk) const
Calculates the block coordinates that a given set of voxel coords are in.
void incBlockRef(const int blockId) const
Increments the block ref count for the given block.
Data_T * blockData(int bi, int bj, int bk) const
Returns a pointer to the data in a block, or null if the given block is unallocated.
Data_T fastValue(int i, int j, int k) const
Read access to voxel. Notice that this is non-virtual.
int blockOrder() const
Returns the block order.
void applyDataWindowOffset(int &i, int &j, int &k) const
Applies data window offset.
T min(const T a, const T2 b)
Min operation on mixed types.
bool blockIsAllocated(int bi, int bj, int bk) const
Checks if a block is allocated.