31 #ifndef OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED 32 #define OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED 41 #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 OtherValueType>
79 template<
typename OtherNodeType>
80 struct SameConfiguration {
91 explicit LeafNode(
const Coord& xyz,
bool value =
false,
bool dummy =
false);
93 #ifndef OPENVDB_2_ABI_COMPATIBLE 102 template<
typename OtherValueType>
106 template<
typename ValueType>
110 template<
typename ValueType>
114 template<
typename ValueType>
153 bool isEmpty()
const {
return mBuffer.mData.isOff(); }
155 bool isDense()
const {
return mBuffer.mData.isOn(); }
157 #ifndef OPENVDB_2_ABI_COMPATIBLE 158 bool isAllocated()
const {
return true; }
174 void evalActiveBoundingBox(CoordBBox& bbox,
bool visitVoxels =
true)
const;
181 void setOrigin(
const Coord& origin) { mOrigin = origin; }
183 const Coord& origin()
const {
return mOrigin; }
185 void getOrigin(Coord& origin)
const { origin = mOrigin; }
190 static Index coordToOffset(
const Coord& xyz);
193 static Coord offsetToLocalCoord(
Index n);
195 Coord offsetToGlobalCoord(
Index n)
const;
198 std::string str()
const;
202 template<
typename OtherType, Index OtherLog2Dim>
222 void readTopology(std::istream&,
bool fromHalf =
false);
224 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
227 void readBuffers(std::istream&,
bool fromHalf =
false);
228 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
230 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
236 const bool& getValue(
const Coord& xyz)
const;
238 const bool& getValue(
Index offset)
const;
243 bool probeValue(
const Coord& xyz,
bool& val)
const;
249 void setActiveState(
const Coord& xyz,
bool on);
254 void setValueOnly(
const Coord& xyz,
bool val);
256 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
259 void setValueOff(
const Coord& xyz) { mBuffer.mData.setOff(this->coordToOffset(xyz)); }
264 void setValueOff(
const Coord& xyz,
bool val);
266 void setValueOff(
Index offset,
bool val);
269 void setValueOn(
const Coord& xyz) { mBuffer.mData.setOn(this->coordToOffset(xyz)); }
274 void setValueOn(
const Coord& xyz,
bool val);
276 void setValue(
const Coord& xyz,
bool val) { this->setValueOn(xyz, val); }
278 void setValueOn(
Index offset,
bool val);
282 template<
typename ModifyOp>
283 void modifyValue(
Index offset,
const ModifyOp& op);
286 template<
typename ModifyOp>
287 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
290 template<
typename ModifyOp>
291 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
299 bool isValueOn(
const Coord& xyz)
const {
return mBuffer.mData.isOn(this->coordToOffset(xyz)); }
301 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mBuffer.mData.isOn(offset); }
307 void clip(
const CoordBBox&,
bool background);
310 void fill(
const CoordBBox& bbox,
bool value,
bool =
false);
312 void denseFill(
const CoordBBox& bbox,
bool value,
bool =
false) { this->fill(bbox, value); }
315 void fill(
const bool& value,
bool dummy =
false);
328 template<
typename DenseT>
329 void copyToDense(
const CoordBBox& bbox, DenseT& dense)
const;
347 template<
typename DenseT>
348 void copyFromDense(
const CoordBBox& bbox,
const DenseT& dense,
bool background,
bool tolerance);
352 template<
typename AccessorT>
353 const bool&
getValueAndCache(
const Coord& xyz, AccessorT&)
const {
return this->getValue(xyz);}
357 template<
typename AccessorT>
362 template<
typename AccessorT>
363 void setValueAndCache(
const Coord& xyz,
bool val, AccessorT&) { this->setValueOn(xyz, val); }
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 (mBuffer.mData.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
426 const bool&
getLastValue()
const {
if (mBuffer.mData.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;
467 void negate() { mBuffer.mData.toggle(); }
469 template<MergePolicy Policy>
470 void merge(
const LeafNode& other,
bool bg =
false,
bool otherBG =
false);
471 template<MergePolicy Policy>
void merge(
bool tileValue,
bool tileActive=
false);
483 template<
typename OtherType>
497 template<
typename OtherType>
511 template<
typename OtherType>
514 template<
typename CombineOp>
515 void combine(
const LeafNode& other, CombineOp& op);
516 template<
typename CombineOp>
517 void combine(
bool,
bool valueIsActive, CombineOp& op);
519 template<
typename CombineOp,
typename OtherType >
520 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
521 template<
typename CombineOp,
typename OtherNodeT >
522 void combine2(
bool,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
523 template<
typename CombineOp,
typename OtherNodeT >
524 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
530 template<
typename BBoxOp>
void visitActiveBBox(BBoxOp&)
const;
532 template<
typename VisitorOp>
void visit(VisitorOp&);
533 template<
typename VisitorOp>
void visit(VisitorOp&)
const;
535 template<
typename OtherLeafNodeType,
typename VisitorOp>
536 void visit2Node(OtherLeafNodeType& other, VisitorOp&);
537 template<
typename OtherLeafNodeType,
typename VisitorOp>
538 void visit2Node(OtherLeafNodeType& other, VisitorOp&)
const;
539 template<
typename IterT,
typename VisitorOp>
540 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false);
541 template<
typename IterT,
typename VisitorOp>
542 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false)
const;
548 template<
typename AccessorT>
550 template<
typename NodeT>
552 template<
typename NodeT>
554 template<
typename NodeT>
556 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
560 void addTile(
Index level,
const Coord&,
bool val,
bool active);
561 void addTile(
Index offset,
bool val,
bool active);
562 template<
typename AccessorT>
563 void addTileAndCache(
Index level,
const Coord&,
bool val,
bool active, AccessorT&);
566 LeafNode* touchLeaf(
const Coord&) {
return this; }
568 template<
typename AccessorT>
571 template<
typename AccessorT>
573 template<
typename NodeT,
typename AccessorT>
577 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
578 return reinterpret_cast<NodeT*
>(
this);
583 const LeafNode* probeLeaf(
const Coord&)
const {
return this; }
585 template<
typename AccessorT>
588 template<
typename AccessorT>
590 template<
typename NodeT,
typename AccessorT>
594 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
595 return reinterpret_cast<const NodeT*
>(
this);
608 template<
typename MaskIterT,
typename NodeT,
typename ValueT>
612 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
619 const bool&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
620 const bool&
getValue()
const {
return this->getItem(this->pos()); }
623 void setItem(
Index pos,
bool value)
const { this->parent().setValueOnly(pos, value); }
625 void setValue(
bool value)
const { this->setItem(this->pos(), value); }
628 template<
typename ModifyOp>
629 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
631 template<
typename ModifyOp>
632 void modifyValue(
const ModifyOp& op)
const { this->modifyItem(this->pos(), op); }
636 template<
typename MaskIterT,
typename NodeT>
642 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
645 template<
typename NodeT,
typename ValueT>
647 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
657 value = this->parent().getValue(pos);
666 void unsetItem(
Index pos,
const ValueT& val)
const {this->parent().setValueOnly(pos, val);}
671 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
747 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
748 static inline void doVisit(NodeT&, VisitorOp&);
750 template<
typename NodeT,
typename OtherNodeT,
typename VisitorOp,
751 typename ChildAllIterT,
typename OtherChildAllIterT>
752 static inline void doVisit2Node(NodeT&
self, OtherNodeT& other, VisitorOp&);
754 template<
typename NodeT,
typename VisitorOp,
755 typename ChildAllIterT,
typename OtherChildAllIterT>
756 static inline void doVisit2(NodeT&
self, OtherChildAllIterT&, VisitorOp&,
bool otherIsLHS);
792 template<Index Log2Dim>
799 template<Index Log2Dim>
802 : mBuffer(value || active)
803 , mOrigin(xyz & (~(
DIM - 1)))
808 #ifndef OPENVDB_2_ABI_COMPATIBLE 809 template<Index Log2Dim>
812 : mBuffer(value || active)
813 , mOrigin(xyz & (~(
DIM - 1)))
819 template<Index Log2Dim>
822 : mBuffer(other.mBuffer)
823 , mOrigin(other.mOrigin)
829 template<Index Log2Dim>
830 template<
typename ValueT>
839 template<Index Log2Dim>
840 template<
typename ValueT>
850 template<Index Log2Dim>
851 template<
typename ValueT>
860 template<Index Log2Dim>
861 template<
typename ValueT>
868 if (offValue==
true) {
869 if (onValue==
false) {
870 mBuffer.
mData.toggle();
872 mBuffer.
mData.setOn();
878 template<Index Log2Dim>
888 template<Index Log2Dim>
893 return sizeof(*this);
897 template<Index Log2Dim>
902 if (bbox.isInside(this_bbox))
return;
906 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
907 this_bbox.translate(this->
origin());
909 bbox.expand(this_bbox);
914 template<Index Log2Dim>
915 template<
typename OtherType, Index OtherLog2Dim>
924 template<Index Log2Dim>
928 std::ostringstream ostr;
929 ostr <<
"LeafNode @" << mOrigin <<
": ";
930 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mBuffer.
mData.isOn(n) ?
'#' :
'.');
938 template<Index Log2Dim>
942 assert ((xyz[0] & (
DIM-1u)) <
DIM && (xyz[1] & (
DIM-1u)) <
DIM && (xyz[2] & (
DIM-1u)) <
DIM);
943 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
944 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
945 + (xyz[2] & (
DIM-1u));
949 template<Index Log2Dim>
953 assert(n < (1 << 3*Log2Dim));
955 xyz.setX(n >> 2*Log2Dim);
956 n &= ((1 << 2*Log2Dim) - 1);
957 xyz.setY(n >> Log2Dim);
958 xyz.setZ(n & ((1 << Log2Dim) - 1));
963 template<Index Log2Dim>
974 template<Index Log2Dim>
978 mBuffer.
mData.load(is);
982 template<Index Log2Dim>
986 mBuffer.
mData.save(os);
990 template<Index Log2Dim>
1000 bool background =
false;
1002 background = *
static_cast<const bool*
>(bgPtr);
1004 this->
clip(clipBBox, background);
1008 template<Index Log2Dim>
1013 mBuffer.
mData.load(is);
1015 is.read(reinterpret_cast<char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1019 template<Index Log2Dim>
1024 mBuffer.
mData.save(os);
1026 os.write(reinterpret_cast<const char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1033 template<Index Log2Dim>
1037 return mOrigin == other.mOrigin && mBuffer == other.mBuffer;
1041 template<Index Log2Dim>
1052 template<Index Log2Dim>
1056 if (!mBuffer.
mData.isConstant(state))
return false;
1065 template<Index Log2Dim>
1069 const Index countTrue = mBuffer.
mData.countOn();
1073 template<Index Log2Dim>
1077 const Index countTrueOn = mBuffer.
mData.countOn();
1082 template<Index Log2Dim>
1086 const Index countFalseOff = mBuffer.
mData.countOff();
1088 return countFalseOff;
1095 template<Index Log2Dim>
1102 template<Index Log2Dim>
1106 assert(offset <
SIZE);
1111 template<Index Log2Dim>
1112 template<
typename AccessorT>
1115 bool val,
bool active, AccessorT&)
1117 this->
addTile(level, xyz, val, active);
1124 template<Index Log2Dim>
1129 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1133 template<Index Log2Dim>
1137 assert(offset <
SIZE);
1139 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1143 template<Index Log2Dim>
1148 val = mBuffer.
mData.isOn(offset);
1153 template<Index Log2Dim>
1161 template<Index Log2Dim>
1165 assert(offset <
SIZE);
1166 mBuffer.
mData.set(offset, val);
1170 template<Index Log2Dim>
1178 template<Index Log2Dim>
1186 template<Index Log2Dim>
1194 template<Index Log2Dim>
1198 assert(offset <
SIZE);
1199 mBuffer.
mData.set(offset, val);
1203 template<Index Log2Dim>
1204 template<
typename ModifyOp>
1208 bool val = mBuffer.
mData.isOn(offset);
1210 mBuffer.
mData.set(offset, val);
1214 template<Index Log2Dim>
1215 template<
typename ModifyOp>
1223 template<Index Log2Dim>
1224 template<
typename ModifyOp>
1229 bool val = mBuffer.
mData.isOn(offset), state = val;
1231 mBuffer.
mData.set(offset, val);
1238 template<Index Log2Dim>
1239 template<MergePolicy Policy>
1249 template<Index Log2Dim>
1250 template<MergePolicy Policy>
1256 if (tileValue) mBuffer.
mData.setOn();
1264 template<Index Log2Dim>
1265 template<
typename OtherType>
1273 template<Index Log2Dim>
1274 template<
typename OtherType>
1283 template<Index Log2Dim>
1284 template<
typename OtherType>
1296 template<Index Log2Dim>
1301 if (!clipBBox.hasOverlap(nodeBBox)) {
1303 this->
fill(nodeBBox, background,
false);
1304 }
else if (clipBBox.isInside(nodeBBox)) {
1314 nodeBBox.intersect(clipBBox);
1316 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1317 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1318 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1319 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1336 template<Index Log2Dim>
1341 clippedBBox.intersect(bbox);
1342 if (!clippedBBox)
return;
1344 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1345 const Index offsetX = (x & (
DIM-1u))<<2*Log2Dim;
1346 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1347 const Index offsetXY = offsetX + ((y & (
DIM-1u))<< Log2Dim);
1348 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1349 const Index offset = offsetXY + (z & (
DIM-1u));
1350 mBuffer.
mData.set(offset, value);
1356 template<Index Log2Dim>
1360 mBuffer.
fill(value);
1367 template<Index Log2Dim>
1368 template<
typename DenseT>
1372 using DenseValueType =
typename DenseT::ValueType;
1374 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1375 const Coord&
min = dense.bbox().min();
1376 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1377 const Int32 n0 = bbox.min()[2] & (
DIM-1u);
1378 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1379 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1381 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1382 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1384 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1385 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1392 template<Index Log2Dim>
1393 template<
typename DenseT>
1396 bool background,
bool tolerance)
1398 using DenseValueType =
typename DenseT::ValueType;
1400 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1403 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1404 const Coord&
min = dense.bbox().min();
1405 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1406 const Int32 n0 = bbox.min()[2] & (
DIM-1u);
1407 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1408 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1410 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1411 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1413 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1415 if (tolerance || (background == Local::toBool(*s2))) {
1416 mBuffer.mData.set(n2, background);
1418 mBuffer.mData.set(n2, Local::toBool(*s2));
1429 template<Index Log2Dim>
1430 template<
typename CombineOp>
1436 bool result =
false, aVal = mBuffer.mData.isOn(i), bVal = other.mBuffer.
mData.isOn(i);
1441 .setResultRef(result));
1442 mBuffer.mData.set(i, result);
1447 template<Index Log2Dim>
1448 template<
typename CombineOp>
1453 args.
setBRef(value).setBIsActive(valueIsActive);
1455 bool result =
false, aVal = mBuffer.mData.isOn(i);
1458 .setResultRef(result));
1459 mBuffer.mData.set(i, result);
1467 template<Index Log2Dim>
1468 template<
typename CombineOp,
typename OtherType>
1471 bool valueIsActive, CombineOp& op)
1474 args.
setBRef(value).setBIsActive(valueIsActive);
1476 bool result =
false, aVal = other.mBuffer.
mData.isOn(i);
1479 .setResultRef(result));
1480 mBuffer.mData.set(i, result);
1485 template<Index Log2Dim>
1486 template<
typename CombineOp,
typename OtherNodeT>
1489 bool valueIsActive, CombineOp& op)
1492 args.
setARef(value).setAIsActive(valueIsActive);
1494 bool result =
false, bVal = other.mBuffer.mData.isOn(i);
1497 .setResultRef(result));
1498 mBuffer.mData.set(i, result);
1503 template<Index Log2Dim>
1504 template<
typename CombineOp,
typename OtherNodeT>
1510 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1512 .setAIsActive(b0Val)
1514 .setBIsActive(b1Val)
1515 .setResultRef(result));
1516 mBuffer.mData.set(i, result);
1523 template<Index Log2Dim>
1524 template<
typename BBoxOp>
1528 if (op.template descent<LEVEL>()) {
1531 op.operator()<
LEVEL>(CoordBBox::createCube(i.getCoord(), 1));
1533 op.template operator()<
LEVEL>(CoordBBox::createCube(i.getCoord(), 1));
1546 template<Index Log2Dim>
1547 template<
typename VisitorOp>
1551 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1555 template<Index Log2Dim>
1556 template<
typename VisitorOp>
1560 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1564 template<Index Log2Dim>
1565 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1569 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1578 template<Index Log2Dim>
1579 template<
typename OtherLeafNodeType,
typename VisitorOp>
1584 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1588 template<Index Log2Dim>
1589 template<
typename OtherLeafNodeType,
typename VisitorOp>
1594 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1598 template<Index Log2Dim>
1601 typename OtherNodeT,
1603 typename ChildAllIterT,
1604 typename OtherChildAllIterT>
1609 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1610 "can't visit nodes of different sizes simultaneously");
1611 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1612 "can't visit nodes at different tree levels simultaneously");
1614 ChildAllIterT iter =
self.beginChildAll();
1615 OtherChildAllIterT otherIter = other.beginChildAll();
1617 for ( ; iter && otherIter; ++iter, ++otherIter) {
1618 op(iter, otherIter);
1626 template<Index Log2Dim>
1627 template<
typename IterT,
typename VisitorOp>
1631 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1635 template<Index Log2Dim>
1636 template<
typename IterT,
typename VisitorOp>
1640 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1644 template<Index Log2Dim>
1648 typename ChildAllIterT,
1649 typename OtherChildAllIterT>
1652 VisitorOp& op,
bool otherIsLHS)
1654 if (!otherIter)
return;
1657 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1658 op(otherIter, iter);
1661 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1662 op(iter, otherIter);
1671 #endif // OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1444
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:426
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeMask.h:246
DenseIter()
Definition: LeafNodeMask.h:652
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNodeMask.h:178
Buffer mBuffer
Bitmask representing the values AND state of voxels.
Definition: LeafNodeMask.h:759
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1049
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:198
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:503
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:549
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeMask.h:296
uint32_t Index32
Definition: Types.h:55
ValueAllIter endValueAll()
Definition: LeafNodeMask.h:701
ChildOnIter beginChildOn()
Definition: LeafNodeMask.h:707
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:591
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition: LeafNodeMask.h:137
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:185
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1612
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeMask.h:708
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:551
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:886
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1461
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:589
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeMask.h:677
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1073
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeMask.h:653
void setActiveState(Index offset, bool on)
Set the active state of the voxel at the given offset but don't change its value. ...
Definition: LeafNodeMask.h:251
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeMask.h:711
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
static const Index LEVEL
Definition: LeafNode.h:78
bool ValueType
Definition: LeafNodeMask.h:58
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1059
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:181
ChildOnCIter endChildOn() const
Definition: LeafNodeMask.h:716
LeafNode specialization for values of type ValueMask that encodes both the active states and the bool...
Definition: LeafNodeMask.h:53
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeMask.h:674
ValueOffIter endValueOff()
Definition: LeafNodeMask.h:698
ValueOnCIter beginValueOn() const
Definition: LeafNodeMask.h:684
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
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeMask.h:271
Index64 offLeafVoxelCount() const
Definition: LeafNodeMask.h:148
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeMask.h:650
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeMask.h:155
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1507
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:502
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeMask.h:417
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
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:557
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition: LeafNodeMask.h:135
ValueOffCIter cendValueOff() const
Definition: LeafNodeMask.h:696
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:437
void visit(VisitorOp &)
Definition: LeafNode.h:1888
bool isValueMaskOn(Index n) const
Definition: LeafNodeMask.h:728
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1585
void resetBackground(bool, bool)
no-op since for this temaplte specialization voxel values and states are indistinguishable.
Definition: LeafNodeMask.h:464
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeMask.h:269
bool isChildMaskOff(Index) const
Definition: LeafNodeMask.h:737
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:556
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
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeMask.h:353
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:555
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:510
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:424
ChildOffCIter endChildOff() const
Definition: LeafNodeMask.h:719
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeMask.h:641
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:186
ValueAllCIter beginValueAll() const
Definition: LeafNodeMask.h:690
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1349
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeMask.h:261
bool isChildMaskOff() const
Definition: LeafNodeMask.h:738
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeMask.h:676
ChildAllCIter beginChildAll() const
Definition: LeafNodeMask.h:712
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:221
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeMask.h:422
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeMask.h:606
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeMask.h:61
ValueType * mData
Definition: LeafBuffer.h:174
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:346
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1865
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:314
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeMask.h:127
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:553
const bool & getItem(Index pos) const
Definition: LeafNodeMask.h:619
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:547
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
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1801
ChildAllCIter endChildAll() const
Definition: LeafNodeMask.h:722
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeMask.h:299
bool isValueMaskOff() const
Definition: LeafNodeMask.h:731
const NodeMaskType & getValueMask() const
Definition: LeafNodeMask.h:732
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeMask.h:144
ChildAllCIter cendChildAll() const
Definition: LeafNodeMask.h:721
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeMask.h:762
ValueAllCIter cendValueAll() const
Definition: LeafNodeMask.h:699
void negate()
Invert the bits of the voxels, i.e. states and values.
Definition: LeafNodeMask.h:467
ValueOnIter endValueOn()
Definition: LeafNodeMask.h:695
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:61
ValueOnCIter cendValueOn() const
Definition: LeafNodeMask.h:693
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeMask.h:391
void setValueMaskOn(Index n)
Definition: LeafNodeMask.h:741
void setValueAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as active.
Definition: LeafNodeMask.h:363
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeMask.h:680
#define OPENVDB_VERSION_NAME
Definition: version.h:43
const bool & getValue() const
Definition: LeafNodeMask.h:620
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:315
static Index32 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition: LeafNodeMask.h:141
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
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition: LeafNodeMask.h:133
ValueAllIter beginValueAll()
Definition: LeafNodeMask.h:691
void setValueMaskOff(Index n)
Definition: LeafNodeMask.h:742
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeMask.h:165
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeMask.h:679
~LeafNode()
Destructor.
Definition: LeafNode.h:1029
ChildIter()
Definition: LeafNodeMask.h:640
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeMask.h:604
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:371
const Buffer & buffer() const
Definition: LeafNodeMask.h:215
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
static const Index NUM_VALUES
Definition: LeafNode.h:75
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1036
OffIterator beginOff() const
Definition: NodeMasks.h:354
ChildOffCIter cendChildOff() const
Definition: LeafNodeMask.h:718
ValueOffIter beginValueOff()
Definition: LeafNodeMask.h:688
Definition: NodeMasks.h:239
static Index64 onTileCount()
Definition: LeafNodeMask.h:149
Definition: Exceptions.h:39
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1920
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeMask.h:686
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1084
ValueAllCIter endValueAll() const
Definition: LeafNodeMask.h:700
ChildOnIter endChildOn()
Definition: LeafNodeMask.h:717
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:587
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1629
static Index64 offTileCount()
Definition: LeafNodeMask.h:150
ChildOnCIter beginChildOn() const
Definition: LeafNodeMask.h:706
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:317
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1313
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeMask.h:617
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeMask.h:153
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeMask.h:655
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:574
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
ValueOnCIter cbeginValueOn() const
Definition: LeafNodeMask.h:683
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeMask.h:670
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:206
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1759
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeMask.h:259
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeMask.h:689
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeMask.h:678
Definition: NodeMasks.h:270
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeMask.h:125
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
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...
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:143
ChildOffCIter beginChildOff() const
Definition: LeafNodeMask.h:709
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeMask.h:673
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1992
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeMask.h:294
void setValue(const Coord &xyz, bool val)
Set the value of the voxel at the given coordinates and mark the voxel as active. ...
Definition: LeafNodeMask.h:276
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeMask.h:301
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeMask.h:666
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:572
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:293
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeMask.h:426
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1100
static const Index SIZE
Definition: LeafNode.h:77
uint64_t Index64
Definition: Types.h:56
ChildAllIter endChildAll()
Definition: LeafNodeMask.h:723
const NodeMaskType & valueMask() const
Definition: LeafNode.h:888
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
Definition: NodeMasks.h:208
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeMask.h:475
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1543
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1471
ChildAllIter beginChildAll()
Definition: LeafNodeMask.h:713
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeMask.h:672
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeMask.h:460
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:586
void setValueMask(Index n, bool on)
Definition: LeafNodeMask.h:740
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1945
LeafNode()
Default constructor.
Definition: LeafNode.h:943
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeMask.h:671
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeMask.h:304
ChildOffIter beginChildOff()
Definition: LeafNodeMask.h:710
ValueOffCIter beginValueOff() const
Definition: LeafNodeMask.h:687
bool isChildMaskOn(Index) const
Definition: LeafNodeMask.h:736
void setValueOnly(Index offset, bool val)
Set the value of the voxel at the given offset but don't change its active state. ...
Definition: LeafNodeMask.h:256
Definition: PointDataGrid.h:192
std::shared_ptr< T > SharedPtr
Definition: Types.h:130
ValueOnCIter endValueOn() const
Definition: LeafNodeMask.h:694
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeMask.h:632
bool isValueMaskOn() const
Definition: LeafNodeMask.h:729
ValueIter()
Definition: LeafNodeMask.h:616
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNodeMask.h:131
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
void setItem(Index pos, bool value) const
Definition: LeafNodeMask.h:623
static const Index LOG2DIM
Definition: LeafNode.h:72
ChildOnCIter cendChildOn() const
Definition: LeafNodeMask.h:715
void setActiveStateAndCache(const Coord &xyz, bool on, AccessorT &)
Set the active state of the voxel at the given coordinates without changing its value.
Definition: LeafNodeMask.h:400
LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeMask.h:570
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1481
ValueOnIter beginValueOn()
Definition: LeafNodeMask.h:685
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
Buffer & buffer()
Definition: LeafNodeMask.h:216
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeMask.h:745
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: LeafNodeMask.h:383
void setValueOffAndCache(const Coord &xyz, bool value, AccessorT &)
Change the value of the voxel at the given coordinates and mark it as inactive.
Definition: LeafNodeMask.h:374
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
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:505
void swap(Buffer &other)
Exchange this node's data buffer with the given data buffer without changing the active states of the...
Definition: LeafNodeMask.h:214
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeMask.h:705
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: LeafNodeMask.h:409
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1968
int32_t Int32
Definition: Types.h:59
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:427
Index32 Index
Definition: Types.h:57
boost::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:212
bool isValueMaskOff(Index n) const
Definition: LeafNodeMask.h:730
void denseFill(const CoordBBox &bbox, bool value, bool=false)
Set all voxels within an axis-aligned box to the specified value.
Definition: LeafNodeMask.h:312
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:569
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1906
static const Index DIM
Definition: LeafNode.h:74
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeMask.h:735
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
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:58
ValueOffCIter endValueOff() const
Definition: LeafNodeMask.h:697
NodeMaskType & getValueMask()
Definition: LeafNodeMask.h:734
ChildOffIter endChildOff()
Definition: LeafNodeMask.h:720
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:324
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1561
const NodeMaskType & valueMask() const
Definition: LeafNodeMask.h:733
void merge(const LeafNode &)
Definition: LeafNode.h:1664
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeMask.h:675
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:472
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeMask.h:629
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeMask.h:681
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
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeMask.h:146
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeMask.h:358
void setValueOnlyAndCache(const Coord &xyz, bool val, AccessorT &)
Change the value of the voxel at the given coordinates but preserve its state.
Definition: LeafNodeMask.h:369
void setValue(bool value) const
Definition: LeafNodeMask.h:625
static Index32 leafCount()
Return the leaf count for this node, which is one.
Definition: LeafNodeMask.h:139
Index64 onLeafVoxelCount() const
Definition: LeafNodeMask.h:147
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNodeMask.h:129
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1321
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeMask.h:605