OpenVDB 13.0.0

Loading...
Searching...
No Matches
LeafNodeBool.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4#ifndef OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
5#define OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
6
7#include <openvdb/Types.h>
8#include <openvdb/io/Compression.h> // for io::readData(), etc.
9#include <openvdb/util/Assert.h>
10#include <openvdb/math/Math.h> // for math::isZero()
11#include <openvdb/util/NodeMasks.h>
12#include "LeafNode.h"
13#include "Iterator.h"
14#include <iostream>
15#include <sstream>
16#include <string>
17#include <type_traits>
18#include <vector>
19
20
21 namespace openvdb {
22 OPENVDB_USE_VERSION_NAMESPACE
23 namespace OPENVDB_VERSION_NAME {
24 namespace tree {
25
26/// @brief LeafNode specialization for values of type bool that stores both
27/// the active states and the values of (2^Log2Dim)^3 voxels as bit masks
28 template<Index Log2Dim>
29 class LeafNode<bool, Log2Dim>
30{
31 public:
32 using LeafNodeType = LeafNode<bool, Log2Dim>;
33 using BuildType = bool;
34 using ValueType = bool;
35 using Buffer = LeafBuffer<ValueType, Log2Dim>;
36 using NodeMaskType = util::NodeMask<Log2Dim>;
37 using Ptr = SharedPtr<LeafNodeType>;
38
39 // These static declarations must be on separate lines to avoid VC9 compiler errors.
40 static const Index LOG2DIM = Log2Dim; // needed by parent nodes
41 static const Index TOTAL = Log2Dim; // needed by parent nodes
42 static const Index DIM = 1 << TOTAL; // dimension along one coordinate direction
43 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
44 static const Index NUM_VOXELS = NUM_VALUES; // total number of voxels represented by this node
45 static const Index SIZE = NUM_VALUES;
46 static const Index LEVEL = 0; // level 0 = leaf
47
48 /// @brief ValueConverter<T>::Type is the type of a LeafNode having the same
49 /// dimensions as this node but a different value type, T.
50 template<typename ValueType>
51 struct ValueConverter { using Type = LeafNode<ValueType, Log2Dim>; };
52
53 /// @brief SameConfiguration<OtherNodeType>::value is @c true if and only if
54 /// OtherNodeType is the type of a LeafNode with the same dimensions as this node.
55 template<typename OtherNodeType>
56 struct SameConfiguration {
57 static const bool value = SameLeafConfig<LOG2DIM, OtherNodeType>::value;
58 };
59
60
61 /// Default constructor
62 LeafNode();
63
64 /// Constructor
65 /// @param xyz the coordinates of a voxel that lies within the node
66 /// @param value the initial value for all of this node's voxels
67 /// @param active the active state to which to initialize all voxels
68 explicit LeafNode(const Coord& xyz, bool value = false, bool active = false);
69
70 /// "Partial creation" constructor used during file input
71 LeafNode(PartialCreate, const Coord& xyz, bool value = false, bool active = false);
72
73 /// Deep copy constructor
74 LeafNode(const LeafNode&);
75
76 /// Deep assignment operator
77 LeafNode& operator=(const LeafNode&) = default;
78
79 /// Value conversion copy constructor
80 template<typename OtherValueType>
81 explicit LeafNode(const LeafNode<OtherValueType, Log2Dim>& other);
82
83 /// @brief Construct a LeafNodeBool with its individual components
84 /// @param xyz Leaf origin
85 /// @param mask The ValueMask to copy
86 /// @param buff The LeafBuffer to copy (also constructable from a ValueMask)
87 /// @param trans Transient data (ignored until ABI 9)
88 LeafNode(const Coord& xyz,
89 const NodeMaskType& mask,
90 const Buffer& buff,
91 const Index32 trans = 0);
92
93 //@{
94 /// @brief Topology copy constructors
95 template<typename ValueType>
96 LeafNode(const LeafNode<ValueType, Log2Dim>& other, bool offValue, bool onValue, TopologyCopy);
97 template<typename ValueType>
98 LeafNode(const LeafNode<ValueType, Log2Dim>& other, bool background, TopologyCopy);
99 //@}
100
101 /// Destructor
102 ~LeafNode();
103
104 //
105 // Statistics
106 //
107 /// Return log2 of the size of the buffer storage.
108 static Index log2dim() { return Log2Dim; }
109 /// Return the number of voxels in each dimension.
110 static Index dim() { return DIM; }
111 static Index size() { return SIZE; }
112 static Index numValues() { return SIZE; }
113 static Index getLevel() { return LEVEL; }
114 static void getNodeLog2Dims(std::vector<Index>& dims) { dims.push_back(Log2Dim); }
115 static Index getChildDim() { return 1; }
116
117 static Index64 leafCount() { return 1; }
118 /// no-op
119 void nodeCount(std::vector<Index64> &) const {}
120 OPENVDB_DEPRECATED_MESSAGE("Use input type std::vector<Index64> for nodeCount.")
121 void nodeCount(std::vector<Index32> &) const {}
122 static Index64 nonLeafCount() { return 0; }
123
124 /// Return the number of active voxels.
125 Index64 onVoxelCount() const { return mValueMask.countOn(); }
126 /// Return the number of inactive voxels.
127 Index64 offVoxelCount() const { return mValueMask.countOff(); }
128 Index64 onLeafVoxelCount() const { return onVoxelCount(); }
129 Index64 offLeafVoxelCount() const { return offVoxelCount(); }
130 static Index64 onTileCount() { return 0; }
131 static Index64 offTileCount() { return 0; }
132
133 /// Return @c true if this node has no active voxels.
134 bool isEmpty() const { return mValueMask.isOff(); }
135 /// Return @c true if this node only contains active voxels.
136 bool isDense() const { return mValueMask.isOn(); }
137 /// @brief Return @c true if memory for this node's buffer has been allocated.
138 /// @details Currently, boolean leaf nodes don't support partial creation,
139 /// so this always returns @c true.
140 bool isAllocated() const { return true; }
141 /// @brief Allocate memory for this node's buffer if it has not already been allocated.
142 /// @details Currently, boolean leaf nodes don't support partial creation,
143 /// so this has no effect.
144 bool allocate() { return true; }
145
146 /// Return the memory in bytes occupied by this node.
147 Index64 memUsage() const;
148 Index64 memUsageIfLoaded() const;
149
150 /// Expand the given bounding box so that it includes this leaf node's active voxels.
151 /// If visitVoxels is false this LeafNode will be approximated as dense, i.e. with all
152 /// voxels active. Else the individual active voxels are visited to produce a tight bbox.
153 void evalActiveBoundingBox(CoordBBox& bbox, bool visitVoxels = true) const;
154
155 /// @brief Return the bounding box of this node, i.e., the full index space
156 /// spanned by this leaf node.
157 CoordBBox getNodeBoundingBox() const { return CoordBBox::createCube(mOrigin, DIM); }
158
159 /// Set the grid index coordinates of this node's local origin.
160 void setOrigin(const Coord& origin) { mOrigin = origin; }
161 //@{
162 /// Return the grid index coordinates of this node's local origin.
163 const Coord& origin() const { return mOrigin; }
164 void getOrigin(Coord& origin) const { origin = mOrigin; }
165 void getOrigin(Int32& x, Int32& y, Int32& z) const { mOrigin.asXYZ(x, y, z); }
166 //@}
167
168 /// Return the linear table offset of the given global or local coordinates.
169 static Index coordToOffset(const Coord& xyz);
170 /// @brief Return the local coordinates for a linear table offset,
171 /// where offset 0 has coordinates (0, 0, 0).
172 static Coord offsetToLocalCoord(Index n);
173 /// Return the global coordinates for a linear table offset.
174 Coord offsetToGlobalCoord(Index n) const;
175
176 /// Return the transient data value.
177 Index32 transientData() const { return mTransientData; }
178 /// Set the transient data value.
179 void setTransientData(Index32 transientData) { mTransientData = transientData; }
180
181 /// Return a string representation of this node.
182 std::string str() const;
183
184 /// @brief Return @c true if the given node (which may have a different @c ValueType
185 /// than this node) has the same active value topology as this node.
186 template<typename OtherType, Index OtherLog2Dim>
187 bool hasSameTopology(const LeafNode<OtherType, OtherLog2Dim>* other) const;
188
189 /// Check for buffer equivalence by value.
190 bool operator==(const LeafNode&) const;
191 bool operator!=(const LeafNode&) const;
192
193 //
194 // Buffer management
195 //
196 /// @brief Exchange this node's data buffer with the given data buffer
197 /// without changing the active states of the values.
198 void swap(Buffer& other) { mBuffer.swap(other); }
199 const Buffer& buffer() const { return mBuffer; }
200 Buffer& buffer() { return mBuffer; }
201
202 //
203 // I/O methods
204 //
205 /// Read in just the topology.
206 void readTopology(std::istream&, bool fromHalf = false);
207 /// Write out just the topology.
208 void writeTopology(std::ostream&, bool toHalf = false) const;
209
210 /// Read in the topology and the origin.
211 void readBuffers(std::istream&, bool fromHalf = false);
212 void readBuffers(std::istream& is, const CoordBBox&, bool fromHalf = false);
213 /// Write out the topology and the origin.
214 void writeBuffers(std::ostream&, bool toHalf = false) const;
215
216 //
217 // Accessor methods
218 //
219 /// Return the value of the voxel at the given coordinates.
220 const bool& getValue(const Coord& xyz) const;
221 /// Return the value of the voxel at the given offset.
222 const bool& getValue(Index offset) const;
223
224 /// @brief Return @c true if the voxel at the given coordinates is active.
225 /// @param xyz the coordinates of the voxel to be probed
226 /// @param[out] val the value of the voxel at the given coordinates
227 bool probeValue(const Coord& xyz, bool& val) const;
228 /// @brief Return @c true if the voxel at the given offset is active.
229 /// @param offset the linear offset of the voxel to be probed
230 /// @param[out] val the value of the voxel at the given coordinates
231 bool probeValue(Index offset, bool& val) const;
232
233 /// Return the level (0) at which leaf node values reside.
234 static Index getValueLevel(const Coord&) { return LEVEL; }
235
236 /// Set the active state of the voxel at the given coordinates but don't change its value.
237 void setActiveState(const Coord& xyz, bool on);
238 /// Set the active state of the voxel at the given offset but don't change its value.
239 void setActiveState(Index offset, bool on) { OPENVDB_ASSERT(offset<SIZE); mValueMask.set(offset, on); }
240
241 /// Set the value of the voxel at the given coordinates but don't change its active state.
242 void setValueOnly(const Coord& xyz, bool val);
243 /// Set the value of the voxel at the given offset but don't change its active state.
244 void setValueOnly(Index offset, bool val) { OPENVDB_ASSERT(offset<SIZE); mBuffer.setValue(offset,val); }
245
246 /// Mark the voxel at the given coordinates as inactive but don't change its value.
247 void setValueOff(const Coord& xyz) { mValueMask.setOff(this->coordToOffset(xyz)); }
248 /// Mark the voxel at the given offset as inactive but don't change its value.
249 void setValueOff(Index offset) { OPENVDB_ASSERT(offset < SIZE); mValueMask.setOff(offset); }
250
251 /// Set the value of the voxel at the given coordinates and mark the voxel as inactive.
252 void setValueOff(const Coord& xyz, bool val);
253 /// Set the value of the voxel at the given offset and mark the voxel as inactive.
254 void setValueOff(Index offset, bool val);
255
256 /// Mark the voxel at the given coordinates as active but don't change its value.
257 void setValueOn(const Coord& xyz) { mValueMask.setOn(this->coordToOffset(xyz)); }
258 /// Mark the voxel at the given offset as active but don't change its value.
259 void setValueOn(Index offset) { OPENVDB_ASSERT(offset < SIZE); mValueMask.setOn(offset); }
260
261 /// Set the value of the voxel at the given coordinates and mark the voxel as active.
262 void setValueOn(const Coord& xyz, bool val);
263 /// Set the value of the voxel at the given coordinates and mark the voxel as active.
264 void setValue(const Coord& xyz, bool val) { this->setValueOn(xyz, val); }
265 /// Set the value of the voxel at the given offset and mark the voxel as active.
266 void setValueOn(Index offset, bool val);
267
268 /// @brief Apply a functor to the value of the voxel at the given offset
269 /// and mark the voxel as active.
270 template<typename ModifyOp>
271 void modifyValue(Index offset, const ModifyOp& op);
272 /// @brief Apply a functor to the value of the voxel at the given coordinates
273 /// and mark the voxel as active.
274 template<typename ModifyOp>
275 void modifyValue(const Coord& xyz, const ModifyOp& op);
276
277 /// Apply a functor to the voxel at the given coordinates.
278 template<typename ModifyOp>
279 void modifyValueAndActiveState(const Coord& xyz, const ModifyOp& op);
280
281 /// Mark all voxels as active but don't change their values.
282 void setValuesOn() { mValueMask.setOn(); }
283 /// Mark all voxels as inactive but don't change their values.
284 void setValuesOff() { mValueMask.setOff(); }
285
286 /// Return @c true if the voxel at the given coordinates is active.
287 bool isValueOn(const Coord& xyz) const { return this->isValueOn(this->coordToOffset(xyz)); }
288 /// Return @c true if the voxel at the given offset is active.
289 bool isValueOn(Index offset) const { OPENVDB_ASSERT(offset < SIZE); return mValueMask.isOn(offset); }
290 /// Return @c true if the voxel at the given coordinates is inactive.
291 bool isValueOff(const Coord& xyz) const { return this->isValueOff(this->coordToOffset(xyz)); }
292 /// Return @c true if the voxel at the given offset is inactive.
293 bool isValueOff(Index offset) const { OPENVDB_ASSERT(offset < SIZE); return mValueMask.isOff(offset); }
294
295 /// Return @c false since leaf nodes never contain tiles.
296 static bool hasActiveTiles() { return false; }
297
298 /// Set all voxels that lie outside the given axis-aligned box to the background.
299 void clip(const CoordBBox&, bool background);
300
301 /// Set all voxels within an axis-aligned box to the specified value and active state.
302 void fill(const CoordBBox& bbox, bool value, bool active = true);
303 /// Set all voxels within an axis-aligned box to the specified value and active state.
304 void denseFill(const CoordBBox& bbox, bool val, bool on = true) { this->fill(bbox, val, on); }
305
306 /// Set all voxels to the specified value but don't change their active states.
307 void fill(const bool& value);
308 /// Set all voxels to the specified value and active state.
309 void fill(const bool& value, bool active);
310
311 /// @brief Copy into a dense grid the values of the voxels that lie within
312 /// a given bounding box.
313 ///
314 /// @param bbox inclusive bounding box of the voxels to be copied into the dense grid
315 /// @param dense dense grid with a stride in @e z of one (see tools::Dense
316 /// in tools/Dense.h for the required API)
317 ///
318 /// @note @a bbox is assumed to be identical to or contained in the coordinate domains
319 /// of both the dense grid and this node, i.e., no bounds checking is performed.
320 /// @note Consider using tools::CopyToDense in tools/Dense.h
321 /// instead of calling this method directly.
322 template<typename DenseT>
323 void copyToDense(const CoordBBox& bbox, DenseT& dense) const;
324
325 /// @brief Copy from a dense grid into this node the values of the voxels
326 /// that lie within a given bounding box.
327 /// @details Only values that are different (by more than the given tolerance)
328 /// from the background value will be active. Other values are inactive
329 /// and truncated to the background value.
330 ///
331 /// @param bbox inclusive bounding box of the voxels to be copied into this node
332 /// @param dense dense grid with a stride in @e z of one (see tools::Dense
333 /// in tools/Dense.h for the required API)
334 /// @param background background value of the tree that this node belongs to
335 /// @param tolerance tolerance within which a value equals the background value
336 ///
337 /// @note @a bbox is assumed to be identical to or contained in the coordinate domains
338 /// of both the dense grid and this node, i.e., no bounds checking is performed.
339 /// @note Consider using tools::CopyFromDense in tools/Dense.h
340 /// instead of calling this method directly.
341 template<typename DenseT>
342 void copyFromDense(const CoordBBox& bbox, const DenseT& dense, bool background, bool tolerance);
343
344 /// @brief Return the value of the voxel at the given coordinates.
345 /// @note Used internally by ValueAccessor.
346 template<typename AccessorT>
347 const bool& getValueAndCache(const Coord& xyz, AccessorT&) const {return this->getValue(xyz);}
348
349 /// @brief Return @c true if the voxel at the given coordinates is active.
350 /// @note Used internally by ValueAccessor.
351 template<typename AccessorT>
352 bool isValueOnAndCache(const Coord& xyz, AccessorT&) const { return this->isValueOn(xyz); }
353
354 /// @brief Change the value of the voxel at the given coordinates and mark it as active.
355 /// @note Used internally by ValueAccessor.
356 template<typename AccessorT>
357 void setValueAndCache(const Coord& xyz, bool val, AccessorT&) { this->setValueOn(xyz, val); }
358
359 /// @brief Change the value of the voxel at the given coordinates
360 /// but preserve its state.
361 /// @note Used internally by ValueAccessor.
362 template<typename AccessorT>
363 void setValueOnlyAndCache(const Coord& xyz, bool val, AccessorT&) {this->setValueOnly(xyz,val);}
364
365 /// @brief Change the value of the voxel at the given coordinates and mark it as inactive.
366 /// @note Used internally by ValueAccessor.
367 template<typename AccessorT>
368 void setValueOffAndCache(const Coord& xyz, bool value, AccessorT&)
369 {
370 this->setValueOff(xyz, value);
371 }
372
373 /// @brief Apply a functor to the value of the voxel at the given coordinates
374 /// and mark the voxel as active.
375 /// @note Used internally by ValueAccessor.
376 template<typename ModifyOp, typename AccessorT>
377 void modifyValueAndCache(const Coord& xyz, const ModifyOp& op, AccessorT&)
378 {
379 this->modifyValue(xyz, op);
380 }
381
382 /// Apply a functor to the voxel at the given coordinates.
383 /// @note Used internally by ValueAccessor.
384 template<typename ModifyOp, typename AccessorT>
385 void modifyValueAndActiveStateAndCache(const Coord& xyz, const ModifyOp& op, AccessorT&)
386 {
387 this->modifyValueAndActiveState(xyz, op);
388 }
389
390 /// @brief Set the active state of the voxel at the given coordinates
391 /// without changing its value.
392 /// @note Used internally by ValueAccessor.
393 template<typename AccessorT>
394 void setActiveStateAndCache(const Coord& xyz, bool on, AccessorT&)
395 {
396 this->setActiveState(xyz, on);
397 }
398
399 /// @brief Return @c true if the voxel at the given coordinates is active
400 /// and return the voxel value in @a val.
401 /// @note Used internally by ValueAccessor.
402 template<typename AccessorT>
403 bool probeValueAndCache(const Coord& xyz, bool& val, AccessorT&) const
404 {
405 return this->probeValue(xyz, val);
406 }
407
408 /// @brief Return the LEVEL (=0) at which leaf node values reside.
409 /// @note Used internally by ValueAccessor.
410 template<typename AccessorT>
411 static Index getValueLevelAndCache(const Coord&, AccessorT&) { return LEVEL; }
412
413 /// @brief Return a const reference to the first entry in the buffer.
414 /// @note Since it's actually a reference to a static data member
415 /// it should not be converted to a non-const pointer!
416 const bool& getFirstValue() const { if (mValueMask.isOn(0)) return Buffer::sOn; else return Buffer::sOff; }
417 /// @brief Return a const reference to the last entry in the buffer.
418 /// @note Since it's actually a reference to a static data member
419 /// it should not be converted to a non-const pointer!
420 const bool& getLastValue() const { if (mValueMask.isOn(SIZE-1)) return Buffer::sOn; else return Buffer::sOff; }
421
422 /// Return @c true if all of this node's voxels have the same active state
423 /// and are equal to within the given tolerance, and return the value in
424 /// @a constValue and the active state in @a state.
425 bool isConstant(bool& constValue, bool& state, bool tolerance = 0) const;
426
427 /// @brief Computes the median value of all the active and inactive voxels in this node.
428 /// @return The median value.
429 ///
430 /// @details The median for boolean values is defined as the mode
431 /// of the values, i.e. the value that occurs most often.
432 bool medianAll() const;
433
434 /// @brief Computes the median value of all the active voxels in this node.
435 /// @return The number of active voxels.
436 /// @param value Updated with the median value of all the active voxels.
437 ///
438 /// @details The median for boolean values is defined as the mode
439 /// of the values, i.e. the value that occurs most often.
440 Index medianOn(ValueType &value) const;
441
442 /// @brief Computes the median value of all the inactive voxels in this node.
443 /// @return The number of inactive voxels.
444 /// @param value Updated with the median value of all the inactive voxels.
445 ///
446 /// @details The median for boolean values is defined as the mode
447 /// of the values, i.e. the value that occurs most often.
448 Index medianOff(ValueType &value) const;
449
450 /// Return @c true if all of this node's values are inactive.
451 bool isInactive() const { return mValueMask.isOff(); }
452
453 //
454 // Unsafe methods
455 //
456 // These methods are not in fact unsafe, but are only offered so that
457 // the same methods can be called on both internal nodes and leaf nodes.
458
459 /// Return the value of the voxel at the given offset.
460 const bool& getValueUnsafe(Index offset) const { return this->getValue(offset); }
461 /// Return true if the voxel at the given offset is active and set value.
462 bool getValueUnsafe(Index offset, bool& value) const { return this->probeValue(offset, value); }
463 /// Set the active state of the voxel at the given offset but don't change its value.
464 void setActiveStateUnsafe(Index offset, bool on) { this->setActiveState(offset, on); }
465 /// Set the value of the voxel at the given coordinates but don't change its active state.
466 void setValueOnlyUnsafe(Index offset, const bool& value) { return this->setValueOnly(offset, value); }
467 /// Mark the voxel at the given offset as active but don't change its value.
468 void setValueOnUnsafe(Index offset) { this->setValueOn(offset); }
469 /// Set the value of the voxel at the given coordinates and mark the voxel as active.
470 void setValueOnUnsafe(Index offset, const bool& value) { this->setValueOn(offset, value); }
471 /// Mark the voxel at the given offset as inactive but don't change its value.
472 void setValueOffUnsafe(Index offset) { this->setValueOff(offset); }
473 /// Set the value of the voxel at the given coordinates and mark the voxel as active.
474 void setValueOffUnsafe(Index offset, const bool& value) { this->setValueOff(offset, value); }
475
476 void resetBackground(bool oldBackground, bool newBackground);
477
478 void negate() { mBuffer.mData.toggle(); }
479
480 template<MergePolicy Policy>
481 void merge(const LeafNode& other, bool bg = false, bool otherBG = false);
482 template<MergePolicy Policy> void merge(bool tileValue, bool tileActive);
483
484 /// @brief No-op
485 /// @details This function exists only to enable template instantiation.
486 void voxelizeActiveTiles(bool = true) {}
487
488 /// @brief Union this node's set of active values with the active values
489 /// of the other node, whose @c ValueType may be different. So a
490 /// resulting voxel will be active if either of the original voxels
491 /// were active.
492 ///
493 /// @note This operation modifies only active states, not values.
494 template<typename OtherType>
495 void topologyUnion(const LeafNode<OtherType, Log2Dim>& other, const bool preserveTiles = false);
496
497 /// @brief Intersect this node's set of active values with the active values
498 /// of the other node, whose @c ValueType may be different. So a
499 /// resulting voxel will be active only if both of the original voxels
500 /// were active.
501 ///
502 /// @details The last dummy argument is required to match the signature
503 /// for InternalNode::topologyIntersection.
504 ///
505 /// @note This operation modifies only active states, not
506 /// values. Also note that this operation can result in all voxels
507 /// being inactive so consider subsequently calling prune.
508 template<typename OtherType>
509 void topologyIntersection(const LeafNode<OtherType, Log2Dim>& other, const bool&);
510
511 /// @brief Difference this node's set of active values with the active values
512 /// of the other node, whose @c ValueType may be different. So a
513 /// resulting voxel will be active only if the original voxel is
514 /// active in this LeafNode and inactive in the other LeafNode.
515 ///
516 /// @details The last dummy argument is required to match the signature
517 /// for InternalNode::topologyDifference.
518 ///
519 /// @note This operation modifies only active states, not values.
520 /// Also, because it can deactivate all of this node's voxels,
521 /// consider subsequently calling prune.
522 template<typename OtherType>
523 void topologyDifference(const LeafNode<OtherType, Log2Dim>& other, const bool&);
524
525 template<typename CombineOp>
526 void combine(const LeafNode& other, CombineOp& op);
527 template<typename CombineOp>
528 void combine(bool, bool valueIsActive, CombineOp& op);
529
530 template<typename CombineOp, typename OtherType /*= bool*/>
531 void combine2(const LeafNode& other, const OtherType&, bool valueIsActive, CombineOp&);
532 template<typename CombineOp, typename OtherNodeT /*= LeafNode*/>
533 void combine2(bool, const OtherNodeT& other, bool valueIsActive, CombineOp&);
534 template<typename CombineOp, typename OtherNodeT /*= LeafNode*/>
535 void combine2(const LeafNode& b0, const OtherNodeT& b1, CombineOp&);
536
537 //@{
538 /// This function exists only to enable template instantiation.
539 void prune(const ValueType& /*tolerance*/ = zeroVal<ValueType>()) {}
540 void addLeaf(LeafNode*) {}
541 template<typename AccessorT>
542 void addLeafAndCache(LeafNode*, AccessorT&) {}
543 template<typename NodeT>
544 NodeT* stealNode(const Coord&, const ValueType&, bool) { return nullptr; }
545 template<typename NodeT>
546 NodeT* probeNode(const Coord&) { return nullptr; }
547 template<typename NodeT>
548 const NodeT* probeConstNode(const Coord&) const { return nullptr; }
549 template<typename ArrayT> void getNodes(ArrayT&) const {}
550 template<typename ArrayT> void stealNodes(ArrayT&, const ValueType&, bool) {}
551 //@}
552
553 void addTile(Index level, const Coord&, bool val, bool active);
554 void addTile(Index offset, bool val, bool active);
555 template<typename AccessorT>
556 void addTileAndCache(Index level, const Coord&, bool val, bool active, AccessorT&);
557
558 //@{
559 /// @brief Return a pointer to this node.
560 LeafNode* touchLeaf(const Coord&) { return this; }
561 template<typename AccessorT>
562 LeafNode* touchLeafAndCache(const Coord&, AccessorT&) { return this; }
563 LeafNode* probeLeaf(const Coord&) { return this; }
564 template<typename AccessorT>
565 LeafNode* probeLeafAndCache(const Coord&, AccessorT&) { return this; }
566 template<typename NodeT, typename AccessorT>
567 NodeT* probeNodeAndCache(const Coord&, AccessorT&)
568 {
569 OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
570 if (!(std::is_same<NodeT, LeafNode>::value)) return nullptr;
571 return reinterpret_cast<NodeT*>(this);
572 OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
573 }
574 //@}
575 //@{
576 /// @brief Return a @const pointer to this node.
577 const LeafNode* probeLeaf(const Coord&) const { return this; }
578 template<typename AccessorT>
579 const LeafNode* probeLeafAndCache(const Coord&, AccessorT&) const { return this; }
580 const LeafNode* probeConstLeaf(const Coord&) const { return this; }
581 template<typename AccessorT>
582 const LeafNode* probeConstLeafAndCache(const Coord&, AccessorT&) const { return this; }
583 template<typename NodeT, typename AccessorT>
584 const NodeT* probeConstNodeAndCache(const Coord&, AccessorT&) const
585 {
586 OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
587 if (!(std::is_same<NodeT, LeafNode>::value)) return nullptr;
588 return reinterpret_cast<const NodeT*>(this);
589 OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
590 }
591 //@}
592
593 //
594 // Iterators
595 //
596 protected:
597 using MaskOnIter = typename NodeMaskType::OnIterator;
598 using MaskOffIter = typename NodeMaskType::OffIterator;
599 using MaskDenseIter = typename NodeMaskType::DenseIterator;
600
601 template<typename MaskIterT, typename NodeT, typename ValueT>
602 struct ValueIter:
603 // Derives from SparseIteratorBase, but can also be used as a dense iterator,
604 // if MaskIterT is a dense mask iterator type.
605 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
606 {
607 using BaseT = SparseIteratorBase<MaskIterT, ValueIter, NodeT, ValueT>;
608
609 ValueIter() {}
610 ValueIter(const MaskIterT& iter, NodeT* parent): BaseT(iter, parent) {}
611
612 const bool& getItem(Index pos) const { return this->parent().getValue(pos); }
613 const bool& getValue() const { return this->getItem(this->pos()); }
614
615 // Note: setItem() can't be called on const iterators.
616 void setItem(Index pos, bool value) const { this->parent().setValueOnly(pos, value); }
617 // Note: setValue() can't be called on const iterators.
618 void setValue(bool value) const { this->setItem(this->pos(), value); }
619
620 // Note: modifyItem() can't be called on const iterators.
621 template<typename ModifyOp>
622 void modifyItem(Index n, const ModifyOp& op) const { this->parent().modifyValue(n, op); }
623 // Note: modifyValue() can't be called on const iterators.
624 template<typename ModifyOp>
625 void modifyValue(const ModifyOp& op) const { this->modifyItem(this->pos(), op); }
626 };
627
628 /// Leaf nodes have no children, so their child iterators have no get/set accessors.
629 template<typename MaskIterT, typename NodeT>
630 struct ChildIter:
631 public SparseIteratorBase<MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>
632 {
633 ChildIter() {}
634 ChildIter(const MaskIterT& iter, NodeT* parent): SparseIteratorBase<
635 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
636 };
637
638 template<typename NodeT, typename ValueT>
639 struct DenseIter: public DenseIteratorBase<
640 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, /*ChildT=*/void, ValueT>
641 {
642 using BaseT = DenseIteratorBase<MaskDenseIter, DenseIter, NodeT, void, ValueT>;
643 using NonConstValueT = typename BaseT::NonConstValueType;
644
645 DenseIter() {}
646 DenseIter(const MaskDenseIter& iter, NodeT* parent): BaseT(iter, parent) {}
647
648 bool getItem(Index pos, void*& child, NonConstValueT& value) const
649 {
650 value = this->parent().getValue(pos);
651 child = nullptr;
652 return false; // no child
653 }
654
655 // Note: setItem() can't be called on const iterators.
656 //void setItem(Index pos, void* child) const {}
657
658 // Note: unsetItem() can't be called on const iterators.
659 void unsetItem(Index pos, const ValueT& val) const {this->parent().setValueOnly(pos, val);}
660 };
661
662 public:
663 using ValueOnIter = ValueIter<MaskOnIter, LeafNode, const bool>;
664 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
665 using ValueOffIter = ValueIter<MaskOffIter, LeafNode, const bool>;
666 using ValueOffCIter = ValueIter<MaskOffIter, const LeafNode, const bool>;
667 using ValueAllIter = ValueIter<MaskDenseIter, LeafNode, const bool>;
668 using ValueAllCIter = ValueIter<MaskDenseIter, const LeafNode, const bool>;
669 using ChildOnIter = ChildIter<MaskOnIter, LeafNode>;
670 using ChildOnCIter = ChildIter<MaskOnIter, const LeafNode>;
671 using ChildOffIter = ChildIter<MaskOffIter, LeafNode>;
672 using ChildOffCIter = ChildIter<MaskOffIter, const LeafNode>;
673 using ChildAllIter = DenseIter<LeafNode, bool>;
674 using ChildAllCIter = DenseIter<const LeafNode, const bool>;
675
676 ValueOnCIter cbeginValueOn() const { return ValueOnCIter(mValueMask.beginOn(), this); }
677 ValueOnCIter beginValueOn() const { return ValueOnCIter(mValueMask.beginOn(), this); }
678 ValueOnIter beginValueOn() { return ValueOnIter(mValueMask.beginOn(), this); }
679 ValueOffCIter cbeginValueOff() const { return ValueOffCIter(mValueMask.beginOff(), this); }
680 ValueOffCIter beginValueOff() const { return ValueOffCIter(mValueMask.beginOff(), this); }
681 ValueOffIter beginValueOff() { return ValueOffIter(mValueMask.beginOff(), this); }
682 ValueAllCIter cbeginValueAll() const { return ValueAllCIter(mValueMask.beginDense(), this); }
683 ValueAllCIter beginValueAll() const { return ValueAllCIter(mValueMask.beginDense(), this); }
684 ValueAllIter beginValueAll() { return ValueAllIter(mValueMask.beginDense(), this); }
685
686 ValueOnCIter cendValueOn() const { return ValueOnCIter(mValueMask.endOn(), this); }
687 ValueOnCIter endValueOn() const { return ValueOnCIter(mValueMask.endOn(), this); }
688 ValueOnIter endValueOn() { return ValueOnIter(mValueMask.endOn(), this); }
689 ValueOffCIter cendValueOff() const { return ValueOffCIter(mValueMask.endOff(), this); }
690 ValueOffCIter endValueOff() const { return ValueOffCIter(mValueMask.endOff(), this); }
691 ValueOffIter endValueOff() { return ValueOffIter(mValueMask.endOff(), this); }
692 ValueAllCIter cendValueAll() const { return ValueAllCIter(mValueMask.endDense(), this); }
693 ValueAllCIter endValueAll() const { return ValueAllCIter(mValueMask.endDense(), this); }
694 ValueAllIter endValueAll() { return ValueAllIter(mValueMask.endDense(), this); }
695
696 // Note that [c]beginChildOn() and [c]beginChildOff() actually return end iterators,
697 // because leaf nodes have no children.
698 ChildOnCIter cbeginChildOn() const { return ChildOnCIter(mValueMask.endOn(), this); }
699 ChildOnCIter beginChildOn() const { return ChildOnCIter(mValueMask.endOn(), this); }
700 ChildOnIter beginChildOn() { return ChildOnIter(mValueMask.endOn(), this); }
701 ChildOffCIter cbeginChildOff() const { return ChildOffCIter(mValueMask.endOff(), this); }
702 ChildOffCIter beginChildOff() const { return ChildOffCIter(mValueMask.endOff(), this); }
703 ChildOffIter beginChildOff() { return ChildOffIter(mValueMask.endOff(), this); }
704 ChildAllCIter cbeginChildAll() const { return ChildAllCIter(mValueMask.beginDense(), this); }
705 ChildAllCIter beginChildAll() const { return ChildAllCIter(mValueMask.beginDense(), this); }
706 ChildAllIter beginChildAll() { return ChildAllIter(mValueMask.beginDense(), this); }
707
708 ChildOnCIter cendChildOn() const { return ChildOnCIter(mValueMask.endOn(), this); }
709 ChildOnCIter endChildOn() const { return ChildOnCIter(mValueMask.endOn(), this); }
710 ChildOnIter endChildOn() { return ChildOnIter(mValueMask.endOn(), this); }
711 ChildOffCIter cendChildOff() const { return ChildOffCIter(mValueMask.endOff(), this); }
712 ChildOffCIter endChildOff() const { return ChildOffCIter(mValueMask.endOff(), this); }
713 ChildOffIter endChildOff() { return ChildOffIter(mValueMask.endOff(), this); }
714 ChildAllCIter cendChildAll() const { return ChildAllCIter(mValueMask.endDense(), this); }
715 ChildAllCIter endChildAll() const { return ChildAllCIter(mValueMask.endDense(), this); }
716 ChildAllIter endChildAll() { return ChildAllIter(mValueMask.endDense(), this); }
717
718 //
719 // Mask accessors
720 //
721 bool isValueMaskOn(Index n) const { return mValueMask.isOn(n); }
722 bool isValueMaskOn() const { return mValueMask.isOn(); }
723 bool isValueMaskOff(Index n) const { return mValueMask.isOff(n); }
724 bool isValueMaskOff() const { return mValueMask.isOff(); }
725 const NodeMaskType& getValueMask() const { return mValueMask; }
726 const NodeMaskType& valueMask() const { return mValueMask; }
727 NodeMaskType& getValueMask() { return mValueMask; }
728 void setValueMask(const NodeMaskType& mask) { mValueMask = mask; }
729 bool isChildMaskOn(Index) const { return false; } // leaf nodes have no children
730 bool isChildMaskOff(Index) const { return true; }
731 bool isChildMaskOff() const { return true; }
732 protected:
733 void setValueMask(Index n, bool on) { mValueMask.set(n, on); }
734 void setValueMaskOn(Index n) { mValueMask.setOn(n); }
735 void setValueMaskOff(Index n) { mValueMask.setOff(n); }
736
737 /// Compute the origin of the leaf node that contains the voxel with the given coordinates.
738 static void evalNodeOrigin(Coord& xyz) { xyz &= ~(DIM - 1); }
739
740 /// Bitmask that determines which voxels are active
741 NodeMaskType mValueMask;
742 /// Bitmask representing the values of voxels
743 Buffer mBuffer;
744 /// Global grid index coordinates (x,y,z) of the local origin of this node
745 Coord mOrigin;
746 /// Transient data (not serialized)
747 Index32 mTransientData = 0;
748
749 private:
750 /// @brief During topology-only construction, access is needed
751 /// to protected/private members of other template instances.
752 template<typename, Index> friend class LeafNode;
753
754 friend struct ValueIter<MaskOnIter, LeafNode, bool>;
755 friend struct ValueIter<MaskOffIter, LeafNode, bool>;
756 friend struct ValueIter<MaskDenseIter, LeafNode, bool>;
757 friend struct ValueIter<MaskOnIter, const LeafNode, bool>;
758 friend struct ValueIter<MaskOffIter, const LeafNode, bool>;
759 friend struct ValueIter<MaskDenseIter, const LeafNode, bool>;
760
761 //@{
762 /// Allow iterators to call mask accessor methods (see below).
763 /// @todo Make mask accessors public?
764 friend class IteratorBase<MaskOnIter, LeafNode>;
765 friend class IteratorBase<MaskOffIter, LeafNode>;
766 friend class IteratorBase<MaskDenseIter, LeafNode>;
767 //@}
768
769}; // class LeafNode<bool>
770
771
772////////////////////////////////////////
773
774
775 template<Index Log2Dim>
776 inline
777 LeafNode<bool, Log2Dim>::LeafNode()
778 : mOrigin(0, 0, 0)
779{
780}
781
782
783 template<Index Log2Dim>
784 inline
785 LeafNode<bool, Log2Dim>::LeafNode(const Coord& xyz, bool value, bool active)
786 : mValueMask(active)
787 , mBuffer(value)
788 , mOrigin(xyz & (~(DIM - 1)))
789{
790}
791
792
793 template<Index Log2Dim>
794 inline
795 LeafNode<bool, Log2Dim>::LeafNode(PartialCreate, const Coord& xyz, bool value, bool active)
796 : mValueMask(active)
797 , mBuffer(value)
798 , mOrigin(xyz & (~(DIM - 1)))
799{
800 /// @todo For now, this is identical to the non-PartialCreate constructor.
801 /// Consider modifying the Buffer class to allow it to be constructed
802 /// without allocating a bitmask.
803}
804
805
806 template<Index Log2Dim>
807 inline
808 LeafNode<bool, Log2Dim>::LeafNode(const LeafNode &other)
809 : mValueMask(other.valueMask())
810 , mBuffer(other.mBuffer)
811 , mOrigin(other.mOrigin)
812 , mTransientData(other.mTransientData)
813{
814}
815
816
817// Copy-construct from a leaf node with the same configuration but a different ValueType.
818 template<Index Log2Dim>
819 template<typename ValueT>
820 inline
821 LeafNode<bool, Log2Dim>::LeafNode(const LeafNode<ValueT, Log2Dim>& other)
822 : mValueMask(other.valueMask())
823 , mOrigin(other.origin())
824 , mTransientData(other.mTransientData)
825{
826 struct Local {
827 /// @todo Consider using a value conversion functor passed as an argument instead.
828 static inline bool convertValue(const ValueT& val) { return bool(val); }
829 };
830
831 for (Index i = 0; i < SIZE; ++i) {
832 mBuffer.setValue(i, Local::convertValue(other.mBuffer[i]));
833 }
834}
835
836
837 template<Index Log2Dim>
838 template<typename ValueT>
839 inline
840 LeafNode<bool, Log2Dim>::LeafNode(const LeafNode<ValueT, Log2Dim>& other,
841 bool background, TopologyCopy)
842 : mValueMask(other.valueMask())
843 , mBuffer(background)
844 , mOrigin(other.origin())
845 , mTransientData(other.mTransientData)
846{
847}
848
849
850 template<Index Log2Dim>
851 inline
852 LeafNode<bool, Log2Dim>::LeafNode(const Coord& xyz,
853 const NodeMaskType& mask,
854 const Buffer& buff,
855 const Index32 trans)
856 : mValueMask(mask)
857 , mBuffer(buff)
858 , mOrigin(xyz & (~(DIM - 1)))
859 , mTransientData(trans)
860{
861}
862
863 template<Index Log2Dim>
864 template<typename ValueT>
865 inline
866 LeafNode<bool, Log2Dim>::LeafNode(const LeafNode<ValueT, Log2Dim>& other,
867 bool offValue, bool onValue, TopologyCopy)
868 : mValueMask(other.valueMask())
869 , mBuffer(offValue)
870 , mOrigin(other.origin())
871 , mTransientData(other.mTransientData)
872{
873 for (Index i = 0; i < SIZE; ++i) {
874 if (mValueMask.isOn(i)) {
875 mBuffer.setValue(i, onValue);
876 }
877 }
878}
879
880
881 template<Index Log2Dim>
882 inline
883 LeafNode<bool, Log2Dim>::~LeafNode()
884{
885}
886
887
888////////////////////////////////////////
889
890
891 template<Index Log2Dim>
892 inline Index64
893 LeafNode<bool, Log2Dim>::memUsage() const
894{
895 // Use sizeof(*this) to capture alignment-related padding
896 return sizeof(*this);
897}
898
899
900 template<Index Log2Dim>
901 inline Index64
902 LeafNode<bool, Log2Dim>::memUsageIfLoaded() const
903{
904 // Use sizeof(*this) to capture alignment-related padding
905 return sizeof(*this);
906}
907
908
909 template<Index Log2Dim>
910 inline void
911 LeafNode<bool, Log2Dim>::evalActiveBoundingBox(CoordBBox& bbox, bool visitVoxels) const
912{
913 CoordBBox this_bbox = this->getNodeBoundingBox();
914 if (bbox.isInside(this_bbox)) return;//this LeafNode is already enclosed in the bbox
915 if (ValueOnCIter iter = this->cbeginValueOn()) {//any active values?
916 if (visitVoxels) {//use voxel granularity?
917 this_bbox.reset();
918 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
919 this_bbox.translate(this->origin());
920 }
921 bbox.expand(this_bbox);
922 }
923}
924
925
926 template<Index Log2Dim>
927 template<typename OtherType, Index OtherLog2Dim>
928 inline bool
929 LeafNode<bool, Log2Dim>::hasSameTopology(const LeafNode<OtherType, OtherLog2Dim>* other) const
930{
931 OPENVDB_ASSERT(other);
932 return (Log2Dim == OtherLog2Dim && mValueMask == other->getValueMask());
933}
934
935
936 template<Index Log2Dim>
937 inline std::string
938 LeafNode<bool, Log2Dim>::str() const
939{
940 std::ostringstream ostr;
941 ostr << "LeafNode @" << mOrigin << ": ";
942 for (Index32 n = 0; n < SIZE; ++n) ostr << (mValueMask.isOn(n) ? '#' : '.');
943 return ostr.str();
944}
945
946
947////////////////////////////////////////
948
949
950 template<Index Log2Dim>
951 inline Index
952 LeafNode<bool, Log2Dim>::coordToOffset(const Coord& xyz)
953{
954 OPENVDB_ASSERT((xyz[0] & (DIM-1u)) < DIM && (xyz[1] & (DIM-1u)) < DIM && (xyz[2] & (DIM-1u)) < DIM);
955 return ((xyz[0] & (DIM-1u)) << 2*Log2Dim)
956 + ((xyz[1] & (DIM-1u)) << Log2Dim)
957 + (xyz[2] & (DIM-1u));
958}
959
960
961 template<Index Log2Dim>
962 inline Coord
963 LeafNode<bool, Log2Dim>::offsetToLocalCoord(Index n)
964{
965 OPENVDB_ASSERT(n < (1 << 3*Log2Dim));
966 Coord xyz;
967 xyz.setX(n >> 2*Log2Dim);
968 n &= ((1 << 2*Log2Dim) - 1);
969 xyz.setY(n >> Log2Dim);
970 xyz.setZ(n & ((1 << Log2Dim) - 1));
971 return xyz;
972}
973
974
975 template<Index Log2Dim>
976 inline Coord
977 LeafNode<bool, Log2Dim>::offsetToGlobalCoord(Index n) const
978{
979 return (this->offsetToLocalCoord(n) + this->origin());
980}
981
982
983////////////////////////////////////////
984
985
986 template<Index Log2Dim>
987 inline void
988 LeafNode<bool, Log2Dim>::readTopology(std::istream& is, bool /*fromHalf*/)
989{
990 mValueMask.load(is);
991}
992
993
994 template<Index Log2Dim>
995 inline void
996 LeafNode<bool, Log2Dim>::writeTopology(std::ostream& os, bool /*toHalf*/) const
997{
998 mValueMask.save(os);
999}
1000
1001
1002 template<Index Log2Dim>
1003 inline void
1004 LeafNode<bool, Log2Dim>::readBuffers(std::istream& is, const CoordBBox& clipBBox, bool fromHalf)
1005{
1006 // Boolean LeafNodes don't currently implement lazy loading.
1007 // Instead, load the full buffer, then clip it.
1008
1009 this->readBuffers(is, fromHalf);
1010
1011 // Get this tree's background value.
1012 bool background = false;
1013 if (const void* bgPtr = io::getGridBackgroundValuePtr(is)) {
1014 background = *static_cast<const bool*>(bgPtr);
1015 }
1016 this->clip(clipBBox, background);
1017}
1018
1019
1020 template<Index Log2Dim>
1021 inline void
1022 LeafNode<bool, Log2Dim>::readBuffers(std::istream& is, bool /*fromHalf*/)
1023{
1024 io::checkFormatVersion(is);
1025
1026 // Read in the value mask.
1027 mValueMask.load(is);
1028 // Read in the origin.
1029 is.read(reinterpret_cast<char*>(&mOrigin), sizeof(Coord::ValueType) * 3);
1030
1031 // Read in the mask for the voxel values.
1032 mBuffer.mData.load(is);
1033}
1034
1035
1036 template<Index Log2Dim>
1037 inline void
1038 LeafNode<bool, Log2Dim>::writeBuffers(std::ostream& os, bool /*toHalf*/) const
1039{
1040 // Write out the value mask.
1041 mValueMask.save(os);
1042 // Write out the origin.
1043 os.write(reinterpret_cast<const char*>(&mOrigin), sizeof(Coord::ValueType) * 3);
1044 // Write out the voxel values.
1045 mBuffer.mData.save(os);
1046}
1047
1048
1049////////////////////////////////////////
1050
1051
1052 template<Index Log2Dim>
1053 inline bool
1054 LeafNode<bool, Log2Dim>::operator==(const LeafNode& other) const
1055{
1056 return mOrigin == other.mOrigin &&
1057 mValueMask == other.valueMask() &&
1058 mBuffer == other.mBuffer;
1059}
1060
1061
1062 template<Index Log2Dim>
1063 inline bool
1064 LeafNode<bool, Log2Dim>::operator!=(const LeafNode& other) const
1065{
1066 return !(this->operator==(other));
1067}
1068
1069
1070////////////////////////////////////////
1071
1072
1073 template<Index Log2Dim>
1074 inline bool
1075 LeafNode<bool, Log2Dim>::isConstant(bool& constValue, bool& state, bool tolerance) const
1076{
1077 if (!mValueMask.isConstant(state)) return false;
1078
1079 // Note: if tolerance is true (i.e., 1), then all boolean values compare equal.
1080 if (!tolerance && !(mBuffer.mData.isOn() || mBuffer.mData.isOff())) return false;
1081
1082 constValue = mBuffer.mData.isOn();
1083 return true;
1084}
1085
1086////////////////////////////////////////
1087
1088 template<Index Log2Dim>
1089 inline bool
1090 LeafNode<bool, Log2Dim>::medianAll() const
1091{
1092 const Index countTrue = mBuffer.mData.countOn();
1093 return countTrue > (NUM_VALUES >> 1);
1094}
1095
1096 template<Index Log2Dim>
1097 inline Index
1098 LeafNode<bool, Log2Dim>::medianOn(bool& state) const
1099{
1100 const NodeMaskType tmp = mBuffer.mData & mValueMask;//both true and active
1101 const Index countTrueOn = tmp.countOn(), countOn = mValueMask.countOn();
1102 state = countTrueOn > (NUM_VALUES >> 1);
1103 return countOn;
1104}
1105
1106 template<Index Log2Dim>
1107 inline Index
1108 LeafNode<bool, Log2Dim>::medianOff(bool& state) const
1109{
1110 const NodeMaskType tmp = mBuffer.mData & (!mValueMask);//both true and inactive
1111 const Index countTrueOff = tmp.countOn(), countOff = mValueMask.countOff();
1112 state = countTrueOff > (NUM_VALUES >> 1);
1113 return countOff;
1114}
1115
1116////////////////////////////////////////
1117
1118
1119 template<Index Log2Dim>
1120 inline void
1121 LeafNode<bool, Log2Dim>::addTile(Index /*level*/, const Coord& xyz, bool val, bool active)
1122{
1123 this->addTile(this->coordToOffset(xyz), val, active);
1124}
1125
1126 template<Index Log2Dim>
1127 inline void
1128 LeafNode<bool, Log2Dim>::addTile(Index offset, bool val, bool active)
1129{
1130 OPENVDB_ASSERT(offset < SIZE);
1131 this->setValueOnly(offset, val);
1132 this->setActiveState(offset, active);
1133}
1134
1135 template<Index Log2Dim>
1136 template<typename AccessorT>
1137 inline void
1138 LeafNode<bool, Log2Dim>::addTileAndCache(Index level, const Coord& xyz,
1139 bool val, bool active, AccessorT&)
1140{
1141 this->addTile(level, xyz, val, active);
1142}
1143
1144
1145////////////////////////////////////////
1146
1147
1148 template<Index Log2Dim>
1149 inline const bool&
1150 LeafNode<bool, Log2Dim>::getValue(const Coord& xyz) const
1151{
1152 // This *CANNOT* use operator ? because Visual C++
1153 if (mBuffer.mData.isOn(this->coordToOffset(xyz))) return Buffer::sOn; else return Buffer::sOff;
1154}
1155
1156
1157 template<Index Log2Dim>
1158 inline const bool&
1159 LeafNode<bool, Log2Dim>::getValue(Index offset) const
1160{
1161 OPENVDB_ASSERT(offset < SIZE);
1162 // This *CANNOT* use operator ? for Windows
1163 if (mBuffer.mData.isOn(offset)) return Buffer::sOn; else return Buffer::sOff;
1164}
1165
1166
1167 template<Index Log2Dim>
1168 inline bool
1169 LeafNode<bool, Log2Dim>::probeValue(const Coord& xyz, bool& val) const
1170{
1171 return this->probeValue(this->coordToOffset(xyz), val);
1172}
1173
1174 template<Index Log2Dim>
1175 inline bool
1176 LeafNode<bool, Log2Dim>::probeValue(Index offset, bool& val) const
1177{
1178 OPENVDB_ASSERT(offset < SIZE);
1179 val = mBuffer.mData.isOn(offset);
1180 return mValueMask.isOn(offset);
1181}
1182
1183 template<Index Log2Dim>
1184 inline void
1185 LeafNode<bool, Log2Dim>::setValueOn(const Coord& xyz, bool val)
1186{
1187 this->setValueOn(this->coordToOffset(xyz), val);
1188}
1189
1190
1191 template<Index Log2Dim>
1192 inline void
1193 LeafNode<bool, Log2Dim>::setValueOn(Index offset, bool val)
1194{
1195 OPENVDB_ASSERT(offset < SIZE);
1196 mValueMask.setOn(offset);
1197 mBuffer.mData.set(offset, val);
1198}
1199
1200
1201 template<Index Log2Dim>
1202 inline void
1203 LeafNode<bool, Log2Dim>::setValueOnly(const Coord& xyz, bool val)
1204{
1205 this->setValueOnly(this->coordToOffset(xyz), val);
1206}
1207
1208
1209 template<Index Log2Dim>
1210 inline void
1211 LeafNode<bool, Log2Dim>::setActiveState(const Coord& xyz, bool on)
1212{
1213 mValueMask.set(this->coordToOffset(xyz), on);
1214}
1215
1216
1217 template<Index Log2Dim>
1218 inline void
1219 LeafNode<bool, Log2Dim>::setValueOff(const Coord& xyz, bool val)
1220{
1221 this->setValueOff(this->coordToOffset(xyz), val);
1222}
1223
1224
1225 template<Index Log2Dim>
1226 inline void
1227 LeafNode<bool, Log2Dim>::setValueOff(Index offset, bool val)
1228{
1229 OPENVDB_ASSERT(offset < SIZE);
1230 mValueMask.setOff(offset);
1231 mBuffer.mData.set(offset, val);
1232}
1233
1234
1235 template<Index Log2Dim>
1236 template<typename ModifyOp>
1237 inline void
1238 LeafNode<bool, Log2Dim>::modifyValue(Index offset, const ModifyOp& op)
1239{
1240 bool val = mBuffer.mData.isOn(offset);
1241 op(val);
1242 mBuffer.mData.set(offset, val);
1243 mValueMask.setOn(offset);
1244}
1245
1246
1247 template<Index Log2Dim>
1248 template<typename ModifyOp>
1249 inline void
1250 LeafNode<bool, Log2Dim>::modifyValue(const Coord& xyz, const ModifyOp& op)
1251{
1252 this->modifyValue(this->coordToOffset(xyz), op);
1253}
1254
1255
1256 template<Index Log2Dim>
1257 template<typename ModifyOp>
1258 inline void
1259 LeafNode<bool, Log2Dim>::modifyValueAndActiveState(const Coord& xyz, const ModifyOp& op)
1260{
1261 const Index offset = this->coordToOffset(xyz);
1262 bool val = mBuffer.mData.isOn(offset), state = mValueMask.isOn(offset);
1263 op(val, state);
1264 mBuffer.mData.set(offset, val);
1265 mValueMask.set(offset, state);
1266}
1267
1268
1269////////////////////////////////////////
1270
1271
1272 template<Index Log2Dim>
1273 inline void
1274 LeafNode<bool, Log2Dim>::resetBackground(bool oldBackground, bool newBackground)
1275{
1276 if (newBackground != oldBackground) {
1277 // Flip mBuffer's background bits and zero its foreground bits.
1278 NodeMaskType bgMask = !(mBuffer.mData | mValueMask);
1279 // Overwrite mBuffer's background bits, leaving its foreground bits intact.
1280 mBuffer.mData = (mBuffer.mData & mValueMask) | bgMask;
1281 }
1282}
1283
1284
1285////////////////////////////////////////
1286
1287
1288 template<Index Log2Dim>
1289 template<MergePolicy Policy>
1290 inline void
1291 LeafNode<bool, Log2Dim>::merge(const LeafNode& other, bool /*bg*/, bool /*otherBG*/)
1292{
1293 OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
1294 if (Policy == MERGE_NODES) return;
1295 for (typename NodeMaskType::OnIterator iter = other.valueMask().beginOn(); iter; ++iter) {
1296 const Index n = iter.pos();
1297 if (mValueMask.isOff(n)) {
1298 mBuffer.mData.set(n, other.mBuffer.mData.isOn(n));
1299 mValueMask.setOn(n);
1300 }
1301 }
1302 OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
1303}
1304
1305 template<Index Log2Dim>
1306 template<MergePolicy Policy>
1307 inline void
1308 LeafNode<bool, Log2Dim>::merge(bool tileValue, bool tileActive)
1309{
1310 OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
1311 if (Policy != MERGE_ACTIVE_STATES_AND_NODES) return;
1312 if (!tileActive) return;
1313 // Replace all inactive values with the active tile value.
1314 if (tileValue) mBuffer.mData |= !mValueMask; // -0=>1, +0=>0, -1=>1, +1=>1 (-,+ = off,on)
1315 else mBuffer.mData &= mValueMask; // -0=>0, +0=>0, -1=>0, +1=>1
1316 mValueMask.setOn();
1317 OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
1318}
1319
1320
1321////////////////////////////////////////
1322
1323
1324 template<Index Log2Dim>
1325 template<typename OtherType>
1326 inline void
1327 LeafNode<bool, Log2Dim>::topologyUnion(const LeafNode<OtherType, Log2Dim>& other, bool)
1328{
1329 mValueMask |= other.valueMask();
1330}
1331
1332
1333 template<Index Log2Dim>
1334 template<typename OtherType>
1335 inline void
1336 LeafNode<bool, Log2Dim>::topologyIntersection(const LeafNode<OtherType, Log2Dim>& other,
1337 const bool&)
1338{
1339 mValueMask &= other.valueMask();
1340}
1341
1342
1343 template<Index Log2Dim>
1344 template<typename OtherType>
1345 inline void
1346 LeafNode<bool, Log2Dim>::topologyDifference(const LeafNode<OtherType, Log2Dim>& other,
1347 const bool&)
1348{
1349 mValueMask &= !other.valueMask();
1350}
1351
1352
1353////////////////////////////////////////
1354
1355
1356 template<Index Log2Dim>
1357 inline void
1358 LeafNode<bool, Log2Dim>::clip(const CoordBBox& clipBBox, bool background)
1359{
1360 CoordBBox nodeBBox = this->getNodeBoundingBox();
1361 if (!clipBBox.hasOverlap(nodeBBox)) {
1362 // This node lies completely outside the clipping region. Fill it with background tiles.
1363 this->fill(nodeBBox, background, /*active=*/false);
1364 } else if (clipBBox.isInside(nodeBBox)) {
1365 // This node lies completely inside the clipping region. Leave it intact.
1366 return;
1367 }
1368
1369 // This node isn't completely contained inside the clipping region.
1370 // Set any voxels that lie outside the region to the background value.
1371
1372 // Construct a boolean mask that is on inside the clipping region and off outside it.
1373 NodeMaskType mask;
1374 nodeBBox.intersect(clipBBox);
1375 Coord xyz;
1376 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1377 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1378 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1379 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1380 mask.setOn(static_cast<Index32>(this->coordToOffset(xyz)));
1381 }
1382 }
1383 }
1384
1385 // Set voxels that lie in the inactive region of the mask (i.e., outside
1386 // the clipping region) to the background value.
1387 for (MaskOffIter maskIter = mask.beginOff(); maskIter; ++maskIter) {
1388 this->setValueOff(maskIter.pos(), background);
1389 }
1390}
1391
1392
1393////////////////////////////////////////
1394
1395
1396 template<Index Log2Dim>
1397 inline void
1398 LeafNode<bool, Log2Dim>::fill(const CoordBBox& bbox, bool value, bool active)
1399{
1400 auto clippedBBox = this->getNodeBoundingBox();
1401 clippedBBox.intersect(bbox);
1402 if (!clippedBBox) return;
1403
1404 for (Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1405 const Index offsetX = (x & (DIM-1u))<<2*Log2Dim;
1406 for (Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1407 const Index offsetXY = offsetX + ((y & (DIM-1u))<< Log2Dim);
1408 for (Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1409 const Index offset = offsetXY + (z & (DIM-1u));
1410 mValueMask.set(offset, active);
1411 mBuffer.mData.set(offset, value);
1412 }
1413 }
1414 }
1415}
1416
1417 template<Index Log2Dim>
1418 inline void
1419 LeafNode<bool, Log2Dim>::fill(const bool& value)
1420{
1421 mBuffer.fill(value);
1422}
1423
1424 template<Index Log2Dim>
1425 inline void
1426 LeafNode<bool, Log2Dim>::fill(const bool& value, bool active)
1427{
1428 mBuffer.fill(value);
1429 mValueMask.set(active);
1430}
1431
1432
1433////////////////////////////////////////
1434
1435
1436 template<Index Log2Dim>
1437 template<typename DenseT>
1438 inline void
1439 LeafNode<bool, Log2Dim>::copyToDense(const CoordBBox& bbox, DenseT& dense) const
1440{
1441 using DenseValueType = typename DenseT::ValueType;
1442
1443 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1444 const Coord& min = dense.bbox().min();
1445 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // target array
1446 const Int32 n0 = bbox.min()[2] & (DIM-1u);
1447 for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1448 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1449 const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM);
1450 for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1451 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1452 Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM);
1453 for (Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1454 *t2 = DenseValueType(mBuffer.mData.isOn(n2++));
1455 }
1456 }
1457 }
1458}
1459
1460
1461 template<Index Log2Dim>
1462 template<typename DenseT>
1463 inline void
1464 LeafNode<bool, Log2Dim>::copyFromDense(const CoordBBox& bbox, const DenseT& dense,
1465 bool background, bool tolerance)
1466{
1467 using DenseValueType = typename DenseT::ValueType;
1468 struct Local {
1469 inline static bool toBool(const DenseValueType& v) { return !math::isZero(v); }
1470 };
1471
1472 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1473 const Coord& min = dense.bbox().min();
1474 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]); // source
1475 const Int32 n0 = bbox.min()[2] & (DIM-1u);
1476 for (Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1477 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1478 const Int32 n1 = n0 + ((x & (DIM-1u)) << 2*LOG2DIM);
1479 for (Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1480 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1481 Int32 n2 = n1 + ((y & (DIM-1u)) << LOG2DIM);
1482 for (Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1483 // Note: if tolerance is true (i.e., 1), then all boolean values compare equal.
1484 if (tolerance || (background == Local::toBool(*s2))) {
1485 mValueMask.setOff(n2);
1486 mBuffer.mData.set(n2, background);
1487 } else {
1488 mValueMask.setOn(n2);
1489 mBuffer.mData.set(n2, Local::toBool(*s2));
1490 }
1491 }
1492 }
1493 }
1494}
1495
1496
1497////////////////////////////////////////
1498
1499
1500 template<Index Log2Dim>
1501 template<typename CombineOp>
1502 inline void
1503 LeafNode<bool, Log2Dim>::combine(const LeafNode& other, CombineOp& op)
1504{
1505 CombineArgs<bool> args;
1506 for (Index i = 0; i < SIZE; ++i) {
1507 bool result = false, aVal = mBuffer.mData.isOn(i), bVal = other.mBuffer.mData.isOn(i);
1508 op(args.setARef(aVal)
1509 .setAIsActive(mValueMask.isOn(i))
1510 .setBRef(bVal)
1511 .setBIsActive(other.valueMask().isOn(i))
1512 .setResultRef(result));
1513 mValueMask.set(i, args.resultIsActive());
1514 mBuffer.mData.set(i, result);
1515 }
1516}
1517
1518
1519 template<Index Log2Dim>
1520 template<typename CombineOp>
1521 inline void
1522 LeafNode<bool, Log2Dim>::combine(bool value, bool valueIsActive, CombineOp& op)
1523{
1524 CombineArgs<bool> args;
1525 args.setBRef(value).setBIsActive(valueIsActive);
1526 for (Index i = 0; i < SIZE; ++i) {
1527 bool result = false, aVal = mBuffer.mData.isOn(i);
1528 op(args.setARef(aVal)
1529 .setAIsActive(mValueMask.isOn(i))
1530 .setResultRef(result));
1531 mValueMask.set(i, args.resultIsActive());
1532 mBuffer.mData.set(i, result);
1533 }
1534}
1535
1536
1537////////////////////////////////////////
1538
1539
1540 template<Index Log2Dim>
1541 template<typename CombineOp, typename OtherType>
1542 inline void
1543 LeafNode<bool, Log2Dim>::combine2(const LeafNode& other, const OtherType& value,
1544 bool valueIsActive, CombineOp& op)
1545{
1546 CombineArgs<bool, OtherType> args;
1547 args.setBRef(value).setBIsActive(valueIsActive);
1548 for (Index i = 0; i < SIZE; ++i) {
1549 bool result = false, aVal = other.mBuffer.mData.isOn(i);
1550 op(args.setARef(aVal)
1551 .setAIsActive(other.valueMask().isOn(i))
1552 .setResultRef(result));
1553 mValueMask.set(i, args.resultIsActive());
1554 mBuffer.mData.set(i, result);
1555 }
1556}
1557
1558
1559 template<Index Log2Dim>
1560 template<typename CombineOp, typename OtherNodeT>
1561 inline void
1562 LeafNode<bool, Log2Dim>::combine2(bool value, const OtherNodeT& other,
1563 bool valueIsActive, CombineOp& op)
1564{
1565 CombineArgs<bool, typename OtherNodeT::ValueType> args;
1566 args.setARef(value).setAIsActive(valueIsActive);
1567 for (Index i = 0; i < SIZE; ++i) {
1568 bool result = false, bVal = other.mBuffer.mData.isOn(i);
1569 op(args.setBRef(bVal)
1570 .setBIsActive(other.valueMask().isOn(i))
1571 .setResultRef(result));
1572 mValueMask.set(i, args.resultIsActive());
1573 mBuffer.mData.set(i, result);
1574 }
1575}
1576
1577
1578 template<Index Log2Dim>
1579 template<typename CombineOp, typename OtherNodeT>
1580 inline void
1581 LeafNode<bool, Log2Dim>::combine2(const LeafNode& b0, const OtherNodeT& b1, CombineOp& op)
1582{
1583 CombineArgs<bool, typename OtherNodeT::ValueType> args;
1584 for (Index i = 0; i < SIZE; ++i) {
1585 // Default behavior: output voxel is active if either input voxel is active.
1586 mValueMask.set(i, b0.valueMask().isOn(i) || b1.valueMask().isOn(i));
1587
1588 bool result = false, b0Val = b0.mBuffer.mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1589 op(args.setARef(b0Val)
1590 .setAIsActive(b0.valueMask().isOn(i))
1591 .setBRef(b1Val)
1592 .setBIsActive(b1.valueMask().isOn(i))
1593 .setResultRef(result));
1594 mValueMask.set(i, args.resultIsActive());
1595 mBuffer.mData.set(i, result);
1596 }
1597}
1598
1599
1600} // namespace tree
1601} // namespace OPENVDB_VERSION_NAME
1602} // namespace openvdb
1603
1604#endif // OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
Assert.h
OPENVDB_ASSERT
#define OPENVDB_ASSERT(X)
Definition Assert.h:41
Compression.h
Iterator.h
LeafNode.h
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
NodeMasks.h
OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_END
Definition Platform.h:164
OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
#define OPENVDB_NO_UNREACHABLE_CODE_WARNING_BEGIN
Definition Platform.h:163
OPENVDB_DEPRECATED_MESSAGE
#define OPENVDB_DEPRECATED_MESSAGE(msg)
Definition Platform.h:171
openvdb::v13_0::CombineArgs
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition Types.h:636
openvdb::v13_0::CombineArgs::setARef
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition Types.h:688
openvdb::v13_0::CombineArgs::setBIsActive
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition Types.h:704
openvdb::v13_0::CombineArgs::setResultRef
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition Types.h:692
openvdb::v13_0::CombineArgs::setBRef
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition Types.h:690
openvdb::v13_0::CombineArgs::resultIsActive
bool resultIsActive() const
Definition Types.h:699
openvdb::v13_0::CombineArgs::setAIsActive
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition Types.h:702
openvdb::v13_0::CoordBBox::createCube
static CoordBBox createCube(const Coord &min, ValueType dim)
Definition Coord.h:316
openvdb::v13_0::Coord::ValueType
Int32 ValueType
Definition Coord.h:33
openvdb::v13_0::PartialCreate
Tag dispatch class that distinguishes constructors during file input.
Definition Types.h:756
openvdb::v13_0::TopologyCopy
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition Types.h:750
openvdb::v13_0::math::CoordBBox
Axis-aligned bounding box of signed integer coordinates.
Definition Coord.h:252
openvdb::v13_0::math::CoordBBox::translate
void translate(const Coord &t)
Translate this bounding box by (tx, ty, tz).
Definition Coord.h:461
openvdb::v13_0::math::CoordBBox::expand
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition Coord.h:421
openvdb::v13_0::math::CoordBBox::min
const Coord & min() const
Definition Coord.h:324
openvdb::v13_0::math::CoordBBox::hasOverlap
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition Coord.h:415
openvdb::v13_0::math::CoordBBox::max
const Coord & max() const
Definition Coord.h:325
openvdb::v13_0::math::CoordBBox::isInside
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition Coord.h:403
openvdb::v13_0::math::CoordBBox::intersect
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition Coord.h:447
openvdb::v13_0::math::CoordBBox::reset
void reset()
Definition Coord.h:330
openvdb::v13_0::math::Coord
Signed (x, y, z) 32-bit integer coordinates.
Definition Coord.h:26
openvdb::v13_0::math::Coord::y
Int32 y() const
Definition Coord.h:132
openvdb::v13_0::math::Coord::x
Int32 x() const
Definition Coord.h:131
openvdb::v13_0::math::Coord::setZ
Coord & setZ(Int32 z)
Definition Coord.h:82
openvdb::v13_0::math::Coord::setY
Coord & setY(Int32 y)
Definition Coord.h:81
openvdb::v13_0::math::Coord::z
Int32 z() const
Definition Coord.h:133
openvdb::v13_0::math::Coord::setX
Coord & setX(Int32 x)
Definition Coord.h:80
openvdb::v13_0::tree::IteratorBase
Base class for iterators over internal and leaf nodes.
Definition Iterator.h:30
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter< MaskOnIter, LeafNode, const bool >::pos
Index pos() const
Definition Iterator.h:60
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter< MaskOnIter, LeafNode, const bool >::parent
LeafNode & parent() const
Definition Iterator.h:50
openvdb::v13_0::tree::LeafBuffer
Array of fixed size 23Log2Dim that stores the voxel values of a LeafNode.
Definition LeafBuffer.h:32
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::stealNodes
void stealNodes(ArrayT &, const ValueType &, bool)
Definition LeafNodeBool.h:550
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::operator=
LeafNode & operator=(const LeafNode &)=default
Deep assignment operator.
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueOn
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition LeafNodeBool.h:289
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::onTileCount
static Index64 onTileCount()
Definition LeafNodeBool.h:130
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getOrigin
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Definition LeafNodeBool.h:165
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::offsetToLocalCoord
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition LeafNodeBool.h:963
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cbeginChildOn
ChildOnCIter cbeginChildOn() const
Definition LeafNodeBool.h:698
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::BuildType
bool BuildType
Definition LeafNodeBool.h:33
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getNodeBoundingBox
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition LeafNodeBool.h:157
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueMask
NodeMaskType & getValueMask()
Definition LeafNodeBool.h:727
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOn
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition LeafNodeBool.h:259
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isChildMaskOn
bool isChildMaskOn(Index) const
Definition LeafNodeBool.h:729
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginChildOn
ChildOnCIter beginChildOn() const
Definition LeafNodeBool.h:699
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginChildOn
ChildOnIter beginChildOn()
Definition LeafNodeBool.h:700
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::nonLeafCount
static Index64 nonLeafCount()
Definition LeafNodeBool.h:122
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::operator==
bool operator==(const LeafNode &) const
Check for buffer equivalence by value.
Definition LeafNodeBool.h:1054
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueOn
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition LeafNodeBool.h:287
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endValueOn
ValueOnIter endValueOn()
Definition LeafNodeBool.h:688
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::NodeMaskType
util::NodeMask< Log2Dim > NodeMaskType
Definition LeafNodeBool.h:36
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isChildMaskOff
bool isChildMaskOff() const
Definition LeafNodeBool.h:731
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cbeginValueOff
ValueOffCIter cbeginValueOff() const
Definition LeafNodeBool.h:679
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::transientData
Index32 transientData() const
Return the transient data value.
Definition LeafNodeBool.h:177
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::Ptr
SharedPtr< LeafNodeType > Ptr
Definition LeafNodeBool.h:37
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getChildDim
static Index getChildDim()
Definition LeafNodeBool.h:115
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::leafCount
static Index64 leafCount()
Definition LeafNodeBool.h:117
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueMask
void setValueMask(const NodeMaskType &mask)
Definition LeafNodeBool.h:728
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endChildOn
ChildOnIter endChildOn()
Definition LeafNodeBool.h:710
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endValueAll
ValueAllIter endValueAll()
Definition LeafNodeBool.h:694
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::touchLeaf
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition LeafNodeBool.h:560
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeLeaf
LeafNode * probeLeaf(const Coord &)
Definition LeafNodeBool.h:563
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueMaskOff
bool isValueMaskOff() const
Definition LeafNodeBool.h:724
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LeafNode
LeafNode(const LeafNode< ValueType, Log2Dim > &other, bool offValue, bool onValue, TopologyCopy)
Topology copy constructors.
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::prune
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition LeafNodeBool.h:539
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueMaskOn
bool isValueMaskOn() const
Definition LeafNodeBool.h:722
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildAllCIter
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition LeafNodeBool.h:674
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::Buffer
LeafBuffer< ValueType, Log2Dim > Buffer
Definition LeafNodeBool.h:35
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getNodes
void getNodes(ArrayT &) const
Definition LeafNodeBool.h:549
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::mValueMask
NodeMaskType mValueMask
Bitmask that determines which voxels are active.
Definition LeafNodeBool.h:741
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValuesOff
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition LeafNodeBool.h:284
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endValueAll
ValueAllCIter endValueAll() const
Definition LeafNodeBool.h:693
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOnlyUnsafe
void setValueOnlyUnsafe(Index offset, const bool &value)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition LeafNodeBool.h:466
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildOnCIter
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition LeafNodeBool.h:670
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::onLeafVoxelCount
Index64 onLeafVoxelCount() const
Definition LeafNodeBool.h:128
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOnly
void setValueOnly(Index offset, bool val)
Set the value of the voxel at the given offset but don't change its active state.
Definition LeafNodeBool.h:244
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endChildOff
ChildOffCIter endChildOff() const
Definition LeafNodeBool.h:712
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cbeginValueAll
ValueAllCIter cbeginValueAll() const
Definition LeafNodeBool.h:682
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeNode
NodeT * probeNode(const Coord &)
Definition LeafNodeBool.h:546
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeValue
bool probeValue(const Coord &xyz, bool &val) const
Return true if the voxel at the given coordinates is active.
Definition LeafNodeBool.h:1169
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginValueOn
ValueOnCIter beginValueOn() const
Definition LeafNodeBool.h:677
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::denseFill
void denseFill(const CoordBBox &bbox, bool val, bool on=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition LeafNodeBool.h:304
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::evalNodeOrigin
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition LeafNodeBool.h:738
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::buffer
const Buffer & buffer() const
Definition LeafNodeBool.h:199
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeLeafAndCache
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Definition LeafNodeBool.h:565
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueMaskOn
void setValueMaskOn(Index n)
Definition LeafNodeBool.h:734
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::offLeafVoxelCount
Index64 offLeafVoxelCount() const
Definition LeafNodeBool.h:129
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeLeaf
const LeafNode * probeLeaf(const Coord &) const
Return a const pointer to this node.
Definition LeafNodeBool.h:577
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setOrigin
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition LeafNodeBool.h:160
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::origin
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition LeafNodeBool.h:163
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueLevel
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition LeafNodeBool.h:234
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::MaskOnIter
typename NodeMaskType::OnIterator MaskOnIter
Definition LeafNodeBool.h:597
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isInactive
bool isInactive() const
Return true if all of this node's values are inactive.
Definition LeafNodeBool.h:451
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::modifyValueAndActiveState
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition LeafNodeBool.h:1259
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::mBuffer
Buffer mBuffer
Bitmask representing the values of voxels.
Definition LeafNodeBool.h:743
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueOnCIter
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition LeafNodeBool.h:664
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueMaskOff
bool isValueMaskOff(Index n) const
Definition LeafNodeBool.h:723
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cendValueOn
ValueOnCIter cendValueOn() const
Definition LeafNodeBool.h:686
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isAllocated
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition LeafNodeBool.h:140
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueLevelAndCache
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition LeafNodeBool.h:411
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::numValues
static Index numValues()
Definition LeafNodeBool.h:112
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOffUnsafe
void setValueOffUnsafe(Index offset, const bool &value)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNodeBool.h:474
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setActiveStateUnsafe
void setActiveStateUnsafe(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value.
Definition LeafNodeBool.h:464
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginValueOff
ValueOffCIter beginValueOff() const
Definition LeafNodeBool.h:680
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueOffIter
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition LeafNodeBool.h:665
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cbeginChildAll
ChildAllCIter cbeginChildAll() const
Definition LeafNodeBool.h:704
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endChildOff
ChildOffIter endChildOff()
Definition LeafNodeBool.h:713
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::NUM_VOXELS
static const Index NUM_VOXELS
Definition LeafNodeBool.h:44
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginChildAll
ChildAllIter beginChildAll()
Definition LeafNodeBool.h:706
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getLevel
static Index getLevel()
Definition LeafNodeBool.h:113
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueUnsafe
bool getValueUnsafe(Index offset, bool &value) const
Return true if the voxel at the given offset is active and set value.
Definition LeafNodeBool.h:462
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueOnAndCache
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition LeafNodeBool.h:352
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::addLeaf
void addLeaf(LeafNode *)
Definition LeafNodeBool.h:540
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DIM
static const Index DIM
Definition LeafNodeBool.h:42
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setActiveState
void setActiveState(const Coord &xyz, bool on)
Set the active state of the voxel at the given coordinates but don't change its value.
Definition LeafNodeBool.h:1211
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginValueOn
ValueOnIter beginValueOn()
Definition LeafNodeBool.h:678
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::modifyValueAndCache
void modifyValueAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Apply a functor to the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNodeBool.h:377
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOffAndCache
void setValueOffAndCache(const Coord &xyz, bool value, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as inactive.
Definition LeafNodeBool.h:368
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildOffCIter
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition LeafNodeBool.h:672
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LEVEL
static const Index LEVEL
Definition LeafNodeBool.h:46
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeNodeAndCache
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Definition LeafNodeBool.h:567
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueAllIter
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition LeafNodeBool.h:667
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cbeginChildOff
ChildOffCIter cbeginChildOff() const
Definition LeafNodeBool.h:701
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginChildOff
ChildOffIter beginChildOff()
Definition LeafNodeBool.h:703
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isChildMaskOff
bool isChildMaskOff(Index) const
Definition LeafNodeBool.h:730
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::onVoxelCount
Index64 onVoxelCount() const
Return the number of active voxels.
Definition LeafNodeBool.h:125
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::MaskOffIter
typename NodeMaskType::OffIterator MaskOffIter
Definition LeafNodeBool.h:598
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginChildOff
ChildOffCIter beginChildOff() const
Definition LeafNodeBool.h:702
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::coordToOffset
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition LeafNodeBool.h:952
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LeafNode
LeafNode(const LeafNode< ValueType, Log2Dim > &other, bool background, TopologyCopy)
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::offTileCount
static Index64 offTileCount()
Definition LeafNodeBool.h:131
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOff
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition LeafNodeBool.h:247
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueType
bool ValueType
Definition LeafNodeBool.h:34
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endValueOff
ValueOffIter endValueOff()
Definition LeafNodeBool.h:691
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOff
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition LeafNodeBool.h:249
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeConstLeafAndCache
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Definition LeafNodeBool.h:582
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOnly
void setValueOnly(const Coord &xyz, bool val)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition LeafNodeBool.h:1203
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endChildAll
ChildAllCIter endChildAll() const
Definition LeafNodeBool.h:715
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::nodeCount
void nodeCount(std::vector< Index64 > &) const
no-op
Definition LeafNodeBool.h:119
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeConstNodeAndCache
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Definition LeafNodeBool.h:584
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cbeginValueOn
ValueOnCIter cbeginValueOn() const
Definition LeafNodeBool.h:676
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::log2dim
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition LeafNodeBool.h:108
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getNodeLog2Dims
static void getNodeLog2Dims(std::vector< Index > &dims)
Definition LeafNodeBool.h:114
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endChildOn
ChildOnCIter endChildOn() const
Definition LeafNodeBool.h:709
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeConstLeaf
const LeafNode * probeConstLeaf(const Coord &) const
Definition LeafNodeBool.h:580
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOnUnsafe
void setValueOnUnsafe(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition LeafNodeBool.h:468
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeValueAndCache
bool probeValueAndCache(const Coord &xyz, bool &val, AccessorT &) const
Return true if the voxel at the given coordinates is active and return the voxel value in val.
Definition LeafNodeBool.h:403
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cendChildOn
ChildOnCIter cendChildOn() const
Definition LeafNodeBool.h:708
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::hasActiveTiles
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition LeafNodeBool.h:296
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cendChildAll
ChildAllCIter cendChildAll() const
Definition LeafNodeBool.h:714
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueOnIter
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition LeafNodeBool.h:663
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOnlyAndCache
void setValueOnlyAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates but preserve its state.
Definition LeafNodeBool.h:363
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOnUnsafe
void setValueOnUnsafe(Index offset, const bool &value)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNodeBool.h:470
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildAllIter
DenseIter< LeafNode, bool > ChildAllIter
Definition LeafNodeBool.h:673
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endChildAll
ChildAllIter endChildAll()
Definition LeafNodeBool.h:716
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueMask
void setValueMask(Index n, bool on)
Definition LeafNodeBool.h:733
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::valueMask
const NodeMaskType & valueMask() const
Definition LeafNodeBool.h:726
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::offVoxelCount
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition LeafNodeBool.h:127
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::swap
void swap(Buffer &other)
Exchange this node's data buffer with the given data buffer without changing the active states of the...
Definition LeafNodeBool.h:198
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cendValueAll
ValueAllCIter cendValueAll() const
Definition LeafNodeBool.h:692
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildOnIter
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition LeafNodeBool.h:669
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LeafNode
friend class LeafNode
During topology-only construction, access is needed to protected/private members of other template in...
Definition LeafNodeBool.h:752
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::mTransientData
Index32 mTransientData
Transient data (not serialized).
Definition LeafNodeBool.h:747
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::NUM_VALUES
static const Index NUM_VALUES
Definition LeafNodeBool.h:43
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::negate
void negate()
Definition LeafNodeBool.h:478
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginChildAll
ChildAllCIter beginChildAll() const
Definition LeafNodeBool.h:705
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeLeafAndCache
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Definition LeafNodeBool.h:579
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setActiveStateAndCache
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &)
Set the active state of the voxel at the given coordinates without changing its value.
Definition LeafNodeBool.h:394
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getOrigin
void getOrigin(Coord &origin) const
Definition LeafNodeBool.h:164
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValue
const bool & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition LeafNodeBool.h:1150
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValuesOn
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition LeafNodeBool.h:282
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setTransientData
void setTransientData(Index32 transientData)
Set the transient data value.
Definition LeafNodeBool.h:179
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::size
static Index size()
Definition LeafNodeBool.h:111
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cendChildOff
ChildOffCIter cendChildOff() const
Definition LeafNodeBool.h:711
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueUnsafe
const bool & getValueUnsafe(Index offset) const
Return the value of the voxel at the given offset.
Definition LeafNodeBool.h:460
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::MaskDenseIter
typename NodeMaskType::DenseIterator MaskDenseIter
Definition LeafNodeBool.h:599
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LOG2DIM
static const Index LOG2DIM
Definition LeafNodeBool.h:40
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::SIZE
static const Index SIZE
Definition LeafNodeBool.h:45
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isEmpty
bool isEmpty() const
Return true if this node has no active voxels.
Definition LeafNodeBool.h:134
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueAndCache
void setValueAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as active.
Definition LeafNodeBool.h:357
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginValueOff
ValueOffIter beginValueOff()
Definition LeafNodeBool.h:681
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::probeConstNode
const NodeT * probeConstNode(const Coord &) const
Definition LeafNodeBool.h:548
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOn
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition LeafNodeBool.h:257
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::buffer
Buffer & buffer()
Definition LeafNodeBool.h:200
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setActiveState
void setActiveState(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value.
Definition LeafNodeBool.h:239
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::addTile
void addTile(Index level, const Coord &, bool val, bool active)
Definition LeafNodeBool.h:1121
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::allocate
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition LeafNodeBool.h:144
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueMask
const NodeMaskType & getValueMask() const
Definition LeafNodeBool.h:725
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getFirstValue
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition LeafNodeBool.h:416
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::TOTAL
static const Index TOTAL
Definition LeafNodeBool.h:41
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::addLeafAndCache
void addLeafAndCache(LeafNode *, AccessorT &)
Definition LeafNodeBool.h:542
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getLastValue
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition LeafNodeBool.h:420
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::modifyValue
void modifyValue(Index offset, const ModifyOp &op)
Apply a functor to the value of the voxel at the given offset and mark the voxel as active.
Definition LeafNodeBool.h:1238
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::cendValueOff
ValueOffCIter cendValueOff() const
Definition LeafNodeBool.h:689
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueAllCIter
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition LeafNodeBool.h:668
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::getValueAndCache
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition LeafNodeBool.h:347
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueMaskOff
void setValueMaskOff(Index n)
Definition LeafNodeBool.h:735
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isDense
bool isDense() const
Return true if this node only contains active voxels.
Definition LeafNodeBool.h:136
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endValueOff
ValueOffCIter endValueOff() const
Definition LeafNodeBool.h:690
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueOff
bool isValueOff(const Coord &xyz) const
Return true if the voxel at the given coordinates is inactive.
Definition LeafNodeBool.h:291
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::stealNode
NodeT * stealNode(const Coord &, const ValueType &, bool)
Definition LeafNodeBool.h:544
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValueOffUnsafe
void setValueOffUnsafe(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition LeafNodeBool.h:472
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::setValue
void setValue(const Coord &xyz, bool val)
Set the value of the voxel at the given coordinates and mark the voxel as active.
Definition LeafNodeBool.h:264
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::readBuffers
void readBuffers(std::istream &, bool fromHalf=false)
Read in the topology and the origin.
Definition LeafNodeBool.h:1022
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::endValueOn
ValueOnCIter endValueOn() const
Definition LeafNodeBool.h:687
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::voxelizeActiveTiles
void voxelizeActiveTiles(bool=true)
No-op.
Definition LeafNodeBool.h:486
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::modifyValueAndActiveStateAndCache
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition LeafNodeBool.h:385
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueOff
bool isValueOff(Index offset) const
Return true if the voxel at the given offset is inactive.
Definition LeafNodeBool.h:293
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::touchLeafAndCache
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Definition LeafNodeBool.h:562
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginValueAll
ValueAllCIter beginValueAll() const
Definition LeafNodeBool.h:683
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::mOrigin
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition LeafNodeBool.h:745
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::fill
void fill(const CoordBBox &bbox, bool value, bool active=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition LeafNodeBool.h:1398
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::dim
static Index dim()
Return the number of voxels in each dimension.
Definition LeafNodeBool.h:110
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LeafNodeType
LeafNode< bool, Log2Dim > LeafNodeType
Definition LeafNodeBool.h:32
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildOffIter
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition LeafNodeBool.h:671
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::clip
void clip(const CoordBBox &, bool background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition LeafNodeBool.h:1358
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueOffCIter
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition LeafNodeBool.h:666
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::isValueMaskOn
bool isValueMaskOn(Index n) const
Definition LeafNodeBool.h:721
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::beginValueAll
ValueAllIter beginValueAll()
Definition LeafNodeBool.h:684
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::LeafNode
LeafNode(const LeafNode< OtherValueType, Log2Dim > &other)
Value conversion copy constructor.
openvdb::v13_0::tree::LeafNode
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition LeafNode.h:39
openvdb::v13_0::tree::LeafNode::offsetToLocalCoord
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition LeafNode.h:1079
openvdb::v13_0::tree::LeafNode::writeTopology
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition LeafNode.h:1335
openvdb::v13_0::tree::LeafNode::copyToDense
void copyToDense(const CoordBBox &bbox, DenseT &dense) const
Copy into a dense grid the values of the voxels that lie within a given bounding box.
Definition LeafNode.h:1263
openvdb::v13_0::tree::LeafNode::operator!=
bool operator!=(const LeafNode &other) const
Definition LeafNode.h:204
openvdb::v13_0::tree::LeafNode::copyFromDense
void copyFromDense(const CoordBBox &bbox, const DenseT &dense, const ValueType &background, const ValueType &tolerance)
Copy from a dense grid into this node the values of the voxels that lie within a given bounding box.
Definition LeafNode.h:1290
openvdb::v13_0::tree::LeafNode::getValue
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition LeafNode.h:1104
openvdb::v13_0::tree::LeafNode::setValueOnly
void setValueOnly(const Coord &xyz, const ValueType &val)
Set the value of the voxel at the given coordinates but don't change its active state.
Definition LeafNode.h:1162
openvdb::v13_0::tree::LeafNode::topologyDifference
void topologyDifference(const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
Difference this node's set of active values with the active values of the other node,...
Definition LeafNode.h:1746
openvdb::v13_0::tree::LeafNode::medianOff
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition LeafNode.h:1602
openvdb::v13_0::tree::LeafNode::medianAll
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition LeafNode.h:1560
openvdb::v13_0::tree::LeafNode::~LeafNode
~LeafNode()
Destructor.
Definition LeafNode.h:1049
openvdb::v13_0::tree::LeafNode::readTopology
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition LeafNode.h:1327
openvdb::v13_0::tree::LeafNode::medianOn
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition LeafNode.h:1578
openvdb::v13_0::tree::LeafNode::addTile
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition LeafNode.h:1629
openvdb::v13_0::tree::LeafNode::resetBackground
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition LeafNode.h:1658
openvdb::v13_0::tree::LeafNode::modifyValueAndActiveState
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition LeafNode.h:488
openvdb::v13_0::tree::LeafNode::topologyIntersection
void topologyIntersection(const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
Intersect this node's set of active values with the active values of the other node,...
Definition LeafNode.h:1737
openvdb::v13_0::tree::LeafNode::clip
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition LeafNode.h:1180
openvdb::v13_0::tree::LeafNode::setActiveState
void setActiveState(const Coord &xyz, bool on)
Set the active state of the voxel at the given coordinates but don't change its value.
Definition LeafNode.h:1154
openvdb::v13_0::tree::LeafNode::topologyUnion
void topologyUnion(const LeafNode< OtherType, Log2Dim > &other, const bool preserveTiles=false)
Union this node's set of active values with the active values of the other node, whose ValueType may ...
Definition LeafNode.h:1729
openvdb::v13_0::tree::LeafNode::coordToOffset
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition LeafNode.h:1069
openvdb::v13_0::tree::LeafNode::setValueOff
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition LeafNode.h:439
openvdb::v13_0::tree::LeafNode::hasSameTopology
bool hasSameTopology(const LeafNode< OtherType, OtherLog2Dim > *other) const
Return true if the given node (which may have a different ValueType than this node) has the same acti...
Definition LeafNode.h:1516
openvdb::v13_0::tree::LeafNode::writeBuffers
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition LeafNode.h:1451
openvdb::v13_0::tree::LeafNode::combine
void combine(const LeafNode &other, CombineOp &op)
Definition LeafNode.h:1770
openvdb::v13_0::tree::LeafNode::memUsageIfLoaded
Index64 memUsageIfLoaded() const
Definition LeafNode.h:1488
openvdb::v13_0::tree::LeafNode::combine2
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition LeafNode.h:1810
openvdb::v13_0::tree::LeafNode::fill
void fill(const CoordBBox &bbox, const ValueType &, bool active=true)
Set all voxels within an axis-aligned box to the specified value and active state.
Definition LeafNode.h:1220
openvdb::v13_0::tree::LeafNode::valueMask
const NodeMaskType & valueMask() const
Definition LeafNode.h:915
openvdb::v13_0::tree::LeafNode::readBuffers
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition LeafNode.h:1363
openvdb::v13_0::tree::LeafNode::isConstant
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition LeafNode.h:1524
openvdb::v13_0::tree::LeafNode::LeafNode
friend class LeafNode
Definition LeafNode.h:892
openvdb::v13_0::tree::LeafNode::offsetToGlobalCoord
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition LeafNode.h:1093
openvdb::v13_0::tree::LeafNode::operator==
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition LeafNode.h:1468
openvdb::v13_0::tree::LeafNode::evalActiveBoundingBox
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition LeafNode.h:1498
openvdb::v13_0::tree::LeafNode::merge
void merge(const LeafNode &)
Definition LeafNode.h:1680
openvdb::v13_0::tree::LeafNode::setValueOn
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition LeafNode.h:449
openvdb::v13_0::tree::LeafNode::getValueMask
const NodeMaskType & getValueMask() const
Definition LeafNode.h:913
openvdb::v13_0::tree::LeafNode::addTileAndCache
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition LeafNode.h:1646
openvdb::v13_0::tree::LeafNode::modifyValue
void modifyValue(Index offset, const ModifyOp &op)
Apply a functor to the value of the voxel at the given offset and mark the voxel as active.
Definition LeafNode.h:467
openvdb::v13_0::tree::LeafNode::memUsage
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition LeafNode.h:1478
openvdb::v13_0::tree::LeafNode::str
std::string str() const
Return a string representation of this node.
Definition LeafNode.h:1056
openvdb::v13_0::tree::LeafNode::probeValue
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition LeafNode.h:1120
openvdb::v13_0::util::NodeMask
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation.
Definition NodeMasks.h:308
openvdb::v13_0::util::NodeMask::countOn
Index32 countOn() const
Return the total number of on bits.
Definition NodeMasks.h:443
openvdb::v13_0::util::NodeMask::beginOn
OnIterator beginOn() const
Definition NodeMasks.h:352
openvdb::v13_0::util::NodeMask::beginOff
OffIterator beginOff() const
Definition NodeMasks.h:354
openvdb::v13_0::util::NodeMask::DenseIterator
DenseMaskIterator< NodeMask > DenseIterator
Definition NodeMasks.h:350
openvdb::v13_0::util::NodeMask::isOn
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition NodeMasks.h:502
openvdb::v13_0::util::NodeMask::OnIterator
OnMaskIterator< NodeMask > OnIterator
Definition NodeMasks.h:348
openvdb::v13_0::util::NodeMask::setOn
void setOn(Index32 n)
Set the nth bit on.
Definition NodeMasks.h:452
openvdb::v13_0::util::NodeMask::OffIterator
OffMaskIterator< NodeMask > OffIterator
Definition NodeMasks.h:349
openvdb::v13_0::io::checkFormatVersion
OPENVDB_API void checkFormatVersion(std::ios_base &)
Throws an IoError if the file format version number is not supported.
openvdb::v13_0::io::getGridBackgroundValuePtr
OPENVDB_API const void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
openvdb::v13_0::math::isZero
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition Math.h:350
openvdb::v13_0::tree::iter
Definition TreeIterator.h:30
openvdb::v13_0::Index
Index32 Index
Definition Types.h:34
openvdb::v13_0::zeroVal
constexpr T zeroVal()
Return the value of type T that corresponds to zero.
Definition Math.h:71
openvdb::v13_0::Index32
uint32_t Index32
Definition Types.h:32
openvdb::v13_0::Int32
int32_t Int32
Definition Types.h:36
openvdb::v13_0::Index64
uint64_t Index64
Definition Types.h:33
openvdb::v13_0::SharedPtr
std::shared_ptr< T > SharedPtr
Definition Types.h:95
openvdb::v13_0::MERGE_NODES
@ MERGE_NODES
Definition Types.h:575
openvdb::v13_0::MERGE_ACTIVE_STATES_AND_NODES
@ MERGE_ACTIVE_STATES_AND_NODES
Definition Types.h:576
openvdb
Definition Exceptions.h:13
std
Definition Coord.h:590
Types.h
openvdb::v13_0::tree::DenseIteratorBase< MaskDenseIter, DenseIter, NodeT, void, ValueT >::NonConstValueType
typename std::remove_const< ValueT >::type NonConstValueType
Definition Iterator.h:184
openvdb::v13_0::tree::DenseIteratorBase< MaskDenseIter, DenseIter< NodeT, ValueT >, NodeT, void, ValueT >::DenseIteratorBase
DenseIteratorBase()
Definition Iterator.h:188
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildIter
Leaf nodes have no children, so their child iterators have no get/set accessors.
Definition LeafNodeBool.h:632
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildIter::ChildIter
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNodeBool.h:634
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ChildIter::ChildIter
ChildIter()
Definition LeafNodeBool.h:633
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter
Definition LeafNodeBool.h:641
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter::getItem
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition LeafNodeBool.h:648
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter::DenseIter
DenseIter()
Definition LeafNodeBool.h:645
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter::DenseIter
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition LeafNodeBool.h:646
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter::NonConstValueT
typename BaseT::NonConstValueType NonConstValueT
Definition LeafNodeBool.h:643
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter::BaseT
DenseIteratorBase< MaskDenseIter, DenseIter, NodeT, void, ValueT > BaseT
Definition LeafNodeBool.h:642
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::DenseIter::unsetItem
void unsetItem(Index pos, const ValueT &val) const
Definition LeafNodeBool.h:659
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::SameConfiguration
SameConfiguration<OtherNodeType>::value is true if and only if OtherNodeType is the type of a LeafNod...
Definition LeafNodeBool.h:56
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::SameConfiguration::value
static const bool value
Definition LeafNodeBool.h:57
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueConverter
ValueConverter<T>::Type is the type of a LeafNode having the same dimensions as this node but a diffe...
Definition LeafNodeBool.h:51
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueConverter::Type
LeafNode< ValueType, Log2Dim > Type
Definition LeafNodeBool.h:51
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter
Definition LeafNodeBool.h:606
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::setItem
void setItem(Index pos, bool value) const
Definition LeafNodeBool.h:616
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::modifyValue
void modifyValue(const ModifyOp &op) const
Definition LeafNodeBool.h:625
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::ValueIter
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition LeafNodeBool.h:610
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::getValue
const bool & getValue() const
Definition LeafNodeBool.h:613
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::getItem
const bool & getItem(Index pos) const
Definition LeafNodeBool.h:612
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::ValueIter
ValueIter()
Definition LeafNodeBool.h:609
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::setValue
void setValue(bool value) const
Definition LeafNodeBool.h:618
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::modifyItem
void modifyItem(Index n, const ModifyOp &op) const
Definition LeafNodeBool.h:622
openvdb::v13_0::tree::LeafNode< bool, Log2Dim >::ValueIter::BaseT
SparseIteratorBase< MaskIterT, ValueIter, NodeT, ValueT > BaseT
Definition LeafNodeBool.h:607
openvdb::v13_0::tree::SameLeafConfig::value
static const bool value
Definition LeafNode.h:949
openvdb::v13_0::tree::SparseIteratorBase< MaskIterT, ValueIter< MaskIterT, NodeT, ValueT >, NodeT, ValueT >::SparseIteratorBase
SparseIteratorBase()
Definition Iterator.h:122
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218