113 {
114
115
116
118
119
121 static_cast<int>(
floor(
p.y)),
122 static_cast<int>(
floor(
p.z)));
123
125
127
129
131
132
133 c1.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x,
c1.x));
134 c1.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y,
c1.y));
135 c1.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z,
c1.z));
136 c2.x = std::min(dataWindow.max.x, std::max(dataWindow.min.x,
c2.x));
137 c2.y = std::min(dataWindow.max.y, std::max(dataWindow.min.y,
c2.y));
138 c2.z = std::min(dataWindow.max.z, std::max(dataWindow.min.z,
c2.z));
139
140
146
147
148 if (
vi < blockSize - 1 &&
vj < blockSize - 1 &&
vk < blockSize - 1) {
150
153 if (isDynamicLoad) {
156 }
157
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);
162 const Data_T * const
164 const Data_T *
const c122 =
c112 + blockSize * (
c2.y -
c1.y);
166 Data_T value = static_cast<Data_T>
175
176 if (isDynamicLoad) {
178 }
179
180 return value;
181 } else {
183 }
184 } else {
185 return static_cast<Data_T>
194 }
195
196 }
const Box3i & dataWindow() const
Returns the data window. Any coordinate inside this window is safe to pass to value() in the Field su...
bool isDynamicLoad() const
Whether the field is dynamically loaded.
void applyDataWindowOffset(int &i, int &j, int &k) const
Applies data window offset.
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..
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.
bool blockIsAllocated(int bi, int bj, int bk) const
Checks if a block is allocated.
void decBlockRef(const int blockId) const
Decrements the block ref count for the given block.
Data_T fastValue(int i, int j, int k) const
Read access to voxel. Notice that this is non-virtual.
void activateBlock(const int blockId) const
Activates a given block.
int blockOrder() const
Returns the block order.
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.
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.
int blockId(int blockI, int blockJ, int blockK) const
Calculates the block number based on a block i,j,k index.
void incBlockRef(const int blockId) const
Increments the block ref count for the given block.
FIELD3D_VEC3_T< T > floor(const FIELD3D_VEC3_T< T > &v)
Floor function for Vec3.