31 #ifndef OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED 32 #define OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED 40 #include <boost/shared_array.hpp> 42 #include <type_traits> 52 template<Index Log2Dim>
64 static const Index LOG2DIM = Log2Dim;
65 static const Index TOTAL = Log2Dim;
66 static const Index DIM = 1 << TOTAL;
67 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
68 static const Index NUM_VOXELS = NUM_VALUES;
69 static const Index SIZE = NUM_VALUES;
74 template<
typename ValueType>
79 template<
typename OtherNodeType>
80 struct SameConfiguration {
92 explicit LeafNode(
const Coord& xyz,
bool value =
false,
bool active =
false);
94 #ifndef OPENVDB_2_ABI_COMPATIBLE 106 template<
typename OtherValueType>
110 template<
typename ValueType>
114 template<
typename ValueType>
118 template<
typename ValueType>
151 bool isEmpty()
const {
return mValueMask.isOff(); }
153 bool isDense()
const {
return mValueMask.isOn(); }
155 #ifndef OPENVDB_2_ABI_COMPATIBLE 156 bool isAllocated()
const {
return true; }
172 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
181 const Coord& origin()
const {
return mOrigin; }
196 std::string str()
const;
200 template<
typename OtherType, Index OtherLog2Dim>
220 void readTopology(std::istream&,
bool fromHalf =
false);
222 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
225 void readBuffers(std::istream&,
bool fromHalf =
false);
226 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
228 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
234 const bool& getValue(
const Coord& xyz)
const;
236 const bool& getValue(
Index offset)
const;
241 bool probeValue(
const Coord& xyz,
bool& val)
const;
247 void setActiveState(
const Coord& xyz,
bool on);
252 void setValueOnly(
const Coord& xyz,
bool val);
254 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
262 void setValueOff(
const Coord& xyz,
bool val);
264 void setValueOff(
Index offset,
bool val);
272 void setValueOn(
const Coord& xyz,
bool val);
276 void setValueOn(
Index offset,
bool val);
280 template<
typename ModifyOp>
281 void modifyValue(
Index offset,
const ModifyOp& op);
284 template<
typename ModifyOp>
285 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
288 template<
typename ModifyOp>
289 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
297 bool isValueOn(
const Coord& xyz)
const {
return mValueMask.isOn(this->coordToOffset(xyz)); }
299 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mValueMask.isOn(offset); }
308 void fill(
const CoordBBox& bbox,
bool value,
bool active =
true);
313 void fill(
const bool& value);
315 void fill(
const bool& value,
bool active);
328 template<
typename DenseT>
347 template<
typename DenseT>
352 template<
typename AccessorT>
357 template<
typename AccessorT>
362 template<
typename AccessorT>
368 template<
typename AccessorT>
373 template<
typename AccessorT>
376 this->setValueOff(xyz, value);
382 template<
typename ModifyOp,
typename AccessorT>
385 this->modifyValue(xyz, op);
390 template<
typename ModifyOp,
typename AccessorT>
393 this->modifyValueAndActiveState(xyz, op);
399 template<
typename AccessorT>
402 this->setActiveState(xyz, on);
408 template<
typename AccessorT>
411 return this->probeValue(xyz, val);
416 template<
typename AccessorT>
422 const bool&
getFirstValue()
const {
if (mValueMask.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
426 const bool&
getLastValue()
const {
if (mValueMask.isOn(SIZE-1))
return Buffer::sOn;
else return Buffer::sOff; }
431 bool isConstant(
bool& constValue,
bool& state,
bool tolerance = 0)
const;
438 bool medianAll()
const;
446 Index medianOn(ValueType &value)
const;
454 Index medianOff(ValueType &value)
const;
459 void resetBackground(
bool oldBackground,
bool newBackground);
461 void negate() { mBuffer.mData.toggle(); }
463 template<MergePolicy Policy>
464 void merge(
const LeafNode& other,
bool bg =
false,
bool otherBG =
false);
465 template<MergePolicy Policy>
void merge(
bool tileValue,
bool tileActive);
477 template<
typename OtherType>
491 template<
typename OtherType>
505 template<
typename OtherType>
508 template<
typename CombineOp>
509 void combine(
const LeafNode& other, CombineOp& op);
510 template<
typename CombineOp>
511 void combine(
bool,
bool valueIsActive, CombineOp& op);
513 template<
typename CombineOp,
typename OtherType >
514 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
515 template<
typename CombineOp,
typename OtherNodeT >
516 void combine2(
bool,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
517 template<
typename CombineOp,
typename OtherNodeT >
518 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
524 template<
typename BBoxOp>
void visitActiveBBox(BBoxOp&)
const;
526 template<
typename VisitorOp>
void visit(VisitorOp&);
527 template<
typename VisitorOp>
void visit(VisitorOp&)
const;
529 template<
typename OtherLeafNodeType,
typename VisitorOp>
530 void visit2Node(OtherLeafNodeType& other, VisitorOp&);
531 template<
typename OtherLeafNodeType,
typename VisitorOp>
532 void visit2Node(OtherLeafNodeType& other, VisitorOp&)
const;
533 template<
typename IterT,
typename VisitorOp>
534 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false);
535 template<
typename IterT,
typename VisitorOp>
536 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false)
const;
539 void prune(
const ValueType& = zeroVal<ValueType>()) {}
542 template<
typename AccessorT>
544 template<
typename NodeT>
546 template<
typename NodeT>
548 template<
typename NodeT>
550 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
554 void addTile(
Index level,
const Coord&,
bool val,
bool active);
555 void addTile(
Index offset,
bool val,
bool active);
556 template<
typename AccessorT>
557 void addTileAndCache(
Index level,
const Coord&,
bool val,
bool active, AccessorT&);
562 template<
typename AccessorT>
565 template<
typename AccessorT>
567 template<
typename NodeT,
typename AccessorT>
571 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
572 return reinterpret_cast<NodeT*
>(
this);
577 const LeafNode* probeLeaf(
const Coord&)
const {
return this; }
579 template<
typename AccessorT>
582 template<
typename AccessorT>
584 template<
typename NodeT,
typename AccessorT>
588 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
589 return reinterpret_cast<const NodeT*
>(
this);
602 template<
typename MaskIterT,
typename NodeT,
typename ValueT>
606 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
613 const bool&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
614 const bool&
getValue()
const {
return this->getItem(this->pos()); }
617 void setItem(
Index pos,
bool value)
const { this->parent().setValueOnly(pos, value); }
619 void setValue(
bool value)
const { this->setItem(this->pos(), value); }
622 template<
typename ModifyOp>
623 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
625 template<
typename ModifyOp>
626 void modifyValue(
const ModifyOp& op)
const { this->modifyItem(this->pos(), op); }
630 template<
typename MaskIterT,
typename NodeT>
636 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
639 template<
typename NodeT,
typename ValueT>
641 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
651 value = this->parent().getValue(pos);
660 void unsetItem(
Index pos,
const ValueT& val)
const {this->parent().setValueOnly(pos, val);}
665 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
741 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
742 static inline void doVisit(NodeT&, VisitorOp&);
744 template<
typename NodeT,
typename OtherNodeT,
typename VisitorOp,
745 typename ChildAllIterT,
typename OtherChildAllIterT>
746 static inline void doVisit2Node(NodeT&
self, OtherNodeT& other, VisitorOp&);
748 template<
typename NodeT,
typename VisitorOp,
749 typename ChildAllIterT,
typename OtherChildAllIterT>
750 static inline void doVisit2(NodeT&
self, OtherChildAllIterT&, VisitorOp&,
bool otherIsLHS);
786 template<Index Log2Dim>
794 template<Index Log2Dim>
799 , mOrigin(xyz & (~(DIM - 1)))
804 #ifndef OPENVDB_2_ABI_COMPATIBLE 805 template<Index Log2Dim>
810 , mOrigin(xyz & (~(DIM - 1)))
819 template<Index Log2Dim>
822 : mValueMask(other.valueMask())
823 , mBuffer(other.mBuffer)
824 , mOrigin(other.mOrigin)
830 template<Index Log2Dim>
831 template<
typename ValueT>
834 : mValueMask(other.valueMask())
835 , mOrigin(other.origin())
839 static inline bool convertValue(
const ValueT& val) {
return bool(val); }
843 mBuffer.
setValue(
i, Local::convertValue(other.mBuffer[
i]));
848 template<Index Log2Dim>
849 template<
typename ValueT>
853 : mValueMask(other.valueMask())
854 , mBuffer(background)
855 , mOrigin(other.origin())
860 template<Index Log2Dim>
861 template<
typename ValueT>
864 : mValueMask(other.valueMask())
865 , mBuffer(other.valueMask())
866 , mOrigin(other.origin())
871 template<Index Log2Dim>
872 template<
typename ValueT>
876 : mValueMask(other.valueMask())
877 , mBuffer(other.valueMask())
878 , mOrigin(other.origin())
880 if (offValue) {
if (!onValue) mBuffer.
mData.toggle();
else mBuffer.
mData.setOn(); }
884 template<Index Log2Dim>
894 template<Index Log2Dim>
899 return sizeof(*this);
903 template<Index Log2Dim>
908 if (bbox.
isInside(this_bbox))
return;
912 for(; iter; ++iter) this_bbox.
expand(this->offsetToLocalCoord(iter.pos()));
920 template<Index Log2Dim>
921 template<
typename OtherType, Index OtherLog2Dim>
926 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
930 template<Index Log2Dim>
934 std::ostringstream ostr;
935 ostr <<
"LeafNode @" << mOrigin <<
": ";
936 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mValueMask.
isOn(n) ?
'#' :
'.');
944 template<Index Log2Dim>
948 assert ((xyz[0] & (
DIM-1u)) <
DIM && (xyz[1] & (
DIM-1u)) <
DIM && (xyz[2] & (
DIM-1u)) <
DIM);
949 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
950 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
951 + (xyz[2] & (
DIM-1u));
955 template<Index Log2Dim>
959 assert(n < (1 << 3*Log2Dim));
961 xyz.
setX(n >> 2*Log2Dim);
962 n &= ((1 << 2*Log2Dim) - 1);
963 xyz.
setY(n >> Log2Dim);
964 xyz.
setZ(n & ((1 << Log2Dim) - 1));
969 template<Index Log2Dim>
980 template<Index Log2Dim>
988 template<Index Log2Dim>
996 template<Index Log2Dim>
1006 bool background =
false;
1008 background = *
static_cast<const bool*
>(bgPtr);
1010 this->
clip(clipBBox, background);
1014 template<Index Log2Dim>
1019 mValueMask.
load(is);
1025 mBuffer.
mData.load(is);
1030 int8_t numBuffers = 0;
1031 is.read(reinterpret_cast<char*>(&numBuffers),
sizeof(int8_t));
1035 boost::shared_array<bool> buf(
new bool[
SIZE]);
1036 io::readData<bool>(is, buf.get(),
SIZE,
true);
1039 mBuffer.
mData.setOff();
1041 if (buf[
i]) mBuffer.
mData.setOn(
i);
1044 if (numBuffers > 1) {
1047 for (
int i = 1;
i < numBuffers; ++
i) {
1048 io::readData<bool>(is, buf.get(),
SIZE,
true);
1055 template<Index Log2Dim>
1060 mValueMask.
save(os);
1062 os.write(reinterpret_cast<const char*>(&mOrigin),
sizeof(
Coord::ValueType) * 3);
1064 mBuffer.
mData.save(os);
1071 template<Index Log2Dim>
1075 return mOrigin == other.mOrigin &&
1077 mBuffer == other.mBuffer;
1081 template<Index Log2Dim>
1092 template<Index Log2Dim>
1096 if (!mValueMask.
isConstant(state))
return false;
1099 if (!tolerance && !(mBuffer.
mData.isOn() || mBuffer.
mData.isOff()))
return false;
1101 constValue = mBuffer.
mData.isOn();
1107 template<Index Log2Dim>
1111 const Index countTrue = mBuffer.
mData.countOn();
1115 template<Index Log2Dim>
1125 template<Index Log2Dim>
1138 template<Index Log2Dim>
1145 template<Index Log2Dim>
1149 assert(offset <
SIZE);
1154 template<Index Log2Dim>
1155 template<
typename AccessorT>
1158 bool val,
bool active, AccessorT&)
1160 this->
addTile(level, xyz, val, active);
1167 template<Index Log2Dim>
1172 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1176 template<Index Log2Dim>
1180 assert(offset <
SIZE);
1182 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1186 template<Index Log2Dim>
1191 val = mBuffer.
mData.isOn(offset);
1192 return mValueMask.
isOn(offset);
1196 template<Index Log2Dim>
1204 template<Index Log2Dim>
1208 assert(offset <
SIZE);
1209 mValueMask.
setOn(offset);
1210 mBuffer.
mData.set(offset, val);
1214 template<Index Log2Dim>
1222 template<Index Log2Dim>
1230 template<Index Log2Dim>
1238 template<Index Log2Dim>
1242 assert(offset <
SIZE);
1243 mValueMask.
setOff(offset);
1244 mBuffer.
mData.set(offset, val);
1248 template<Index Log2Dim>
1249 template<
typename ModifyOp>
1253 bool val = mBuffer.
mData.isOn(offset);
1255 mBuffer.
mData.set(offset, val);
1256 mValueMask.
setOn(offset);
1260 template<Index Log2Dim>
1261 template<
typename ModifyOp>
1269 template<Index Log2Dim>
1270 template<
typename ModifyOp>
1275 bool val = mBuffer.
mData.isOn(offset), state = mValueMask.
isOn(offset);
1277 mBuffer.
mData.set(offset, val);
1278 mValueMask.
set(offset, state);
1285 template<Index Log2Dim>
1289 if (newBackground != oldBackground) {
1293 mBuffer.
mData = (mBuffer.
mData & mValueMask) | bgMask;
1301 template<Index Log2Dim>
1302 template<MergePolicy Policy>
1309 const Index n = iter.pos();
1310 if (mValueMask.
isOff(n)) {
1311 mBuffer.
mData.set(n, other.mBuffer.
mData.isOn(n));
1312 mValueMask.
setOn(n);
1318 template<Index Log2Dim>
1319 template<MergePolicy Policy>
1325 if (!tileActive)
return;
1327 if (tileValue) mBuffer.
mData |= !mValueMask;
1328 else mBuffer.
mData &= mValueMask;
1337 template<Index Log2Dim>
1338 template<
typename OtherType>
1346 template<Index Log2Dim>
1347 template<
typename OtherType>
1356 template<Index Log2Dim>
1357 template<
typename OtherType>
1369 template<Index Log2Dim>
1376 this->
fill(nodeBBox, background,
false);
1377 }
else if (clipBBox.
isInside(nodeBBox)) {
1389 int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
1390 for (x = nodeBBox.
min().
x(); x <= nodeBBox.
max().
x(); ++x) {
1391 for (y = nodeBBox.
min().
y(); y <= nodeBBox.
max().
y(); ++y) {
1392 for (z = nodeBBox.
min().
z(); z <= nodeBBox.
max().
z(); ++z) {
1409 template<Index Log2Dim>
1414 clippedBBox.intersect(bbox);
1415 if (!clippedBBox)
return;
1417 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1418 const Index offsetX = (x & (
DIM-1u))<<2*Log2Dim;
1419 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1420 const Index offsetXY = offsetX + ((y & (
DIM-1u))<< Log2Dim);
1421 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1422 const Index offset = offsetXY + (z & (
DIM-1u));
1423 mValueMask.
set(offset, active);
1424 mBuffer.
mData.set(offset, value);
1430 template<Index Log2Dim>
1434 mBuffer.
fill(value);
1437 template<Index Log2Dim>
1441 mBuffer.
fill(value);
1442 mValueMask.
set(active);
1449 template<Index Log2Dim>
1450 template<
typename DenseT>
1454 using DenseValueType =
typename DenseT::ValueType;
1456 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1457 const Coord&
min = dense.bbox().min();
1458 DenseValueType* t0 = dense.data() + zStride * (bbox.
min()[2] -
min[2]);
1460 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1461 DenseValueType* t1 = t0 + xStride * (x -
min[0]);
1463 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1464 DenseValueType* t2 = t1 + yStride * (y -
min[1]);
1466 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2] + 1; z < ez; ++z, t2 += zStride) {
1467 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1474 template<Index Log2Dim>
1475 template<
typename DenseT>
1478 bool background,
bool tolerance)
1480 using DenseValueType =
typename DenseT::ValueType;
1482 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1485 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1486 const Coord&
min = dense.bbox().min();
1487 const DenseValueType* s0 = dense.data() + zStride * (bbox.
min()[2] -
min[2]);
1489 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1490 const DenseValueType* s1 = s0 + xStride * (x -
min[0]);
1492 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1493 const DenseValueType* s2 = s1 + yStride * (y -
min[1]);
1495 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1497 if (tolerance || (background == Local::toBool(*s2))) {
1499 mBuffer.
mData.set(n2, background);
1501 mValueMask.
setOn(n2);
1502 mBuffer.
mData.set(n2, Local::toBool(*s2));
1513 template<Index Log2Dim>
1514 template<
typename CombineOp>
1520 bool result =
false, aVal = mBuffer.
mData.isOn(
i), bVal = other.mBuffer.
mData.isOn(
i);
1522 .setAIsActive(mValueMask.
isOn(
i))
1525 .setResultRef(result));
1527 mBuffer.
mData.set(
i, result);
1532 template<Index Log2Dim>
1533 template<
typename CombineOp>
1538 args.
setBRef(value).setBIsActive(valueIsActive);
1540 bool result =
false, aVal = mBuffer.
mData.isOn(
i);
1542 .setAIsActive(mValueMask.
isOn(
i))
1543 .setResultRef(result));
1545 mBuffer.
mData.set(
i, result);
1553 template<Index Log2Dim>
1554 template<
typename CombineOp,
typename OtherType>
1557 bool valueIsActive, CombineOp& op)
1560 args.
setBRef(value).setBIsActive(valueIsActive);
1562 bool result =
false, aVal = other.mBuffer.
mData.isOn(
i);
1565 .setResultRef(result));
1567 mBuffer.
mData.set(
i, result);
1572 template<Index Log2Dim>
1573 template<
typename CombineOp,
typename OtherNodeT>
1576 bool valueIsActive, CombineOp& op)
1579 args.
setARef(value).setAIsActive(valueIsActive);
1581 bool result =
false, bVal = other.mBuffer.mData.isOn(
i);
1583 .setBIsActive(other.valueMask().isOn(
i))
1584 .setResultRef(result));
1586 mBuffer.
mData.set(
i, result);
1591 template<Index Log2Dim>
1592 template<
typename CombineOp,
typename OtherNodeT>
1601 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(
i), b1Val = b1.mBuffer.mData.isOn(
i);
1605 .setBIsActive(b1.valueMask().isOn(
i))
1606 .setResultRef(result));
1608 mBuffer.
mData.set(
i, result);
1615 template<Index Log2Dim>
1616 template<
typename BBoxOp>
1620 if (op.template descent<LEVEL>()) {
1638 template<Index Log2Dim>
1639 template<
typename VisitorOp>
1643 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1647 template<Index Log2Dim>
1648 template<
typename VisitorOp>
1652 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1656 template<Index Log2Dim>
1657 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1661 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1670 template<Index Log2Dim>
1671 template<
typename OtherLeafNodeType,
typename VisitorOp>
1676 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1680 template<Index Log2Dim>
1681 template<
typename OtherLeafNodeType,
typename VisitorOp>
1686 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1690 template<Index Log2Dim>
1693 typename OtherNodeT,
1695 typename ChildAllIterT,
1696 typename OtherChildAllIterT>
1701 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1702 "can't visit nodes of different sizes simultaneously");
1703 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1704 "can't visit nodes at different tree levels simultaneously");
1706 ChildAllIterT iter =
self.beginChildAll();
1707 OtherChildAllIterT otherIter = other.beginChildAll();
1709 for ( ; iter && otherIter; ++iter, ++otherIter) {
1710 op(iter, otherIter);
1718 template<Index Log2Dim>
1719 template<
typename IterT,
typename VisitorOp>
1723 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1727 template<Index Log2Dim>
1728 template<
typename IterT,
typename VisitorOp>
1732 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1736 template<Index Log2Dim>
1740 typename ChildAllIterT,
1741 typename OtherChildAllIterT>
1744 VisitorOp& op,
bool otherIsLHS)
1746 if (!otherIter)
return;
1749 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1750 op(otherIter, iter);
1753 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1754 op(iter, otherIter);
1763 #endif // OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1444
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:551
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:143
static Index size()
Definition: LeafNodeBool.h:132
bool isChildMaskOff(Index) const
Definition: LeafNodeBool.h:731
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:221
static Index64 offTileCount()
Definition: LeafNodeBool.h:148
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:274
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:611
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:583
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...
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeBool.h:267
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeBool.h:131
ValueAllCIter cendValueAll() const
Definition: LeafNodeBool.h:693
Index64 onLeafVoxelCount() const
Definition: LeafNodeBool.h:145
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:1134
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:179
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeBool.h:292
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeBool.h:426
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:495
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:1499
std::shared_ptr< T > SharedPtr
Definition: Types.h:130
Int32 z() const
Definition: Coord.h:156
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeBool.h:673
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1073
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Coord & setZ(Int32 z)
Definition: Coord.h:105
ChildAllIter beginChildAll()
Definition: LeafNodeBool.h:707
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeBool.h:244
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:549
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeBool.h:758
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeBool.h:259
ChildOnCIter beginChildOn() const
Definition: LeafNodeBool.h:700
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1471
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1036
void setValueMaskOff(Index n)
Definition: LeafNodeBool.h:736
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:502
void visit(VisitorOp &)
Definition: LeafNode.h:1888
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:545
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeBool.h:665
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1160
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1461
ChildOffCIter cendChildOff() const
Definition: LeafNodeBool.h:712
ValueOffCIter cendValueOff() const
Definition: LeafNodeBool.h:690
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeBool.h:670
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:1200
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeBool.h:469
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:58
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:358
LeafNode()
Default constructor.
Definition: LeafNode.h:943
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:369
const Buffer & buffer() const
Definition: LeafNodeBool.h:213
Int32 y() const
Definition: Coord.h:155
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1865
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeBool.h:680
uint32_t Index32
Definition: Types.h:55
static const Index LEVEL
Definition: LeafNode.h:78
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeBool.h:61
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeBool.h:144
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeBool.h:417
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1629
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, whose ValueType may be different. So a resulting voxel will be active only if the original voxel is active in this LeafNode and inactive in the other LeafNode.
Definition: LeafNode.h:1734
tbb::atomic< Index32 > i
Definition: LeafBuffer.h:71
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeBool.h:669
ValueOffIter endValueOff()
Definition: LeafNodeBool.h:692
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeBool.h:675
ChildOnIter endChildOn()
Definition: LeafNodeBool.h:711
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeBool.h:598
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeBool.h:563
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeBool.h:599
ValueOnCIter cendValueOn() const
Definition: LeafNodeBool.h:687
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:543
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:1274
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeBool.h:672
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:541
static Index numValues()
Definition: LeafNodeBool.h:133
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:581
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:261
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:183
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1968
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition: Coord.h:419
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:585
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:374
OffIterator beginOff() const
Definition: NodeMasks.h:354
ChildAllIter endChildAll()
Definition: LeafNodeBool.h:717
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1992
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeBool.h:705
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:886
Index32 Index
Definition: Types.h:57
Definition: NodeMasks.h:270
void setValueMask(Index n, bool on)
Definition: LeafNodeBool.h:734
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:635
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:317
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:314
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:505
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1084
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:1142
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeBool.h:457
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:212
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeBool.h:647
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeBool.h:660
ValueOnCIter endValueOn() const
Definition: LeafNodeBool.h:688
ValueType * mData
Definition: LeafBuffer.h:220
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1801
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeBool.h:163
static Index getLevel()
Definition: LeafNodeBool.h:134
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1507
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeBool.h:626
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:400
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1321
ChildOnCIter endChildOn() const
Definition: LeafNodeBool.h:710
ChildOffIter beginChildOff()
Definition: LeafNodeBool.h:704
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNodeBool.h:176
ValueAllCIter endValueAll() const
Definition: LeafNodeBool.h:694
static Index32 leafCount()
Definition: LeafNodeBool.h:138
ChildAllCIter cendChildAll() const
Definition: LeafNodeBool.h:715
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:427
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:383
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeBool.h:151
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition: LeafNode.h:1641
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:61
uint64_t Index64
Definition: Types.h:56
bool isValueMaskOn() const
Definition: LeafNodeBool.h:723
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:580
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeBool.h:649
const bool & getItem(Index pos) const
Definition: LeafNodeBool.h:613
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:297
void merge(const LeafNode &)
Definition: LeafNode.h:1664
bool BuildType
Definition: LeafNodeBool.h:57
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1561
~LeafNode()
Destructor.
Definition: LeafNode.h:1029
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:472
#define OPENVDB_VERSION_NAME
Definition: version.h:43
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:198
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:426
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeBool.h:568
void translate(const Coord &t)
Translate this bounding box by .
Definition: Coord.h:458
ChildOffCIter beginChildOff() const
Definition: LeafNodeBool.h:703
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNode.h:192
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeBool.h:667
ValueOffIter beginValueOff()
Definition: LeafNodeBool.h:682
static Index getChildDim()
Definition: LeafNodeBool.h:136
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:308
static const Index NUM_VALUES
Definition: LeafNode.h:75
void setValue(bool value) const
Definition: LeafNodeBool.h:619
static Index32 nonLeafCount()
Definition: LeafNodeBool.h:139
ValueAllIter endValueAll()
Definition: LeafNodeBool.h:695
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:346
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1059
ChildOnIter beginChildOn()
Definition: LeafNodeBool.h:701
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeBool.h:353
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1049
void save(std::ostream &os) const
Definition: NodeMasks.h:565
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition: Coord.h:401
Definition: Exceptions.h:39
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeBool.h:668
Coord & setX(Int32 x)
Definition: Coord.h:103
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:487
LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeBool.h:564
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1759
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:443
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:1717
const Coord & max() const
Definition: Coord.h:335
Definition: NodeMasks.h:239
ValueOnIter endValueOn()
Definition: LeafNodeBool.h:689
void negate()
Definition: LeafNodeBool.h:461
bool resultIsActive() const
Definition: Types.h:435
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:371
ValueIter()
Definition: LeafNodeBool.h:610
ChildOffCIter endChildOff() const
Definition: LeafNodeBool.h:713
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition: Coord.h:445
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:184
ValueAllCIter beginValueAll() const
Definition: LeafNodeBool.h:684
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeBool.h:739
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeBool.h:302
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1920
ValueOnCIter beginValueOn() const
Definition: LeafNodeBool.h:678
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeBool.h:142
static Index64 onTileCount()
Definition: LeafNodeBool.h:147
static const Index LOG2DIM
Definition: LeafNode.h:72
ValueOnCIter cbeginValueOn() 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 setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeBool.h:257
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:424
ChildAllCIter beginChildAll() const
Definition: LeafNodeBool.h:706
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeBool.h:294
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeBool.h:699
static const Index SIZE
Definition: LeafNode.h:77
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:249
NodeMaskType & getValueMask()
Definition: LeafNodeBool.h:728
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:455
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeBool.h:664
static CoordBBox createCube(const Coord &min, ValueType dim)
Definition: Coord.h:326
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1349
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1100
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:409
bool isValueMaskOn(Index n) const
Definition: LeafNodeBool.h:722
const NodeMaskType & valueMask() const
Definition: LeafNode.h:888
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeBool.h:729
ChildAllCIter endChildAll() const
Definition: LeafNodeBool.h:716
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:338
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeBool.h:674
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:450
Int32 x() const
Definition: Coord.h:154
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeBool.h:391
Buffer mBuffer
Bitmask representing the values of voxels.
Definition: LeafNodeBool.h:756
Definition: NodeMasks.h:208
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeBool.h:666
void setItem(Index pos, bool value) const
Definition: LeafNodeBool.h:617
Index64 offLeafVoxelCount() const
Definition: LeafNodeBool.h:146
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeBool.h:671
const bool & getValue() const
Definition: LeafNodeBool.h:614
DenseIter()
Definition: LeafNodeBool.h:646
ValueAllIter beginValueAll()
Definition: LeafNodeBool.h:685
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeBool.h:153
bool isChildMaskOn(Index) const
Definition: LeafNodeBool.h:730
bool isConstant(bool &isOn) const
Definition: NodeMasks.h:526
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeBool.h:600
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:363
Definition: PointDataGrid.h:192
const NodeMaskType & getValueMask() const
Definition: LeafNodeBool.h:726
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:462
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:503
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1585
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1543
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:48
void setValueMaskOn(Index n)
Definition: LeafNodeBool.h:735
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:550
ChildOffIter endChildOff()
Definition: LeafNodeBool.h:714
int32_t Int32
Definition: Types.h:59
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:437
const NodeMaskType & valueMask() const
Definition: LeafNodeBool.h:727
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, whose ValueType may be different. So a resulting voxel will be active only if both of the original voxels were active.
Definition: LeafNode.h:1725
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1906
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:315
Buffer & buffer()
Definition: LeafNodeBool.h:214
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
Int32 ValueType
Definition: Coord.h:56
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeBool.h:623
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:1245
Coord & setY(Int32 y)
Definition: Coord.h:104
ChildIter()
Definition: LeafNodeBool.h:634
void load(std::istream &is)
Definition: NodeMasks.h:569
const Coord & min() const
Definition: Coord.h:334
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:508
bool isChildMaskOff() const
Definition: LeafNodeBool.h:732
NodeMaskType mValueMask
Bitmask that determines which voxels are active.
Definition: LeafNodeBool.h:754
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:254
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeBool.h:129
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:547
void reset()
Definition: Coord.h:340
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1481
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeBool.h:702
LeafNode specialization for values of type bool that stores both the active states and the values of ...
Definition: LeafNodeBool.h:53
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:457
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeBool.h:269
ValueOffCIter endValueOff() const
Definition: LeafNodeBool.h:691
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition: Coord.h:413
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1945
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeBool.h:683
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
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:310
static void getNodeLog2Dims(std::vector< Index > &dims)
Definition: LeafNodeBool.h:135
static const Index DIM
Definition: LeafNode.h:74
bool ValueType
Definition: LeafNodeBool.h:58
boost::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:212
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeBool.h:422
void setValue(Index i, const ValueType &)
Set the i'th value of this buffer to the specified value.
Definition: LeafBuffer.h:289
ChildOnCIter cendChildOn() const
Definition: LeafNodeBool.h:709
ValueOffCIter beginValueOff() const
Definition: LeafNodeBool.h:681
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeBool.h:299
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1612
Definition: version.h:104
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:206
ValueOnIter beginValueOn()
Definition: LeafNodeBool.h:679
OnIterator beginOn() const
Definition: NodeMasks.h:352
bool isValueMaskOff() const
Definition: LeafNodeBool.h:725
bool isValueMaskOff(Index n) const
Definition: LeafNodeBool.h:724
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeBool.h:566
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeBool.h:644
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1313