Go to the documentation of this file.
4 #ifndef OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
5 #define OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
16 #include <type_traits>
27 template<Index Log2Dim>
39 static const Index LOG2DIM = Log2Dim;
40 static const Index TOTAL = Log2Dim;
41 static const Index DIM = 1 << TOTAL;
42 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
43 static const Index NUM_VOXELS = NUM_VALUES;
44 static const Index SIZE = NUM_VALUES;
49 template<
typename ValueType>
54 template<
typename OtherNodeType>
55 struct SameConfiguration {
67 explicit LeafNode(
const Coord& xyz,
bool value =
false,
bool active =
false);
79 template<
typename OtherValueType>
83 template<
typename ValueType>
87 template<
typename ValueType>
91 template<
typename ValueType>
126 bool isEmpty()
const {
return mValueMask.isOff(); }
128 bool isDense()
const {
return mValueMask.isOn(); }
144 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
153 const Coord& origin()
const {
return mOrigin; }
168 std::string str()
const;
172 template<
typename OtherType, Index OtherLog2Dim>
192 void readTopology(std::istream&,
bool fromHalf =
false);
194 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
197 void readBuffers(std::istream&,
bool fromHalf =
false);
198 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
200 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
206 const bool& getValue(
const Coord& xyz)
const;
208 const bool& getValue(
Index offset)
const;
213 bool probeValue(
const Coord& xyz,
bool& val)
const;
219 void setActiveState(
const Coord& xyz,
bool on);
224 void setValueOnly(
const Coord& xyz,
bool val);
226 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
234 void setValueOff(
const Coord& xyz,
bool val);
236 void setValueOff(
Index offset,
bool val);
244 void setValueOn(
const Coord& xyz,
bool val);
248 void setValueOn(
Index offset,
bool val);
252 template<
typename ModifyOp>
253 void modifyValue(
Index offset,
const ModifyOp& op);
256 template<
typename ModifyOp>
257 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
260 template<
typename ModifyOp>
261 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
269 bool isValueOn(
const Coord& xyz)
const {
return mValueMask.isOn(this->coordToOffset(xyz)); }
271 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mValueMask.isOn(offset); }
280 void fill(
const CoordBBox& bbox,
bool value,
bool active =
true);
285 void fill(
const bool& value);
287 void fill(
const bool& value,
bool active);
300 template<
typename DenseT>
319 template<
typename DenseT>
324 template<
typename AccessorT>
329 template<
typename AccessorT>
334 template<
typename AccessorT>
340 template<
typename AccessorT>
345 template<
typename AccessorT>
348 this->setValueOff(xyz, value);
354 template<
typename ModifyOp,
typename AccessorT>
357 this->modifyValue(xyz, op);
362 template<
typename ModifyOp,
typename AccessorT>
365 this->modifyValueAndActiveState(xyz, op);
371 template<
typename AccessorT>
374 this->setActiveState(xyz, on);
380 template<
typename AccessorT>
383 return this->probeValue(xyz, val);
388 template<
typename AccessorT>
394 const bool&
getFirstValue()
const {
if (mValueMask.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
398 const bool&
getLastValue()
const {
if (mValueMask.isOn(SIZE-1))
return Buffer::sOn;
else return Buffer::sOff; }
403 bool isConstant(
bool& constValue,
bool& state,
bool tolerance = 0)
const;
410 bool medianAll()
const;
418 Index medianOn(ValueType &value)
const;
426 Index medianOff(ValueType &value)
const;
431 void resetBackground(
bool oldBackground,
bool newBackground);
433 void negate() { mBuffer.mData.toggle(); }
435 template<MergePolicy Policy>
436 void merge(
const LeafNode& other,
bool bg =
false,
bool otherBG =
false);
437 template<MergePolicy Policy>
void merge(
bool tileValue,
bool tileActive);
449 template<
typename OtherType>
463 template<
typename OtherType>
477 template<
typename OtherType>
480 template<
typename CombineOp>
481 void combine(
const LeafNode& other, CombineOp& op);
482 template<
typename CombineOp>
483 void combine(
bool,
bool valueIsActive, CombineOp& op);
485 template<
typename CombineOp,
typename OtherType >
486 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
487 template<
typename CombineOp,
typename OtherNodeT >
488 void combine2(
bool,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
489 template<
typename CombineOp,
typename OtherNodeT >
490 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
496 template<
typename BBoxOp>
void visitActiveBBox(BBoxOp&)
const;
498 template<
typename VisitorOp>
void visit(VisitorOp&);
499 template<
typename VisitorOp>
void visit(VisitorOp&)
const;
501 template<
typename OtherLeafNodeType,
typename VisitorOp>
502 void visit2Node(OtherLeafNodeType& other, VisitorOp&);
503 template<
typename OtherLeafNodeType,
typename VisitorOp>
504 void visit2Node(OtherLeafNodeType& other, VisitorOp&)
const;
505 template<
typename IterT,
typename VisitorOp>
506 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false);
507 template<
typename IterT,
typename VisitorOp>
508 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false)
const;
511 void prune(
const ValueType& = zeroVal<ValueType>()) {}
514 template<
typename AccessorT>
516 template<
typename NodeT>
518 template<
typename NodeT>
520 template<
typename NodeT>
522 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
526 void addTile(
Index level,
const Coord&,
bool val,
bool active);
527 void addTile(
Index offset,
bool val,
bool active);
528 template<
typename AccessorT>
529 void addTileAndCache(
Index level,
const Coord&,
bool val,
bool active, AccessorT&);
534 template<
typename AccessorT>
537 template<
typename AccessorT>
539 template<
typename NodeT,
typename AccessorT>
543 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
544 return reinterpret_cast<NodeT*>(
this);
549 const LeafNode* probeLeaf(
const Coord&)
const {
return this; }
551 template<
typename AccessorT>
554 template<
typename AccessorT>
556 template<
typename NodeT,
typename AccessorT>
560 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
561 return reinterpret_cast<const NodeT*>(
this);
574 template<
typename MaskIterT,
typename NodeT,
typename ValueT>
578 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
585 const bool&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
586 const bool&
getValue()
const {
return this->getItem(this->pos()); }
589 void setItem(
Index pos,
bool value)
const { this->parent().setValueOnly(pos, value); }
591 void setValue(
bool value)
const { this->setItem(this->pos(), value); }
594 template<
typename ModifyOp>
595 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
597 template<
typename ModifyOp>
598 void modifyValue(
const ModifyOp& op)
const { this->modifyItem(this->pos(), op); }
602 template<
typename MaskIterT,
typename NodeT>
608 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
611 template<
typename NodeT,
typename ValueT>
613 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
623 value = this->parent().getValue(pos);
632 void unsetItem(
Index pos,
const ValueT& val)
const {this->parent().setValueOnly(pos, val);}
637 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
713 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
714 static inline void doVisit(NodeT&, VisitorOp&);
716 template<
typename NodeT,
typename OtherNodeT,
typename VisitorOp,
717 typename ChildAllIterT,
typename OtherChildAllIterT>
718 static inline void doVisit2Node(NodeT&
self, OtherNodeT& other, VisitorOp&);
720 template<
typename NodeT,
typename VisitorOp,
721 typename ChildAllIterT,
typename OtherChildAllIterT>
722 static inline void doVisit2(NodeT&
self, OtherChildAllIterT&, VisitorOp&,
bool otherIsLHS);
758 template<Index Log2Dim>
766 template<Index Log2Dim>
771 , mOrigin(xyz & (~(DIM - 1)))
776 template<Index Log2Dim>
781 , mOrigin(xyz & (~(DIM - 1)))
789 template<Index Log2Dim>
792 : mValueMask(other.valueMask())
793 , mBuffer(other.mBuffer)
794 , mOrigin(other.mOrigin)
800 template<Index Log2Dim>
801 template<
typename ValueT>
804 : mValueMask(other.valueMask())
805 , mOrigin(other.origin())
809 static inline bool convertValue(
const ValueT& val) {
return bool(val); }
813 mBuffer.
setValue(i, Local::convertValue(other.mBuffer[i]));
818 template<Index Log2Dim>
819 template<
typename ValueT>
822 bool background, TopologyCopy)
823 : mValueMask(other.valueMask())
824 , mBuffer(background)
825 , mOrigin(other.origin())
830 template<Index Log2Dim>
831 template<
typename ValueT>
834 : mValueMask(other.valueMask())
835 , mBuffer(other.valueMask())
836 , mOrigin(other.origin())
841 template<Index Log2Dim>
842 template<
typename ValueT>
845 bool offValue,
bool onValue, TopologyCopy)
846 : mValueMask(other.valueMask())
847 , mBuffer(other.valueMask())
848 , mOrigin(other.origin())
850 if (offValue) {
if (!onValue) mBuffer.
mData.toggle();
else mBuffer.
mData.setOn(); }
854 template<Index Log2Dim>
864 template<Index Log2Dim>
869 return sizeof(*this);
873 template<Index Log2Dim>
878 if (bbox.
isInside(this_bbox))
return;
882 for(; iter; ++iter) this_bbox.
expand(this->offsetToLocalCoord(iter.pos()));
890 template<Index Log2Dim>
891 template<
typename OtherType, Index OtherLog2Dim>
896 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
900 template<Index Log2Dim>
904 std::ostringstream ostr;
905 ostr <<
"LeafNode @" << mOrigin <<
": ";
906 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mValueMask.
isOn(n) ?
'#' :
'.');
914 template<Index Log2Dim>
918 assert ((xyz[0] & (
DIM-1u)) <
DIM && (xyz[1] & (
DIM-1u)) <
DIM && (xyz[2] & (
DIM-1u)) <
DIM);
919 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
920 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
921 + (xyz[2] & (
DIM-1u));
925 template<Index Log2Dim>
929 assert(n < (1 << 3*Log2Dim));
931 xyz.
setX(n >> 2*Log2Dim);
932 n &= ((1 << 2*Log2Dim) - 1);
933 xyz.
setY(n >> Log2Dim);
934 xyz.
setZ(n & ((1 << Log2Dim) - 1));
939 template<Index Log2Dim>
950 template<Index Log2Dim>
958 template<Index Log2Dim>
966 template<Index Log2Dim>
976 bool background =
false;
978 background = *static_cast<const bool*>(bgPtr);
980 this->
clip(clipBBox, background);
984 template<Index Log2Dim>
995 mBuffer.
mData.load(is);
1000 int8_t numBuffers = 0;
1001 is.read(reinterpret_cast<char*>(&numBuffers),
sizeof(int8_t));
1005 std::unique_ptr<bool[]> buf{
new bool[
SIZE]};
1006 io::readData<bool>(is, buf.get(),
SIZE,
true);
1009 mBuffer.
mData.setOff();
1011 if (buf[i]) mBuffer.
mData.setOn(i);
1014 if (numBuffers > 1) {
1017 for (
int i = 1; i < numBuffers; ++i) {
1018 io::readData<bool>(is, buf.get(),
SIZE,
true);
1025 template<Index Log2Dim>
1030 mValueMask.
save(os);
1032 os.write(reinterpret_cast<const char*>(&mOrigin),
sizeof(
Coord::ValueType) * 3);
1034 mBuffer.
mData.save(os);
1041 template<Index Log2Dim>
1045 return mOrigin == other.mOrigin &&
1047 mBuffer == other.mBuffer;
1051 template<Index Log2Dim>
1062 template<Index Log2Dim>
1066 if (!mValueMask.
isConstant(state))
return false;
1069 if (!tolerance && !(mBuffer.
mData.isOn() || mBuffer.
mData.isOff()))
return false;
1071 constValue = mBuffer.
mData.isOn();
1077 template<Index Log2Dim>
1081 const Index countTrue = mBuffer.
mData.countOn();
1085 template<Index Log2Dim>
1095 template<Index Log2Dim>
1108 template<Index Log2Dim>
1115 template<Index Log2Dim>
1119 assert(offset <
SIZE);
1124 template<Index Log2Dim>
1125 template<
typename AccessorT>
1128 bool val,
bool active, AccessorT&)
1130 this->
addTile(level, xyz, val, active);
1137 template<Index Log2Dim>
1142 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1146 template<Index Log2Dim>
1150 assert(offset <
SIZE);
1152 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1156 template<Index Log2Dim>
1161 val = mBuffer.
mData.isOn(offset);
1162 return mValueMask.
isOn(offset);
1166 template<Index Log2Dim>
1174 template<Index Log2Dim>
1178 assert(offset <
SIZE);
1179 mValueMask.
setOn(offset);
1180 mBuffer.
mData.set(offset, val);
1184 template<Index Log2Dim>
1192 template<Index Log2Dim>
1200 template<Index Log2Dim>
1208 template<Index Log2Dim>
1212 assert(offset <
SIZE);
1213 mValueMask.
setOff(offset);
1214 mBuffer.
mData.set(offset, val);
1218 template<Index Log2Dim>
1219 template<
typename ModifyOp>
1223 bool val = mBuffer.
mData.isOn(offset);
1225 mBuffer.
mData.set(offset, val);
1226 mValueMask.
setOn(offset);
1230 template<Index Log2Dim>
1231 template<
typename ModifyOp>
1239 template<Index Log2Dim>
1240 template<
typename ModifyOp>
1245 bool val = mBuffer.
mData.isOn(offset), state = mValueMask.
isOn(offset);
1247 mBuffer.
mData.set(offset, val);
1248 mValueMask.
set(offset, state);
1255 template<Index Log2Dim>
1259 if (newBackground != oldBackground) {
1263 mBuffer.
mData = (mBuffer.
mData & mValueMask) | bgMask;
1271 template<Index Log2Dim>
1272 template<MergePolicy Policy>
1279 const Index n = iter.pos();
1280 if (mValueMask.
isOff(n)) {
1281 mBuffer.
mData.set(n, other.mBuffer.
mData.isOn(n));
1282 mValueMask.
setOn(n);
1288 template<Index Log2Dim>
1289 template<MergePolicy Policy>
1295 if (!tileActive)
return;
1297 if (tileValue) mBuffer.
mData |= !mValueMask;
1298 else mBuffer.
mData &= mValueMask;
1307 template<Index Log2Dim>
1308 template<
typename OtherType>
1316 template<Index Log2Dim>
1317 template<
typename OtherType>
1326 template<Index Log2Dim>
1327 template<
typename OtherType>
1339 template<Index Log2Dim>
1346 this->
fill(nodeBBox, background,
false);
1347 }
else if (clipBBox.
isInside(nodeBBox)) {
1359 int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
1360 for (x = nodeBBox.
min().
x(); x <= nodeBBox.
max().
x(); ++x) {
1361 for (y = nodeBBox.
min().
y(); y <= nodeBBox.
max().
y(); ++y) {
1362 for (z = nodeBBox.
min().
z(); z <= nodeBBox.
max().
z(); ++z) {
1379 template<Index Log2Dim>
1384 clippedBBox.intersect(bbox);
1385 if (!clippedBBox)
return;
1387 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1388 const Index offsetX = (x & (
DIM-1u))<<2*Log2Dim;
1389 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1390 const Index offsetXY = offsetX + ((y & (
DIM-1u))<< Log2Dim);
1391 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1392 const Index offset = offsetXY + (z & (
DIM-1u));
1393 mValueMask.
set(offset, active);
1394 mBuffer.
mData.set(offset, value);
1400 template<Index Log2Dim>
1404 mBuffer.
fill(value);
1407 template<Index Log2Dim>
1411 mBuffer.
fill(value);
1412 mValueMask.
set(active);
1419 template<Index Log2Dim>
1420 template<
typename DenseT>
1424 using DenseValueType =
typename DenseT::ValueType;
1426 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1427 const Coord&
min = dense.bbox().min();
1428 DenseValueType* t0 = dense.data() + zStride * (bbox.
min()[2] -
min[2]);
1430 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1431 DenseValueType* t1 = t0 + xStride * (x -
min[0]);
1433 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1434 DenseValueType* t2 = t1 + yStride * (y -
min[1]);
1436 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2] + 1; z < ez; ++z, t2 += zStride) {
1437 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1444 template<Index Log2Dim>
1445 template<
typename DenseT>
1448 bool background,
bool tolerance)
1450 using DenseValueType =
typename DenseT::ValueType;
1452 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1455 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1456 const Coord&
min = dense.bbox().min();
1457 const DenseValueType* s0 = dense.data() + zStride * (bbox.
min()[2] -
min[2]);
1459 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1460 const DenseValueType* s1 = s0 + xStride * (x -
min[0]);
1462 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1463 const DenseValueType* s2 = s1 + yStride * (y -
min[1]);
1465 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1467 if (tolerance || (background == Local::toBool(*s2))) {
1469 mBuffer.
mData.set(n2, background);
1471 mValueMask.
setOn(n2);
1472 mBuffer.
mData.set(n2, Local::toBool(*s2));
1483 template<Index Log2Dim>
1484 template<
typename CombineOp>
1490 bool result =
false, aVal = mBuffer.
mData.isOn(i), bVal = other.mBuffer.
mData.isOn(i);
1492 .setAIsActive(mValueMask.
isOn(i))
1495 .setResultRef(result));
1497 mBuffer.
mData.set(i, result);
1502 template<Index Log2Dim>
1503 template<
typename CombineOp>
1508 args.
setBRef(value).setBIsActive(valueIsActive);
1510 bool result =
false, aVal = mBuffer.
mData.isOn(i);
1512 .setAIsActive(mValueMask.
isOn(i))
1513 .setResultRef(result));
1515 mBuffer.
mData.set(i, result);
1523 template<Index Log2Dim>
1524 template<
typename CombineOp,
typename OtherType>
1527 bool valueIsActive, CombineOp& op)
1530 args.
setBRef(value).setBIsActive(valueIsActive);
1532 bool result =
false, aVal = other.mBuffer.
mData.isOn(i);
1535 .setResultRef(result));
1537 mBuffer.
mData.set(i, result);
1542 template<Index Log2Dim>
1543 template<
typename CombineOp,
typename OtherNodeT>
1546 bool valueIsActive, CombineOp& op)
1549 args.
setARef(value).setAIsActive(valueIsActive);
1551 bool result =
false, bVal = other.mBuffer.mData.isOn(i);
1553 .setBIsActive(other.valueMask().isOn(i))
1554 .setResultRef(result));
1556 mBuffer.
mData.set(i, result);
1561 template<Index Log2Dim>
1562 template<
typename CombineOp,
typename OtherNodeT>
1571 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1575 .setBIsActive(b1.valueMask().isOn(i))
1576 .setResultRef(result));
1578 mBuffer.
mData.set(i, result);
1585 template<Index Log2Dim>
1586 template<
typename BBoxOp>
1590 if (op.template descent<LEVEL>()) {
1608 template<Index Log2Dim>
1609 template<
typename VisitorOp>
1613 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1617 template<Index Log2Dim>
1618 template<
typename VisitorOp>
1622 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1626 template<Index Log2Dim>
1627 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1631 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1640 template<Index Log2Dim>
1641 template<
typename OtherLeafNodeType,
typename VisitorOp>
1646 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1650 template<Index Log2Dim>
1651 template<
typename OtherLeafNodeType,
typename VisitorOp>
1656 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1660 template<Index Log2Dim>
1663 typename OtherNodeT,
1665 typename ChildAllIterT,
1666 typename OtherChildAllIterT>
1671 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1672 "can't visit nodes of different sizes simultaneously");
1673 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1674 "can't visit nodes at different tree levels simultaneously");
1676 ChildAllIterT iter =
self.beginChildAll();
1677 OtherChildAllIterT otherIter = other.beginChildAll();
1679 for ( ; iter && otherIter; ++iter, ++otherIter) {
1680 op(iter, otherIter);
1688 template<Index Log2Dim>
1689 template<
typename IterT,
typename VisitorOp>
1693 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1697 template<Index Log2Dim>
1698 template<
typename IterT,
typename VisitorOp>
1702 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1706 template<Index Log2Dim>
1710 typename ChildAllIterT,
1711 typename OtherChildAllIterT>
1714 VisitorOp& op,
bool otherIsLHS)
1716 if (!otherIter)
return;
1719 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1720 op(otherIter, iter);
1723 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1724 op(iter, otherIter);
1733 #endif // OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition: Coord.h:418
bool isValueMaskOff() const
Definition: LeafNodeBool.h:697
static Index numValues()
Definition: LeafNodeBool.h:106
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:286
Coord & setY(Int32 y)
Definition: Coord.h:81
LeafNode * probeLeaf(const Coord &)
Definition: LeafNodeBool.h:536
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:583
static Index getLevel()
Definition: LeafNodeBool.h:107
ValueOnIter endValueOn()
Definition: LeafNodeBool.h:661
ChildOnCIter endChildOn() const
Definition: LeafNodeBool.h:682
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:448
void nodeCount(std::vector< Index32 > &) const
no-op
Definition: LeafNodeBool.h:113
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeBool.h:632
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:607
void merge(const LeafNode &)
Definition: LeafNode.h:1630
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition: LeafNode.h:1036
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeBool.h:644
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeBool.h:570
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:443
void getOrigin(Coord &origin) const
Definition: LeafNodeBool.h:155
void negate()
Definition: LeafNodeBool.h:433
ValueOnCIter cbeginValueOn() const
Definition: LeafNodeBool.h:649
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:1467
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNodeBool.h:132
void setValueMaskOn(Index n)
Definition: LeafNodeBool.h:707
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:381
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeBool.h:671
bool isConstant(bool &isOn) const
Definition: NodeMasks.h:507
ChildOnCIter beginChildOn() const
Definition: LeafNodeBool.h:672
OnIterator beginOn() const
Definition: NodeMasks.h:333
Buffer & buffer()
Definition: LeafNodeBool.h:186
static Index32 nonLeafCount()
Definition: LeafNodeBool.h:114
ChildAllIter beginChildAll()
Definition: LeafNodeBool.h:679
void stealNodes(ArrayT &, const ValueType &, bool)
Definition: LeafNodeBool.h:523
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition: LeafNodeBool.h:148
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:193
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeBool.h:104
const LeafNode * probeConstLeaf(const Coord &) const
Definition: LeafNodeBool.h:553
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1475
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeBool.h:271
void setValue(bool value) const
Definition: LeafNodeBool.h:591
const bool & getItem(Index pos) const
Definition: LeafNodeBool.h:585
static const Index SIZE
Definition: LeafNode.h:53
ChildOnIter endChildOn()
Definition: LeafNodeBool.h:683
Int32 ValueType
Definition: Coord.h:33
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:170
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1948
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:1220
void load(std::istream &is)
Definition: NodeMasks.h:550
Definition: PointDataGrid.h:174
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1580
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1924
const Buffer & buffer() const
Definition: LeafNodeBool.h:185
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeBool.h:239
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:1177
Coord & setZ(Int32 z)
Definition: Coord.h:82
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1292
ChildOffCIter beginChildOff() const
Definition: LeafNodeBool.h:675
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:433
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:399
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeBool.h:621
bool isChildMaskOff() const
Definition: LeafNodeBool.h:704
DenseIter()
Definition: LeafNodeBool.h:618
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeBool.h:571
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeBool.h:363
NodeMaskType mValueMask
Bitmask that determines which voxels are active.
Definition: LeafNodeBool.h:726
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:1696
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1876
Int32 y() const
Definition: Coord.h:132
static const Index LOG2DIM
Definition: LeafNode.h:48
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeBool.h:126
const NodeMaskType & getValueMask() const
Definition: LeafNodeBool.h:698
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:282
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeBool.h:711
static const Index NUM_VALUES
Definition: LeafNode.h:51
const NodeMaskType & valueMask() const
Definition: LeafNode.h:867
void addLeaf(LeafNode *)
Definition: LeafNodeBool.h:513
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1050
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:620
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeBool.h:598
static Index32 leafCount()
Definition: LeafNodeBool.h:111
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:1119
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeBool.h:647
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:151
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:268
NodeT * probeNode(const Coord &)
Definition: LeafNodeBool.h:519
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:246
ChildOffIter endChildOff()
Definition: LeafNodeBool.h:686
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeBool.h:638
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1449
Definition: NodeMasks.h:189
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1529
bool isChildMaskOn(Index) const
Definition: LeafNodeBool.h:702
Int32 x() const
Definition: Coord.h:131
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1026
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:226
ValueIter()
Definition: LeafNodeBool.h:582
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:29
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition: Coord.h:444
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:372
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:427
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeBool.h:102
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeBool.h:639
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeBool.h:119
std::shared_ptr< T > SharedPtr
Definition: Types.h:91
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:1111
Index64 offLeafVoxelCount() const
Definition: LeafNodeBool.h:121
bool resultIsActive() const
Definition: Types.h:631
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeBool.h:643
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeBool.h:394
void reset()
Definition: Coord.h:327
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1061
void save(std::ostream &os) const
Definition: NodeMasks.h:546
static const Index LEVEL
Definition: LeafNode.h:54
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeBool.h:325
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:248
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1077
ChildAllCIter cendChildAll() const
Definition: LeafNodeBool.h:687
void addLeafAndCache(LeafNode *, AccessorT &)
Definition: LeafNodeBool.h:515
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition: Coord.h:412
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:114
static Index getChildDim()
Definition: LeafNodeBool.h:109
Buffer mBuffer
Bitmask representing the values of voxels.
Definition: LeafNodeBool.h:728
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
NodeT * stealNode(const Coord &, const ValueType &, bool)
Definition: LeafNodeBool.h:517
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Definition: LeafNodeBool.h:555
ChildOffCIter cendChildOff() const
Definition: LeafNodeBool.h:684
Definition: NodeMasks.h:251
Definition: NodeMasks.h:220
const NodeT * probeConstNode(const Coord &) const
Definition: LeafNodeBool.h:521
bool ValueType
Definition: LeafNodeBool.h:33
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:318
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition: Coord.h:400
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeBool.h:619
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:269
ChildOffCIter endChildOff() const
Definition: LeafNodeBool.h:685
ValueOnIter beginValueOn()
Definition: LeafNodeBool.h:651
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeBool.h:429
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:221
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:355
void translate(const Coord &t)
Translate this bounding box by (tx, ty, tz).
Definition: Coord.h:458
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
static CoordBBox createCube(const Coord &min, ValueType dim)
Definition: Coord.h:313
bool isChildMaskOff(Index) const
Definition: LeafNodeBool.h:703
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:409
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:335
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:1247
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeBool.h:674
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Definition: LeafNodeBool.h:535
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeBool.h:136
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:431
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1137
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Definition: LeafNodeBool.h:538
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeBool.h:441
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Definition: LeafNodeBool.h:156
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation.
Definition: NodeMasks.h:288
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeBool.h:642
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1511
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Definition: LeafNodeBool.h:552
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:471
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:681
ValueType * mData
Definition: LeafBuffer.h:169
void visit(VisitorOp &)
Definition: LeafNode.h:1844
ValueAllCIter cendValueAll() const
Definition: LeafNodeBool.h:665
const Coord & max() const
Definition: Coord.h:322
static Index64 offTileCount()
Definition: LeafNodeBool.h:123
NodeMaskType & getValueMask()
Definition: LeafNodeBool.h:700
void setValueMaskOff(Index n)
Definition: LeafNodeBool.h:708
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeBool.h:646
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1284
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1429
ChildOnCIter cendChildOn() const
Definition: LeafNodeBool.h:681
ValueAllIter beginValueAll()
Definition: LeafNodeBool.h:657
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeBool.h:36
void setValue(Index i, const ValueType &)
Set the i'th value of this buffer to the specified value.
Definition: LeafBuffer.h:233
const Coord & min() const
Definition: Coord.h:321
Index64 onLeafVoxelCount() const
Definition: LeafNodeBool.h:120
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeBool.h:652
ValueAllCIter beginValueAll() const
Definition: LeafNodeBool.h:656
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeBool.h:389
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:438
void setItem(Index pos, bool value) const
Definition: LeafNodeBool.h:589
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition: LeafNode.h:37
Int32 z() const
Definition: Coord.h:133
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:341
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeBool.h:216
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeBool.h:264
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:567
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Definition: LeafNodeBool.h:540
ValueAllCIter endValueAll() const
Definition: LeafNodeBool.h:666
ValueOffIter beginValueOff()
Definition: LeafNodeBool.h:654
LeafNode()
Default constructor.
Definition: LeafNode.h:922
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:154
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeBool.h:241
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1013
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Definition: LeafNodeBool.h:557
OffIterator beginOff() const
Definition: NodeMasks.h:335
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeBool.h:645
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:865
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeBool.h:274
bool isValueMaskOff(Index n) const
Definition: LeafNodeBool.h:696
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:289
ValueOnCIter beginValueOn() const
Definition: LeafNodeBool.h:650
ValueOffCIter endValueOff() const
Definition: LeafNodeBool.h:663
const NodeMaskType & valueMask() const
Definition: LeafNodeBool.h:699
ValueOffCIter beginValueOff() const
Definition: LeafNodeBool.h:653
ChildOnIter beginChildOn()
Definition: LeafNodeBool.h:673
ChildAllIter endChildAll()
Definition: LeafNodeBool.h:689
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:483
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:424
LeafNode specialization for values of type bool that stores both the active states and the values of ...
Definition: LeafNodeBool.h:28
ValueOnCIter cendValueOn() const
Definition: LeafNodeBool.h:659
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:346
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1439
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeBool.h:655
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeBool.h:677
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1821
ValueOnCIter endValueOn() const
Definition: LeafNodeBool.h:660
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:184
Coord & setX(Int32 x)
Definition: Coord.h:80
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeBool.h:398
bool isValueMaskOn() const
Definition: LeafNodeBool.h:695
Index32 Index
Definition: Types.h:31
~LeafNode()
Destructor.
Definition: LeafNode.h:1006
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeBool.h:229
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeBool.h:616
ValueOffIter endValueOff()
Definition: LeafNodeBool.h:664
static Index size()
Definition: LeafNodeBool.h:105
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:330
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:479
Definition: version.h:189
ChildAllCIter beginChildAll() const
Definition: LeafNodeBool.h:678
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeBool.h:701
const OPENVDB_API void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
void setValueMask(Index n, bool on)
Definition: LeafNodeBool.h:706
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1760
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:102
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:178
ChildAllCIter endChildAll() const
Definition: LeafNodeBool.h:688
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeBool.h:117
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1901
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeBool.h:572
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1320
ChildOffIter beginChildOff()
Definition: LeafNodeBool.h:676
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeBool.h:595
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1412
uint32_t Index32
Definition: Types.h:29
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1553
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeBool.h:730
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition: LeafNode.h:164
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:287
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeBool.h:128
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeBool.h:637
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:683
static Index64 onTileCount()
Definition: LeafNodeBool.h:122
bool BuildType
Definition: LeafNodeBool.h:32
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeBool.h:266
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition: LeafNode.h:1609
void getNodes(ArrayT &) const
Definition: LeafNodeBool.h:522
Definition: Exceptions.h:13
int32_t Int32
Definition: Types.h:33
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:1687
uint64_t Index64
Definition: Types.h:30
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1720
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:489
ChildIter()
Definition: LeafNodeBool.h:606
static void getNodeLog2Dims(std::vector< Index > &dims)
Definition: LeafNodeBool.h:108
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1597
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeBool.h:231
ValueOffCIter cendValueOff() const
Definition: LeafNodeBool.h:662
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeBool.h:640
const bool & getValue() const
Definition: LeafNodeBool.h:586
static const Index DIM
Definition: LeafNode.h:50
bool isValueMaskOn(Index n) const
Definition: LeafNodeBool.h:694
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:622
void topologyUnion(const LeafNode< OtherType, Log2Dim > &other)
Union this node's set of active values with the active values of the other node, whose ValueType may ...
Definition: LeafNode.h:1679
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1862
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeBool.h:641
ValueAllIter endValueAll()
Definition: LeafNodeBool.h:667
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:281
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeBool.h:636