4 #ifndef OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
5 #define OPENVDB_TREE_LEAF_NODE_BOOL_HAS_BEEN_INCLUDED
16 #include <type_traits>
27 template<Index Log2Dim>
39 static const Index LOG2DIM = Log2Dim;
40 static const Index TOTAL = Log2Dim;
41 static const Index DIM = 1 << TOTAL;
42 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
43 static const Index NUM_VOXELS = NUM_VALUES;
44 static const Index SIZE = NUM_VALUES;
49 template<
typename ValueType>
54 template<
typename OtherNodeType>
55 struct SameConfiguration {
79 template<
typename OtherValueType>
83 template<
typename ValueType>
89 template<
typename ValueType>
91 template<
typename ValueType>
126 bool isEmpty()
const {
return mValueMask.isOff(); }
128 bool isDense()
const {
return mValueMask.isOn(); }
145 void evalActiveBoundingBox(
CoordBBox& bbox,
bool visitVoxels =
true)
const;
168 #if OPENVDB_ABI_VERSION_NUMBER >= 9
176 std::string str()
const;
180 template<
typename OtherType, Index OtherLog2Dim>
200 void readTopology(std::istream&,
bool fromHalf =
false);
202 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
205 void readBuffers(std::istream&,
bool fromHalf =
false);
206 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
208 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
214 const bool& getValue(
const Coord& xyz)
const;
216 const bool& getValue(
Index offset)
const;
221 bool probeValue(
const Coord& xyz,
bool& val)
const;
227 void setActiveState(
const Coord& xyz,
bool on);
232 void setValueOnly(
const Coord& xyz,
bool val);
234 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
242 void setValueOff(
const Coord& xyz,
bool val);
244 void setValueOff(
Index offset,
bool val);
252 void setValueOn(
const Coord& xyz,
bool val);
256 void setValueOn(
Index offset,
bool val);
260 template<
typename ModifyOp>
261 void modifyValue(
Index offset,
const ModifyOp& op);
264 template<
typename ModifyOp>
265 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
268 template<
typename ModifyOp>
269 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
277 bool isValueOn(
const Coord& xyz)
const {
return mValueMask.isOn(this->coordToOffset(xyz)); }
279 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mValueMask.isOn(offset); }
293 void fill(
const bool&
value);
295 void fill(
const bool&
value,
bool active);
308 template<
typename DenseT>
327 template<
typename DenseT>
332 template<
typename AccessorT>
337 template<
typename AccessorT>
342 template<
typename AccessorT>
348 template<
typename AccessorT>
353 template<
typename AccessorT>
356 this->setValueOff(xyz,
value);
362 template<
typename ModifyOp,
typename AccessorT>
365 this->modifyValue(xyz, op);
370 template<
typename ModifyOp,
typename AccessorT>
373 this->modifyValueAndActiveState(xyz, op);
379 template<
typename AccessorT>
382 this->setActiveState(xyz, on);
388 template<
typename AccessorT>
391 return this->probeValue(xyz, val);
396 template<
typename AccessorT>
402 const bool&
getFirstValue()
const {
if (mValueMask.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
406 const bool&
getLastValue()
const {
if (mValueMask.isOn(SIZE-1))
return Buffer::sOn;
else return Buffer::sOff; }
411 bool isConstant(
bool& constValue,
bool& state,
bool tolerance = 0)
const;
418 bool medianAll()
const;
439 void resetBackground(
bool oldBackground,
bool newBackground);
441 void negate() { mBuffer.mData.toggle(); }
443 template<MergePolicy Policy>
444 void merge(
const LeafNode& other,
bool bg =
false,
bool otherBG =
false);
445 template<MergePolicy Policy>
void merge(
bool tileValue,
bool tileActive);
457 template<
typename OtherType>
471 template<
typename OtherType>
485 template<
typename OtherType>
488 template<
typename CombineOp>
490 template<
typename CombineOp>
491 void combine(
bool,
bool valueIsActive, CombineOp& op);
493 template<
typename CombineOp,
typename OtherType >
494 void combine2(
const LeafNode& other,
const OtherType&,
bool valueIsActive, CombineOp&);
495 template<
typename CombineOp,
typename OtherNodeT >
496 void combine2(
bool,
const OtherNodeT& other,
bool valueIsActive, CombineOp&);
497 template<
typename CombineOp,
typename OtherNodeT >
498 void combine2(
const LeafNode& b0,
const OtherNodeT& b1, CombineOp&);
504 template<
typename BBoxOp>
void visitActiveBBox(BBoxOp&)
const;
506 template<
typename VisitorOp>
void visit(VisitorOp&);
507 template<
typename VisitorOp>
void visit(VisitorOp&)
const;
509 template<
typename OtherLeafNodeType,
typename VisitorOp>
510 void visit2Node(OtherLeafNodeType& other, VisitorOp&);
511 template<
typename OtherLeafNodeType,
typename VisitorOp>
512 void visit2Node(OtherLeafNodeType& other, VisitorOp&)
const;
513 template<
typename IterT,
typename VisitorOp>
514 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false);
515 template<
typename IterT,
typename VisitorOp>
516 void visit2(IterT& otherIter, VisitorOp&,
bool otherIsLHS =
false)
const;
522 template<
typename AccessorT>
524 template<
typename NodeT>
526 template<
typename NodeT>
528 template<
typename NodeT>
530 template<
typename ArrayT>
void getNodes(ArrayT&)
const {}
534 void addTile(
Index level,
const Coord&,
bool val,
bool active);
535 void addTile(
Index offset,
bool val,
bool active);
536 template<
typename AccessorT>
537 void addTileAndCache(
Index level,
const Coord&,
bool val,
bool active, AccessorT&);
542 template<
typename AccessorT>
545 template<
typename AccessorT>
547 template<
typename NodeT,
typename AccessorT>
552 return reinterpret_cast<NodeT*
>(
this);
559 template<
typename AccessorT>
562 template<
typename AccessorT>
564 template<
typename NodeT,
typename AccessorT>
569 return reinterpret_cast<const NodeT*
>(
this);
582 template<
typename MaskIterT,
typename NodeT,
typename ValueT>
586 public SparseIteratorBase<MaskIterT, ValueIter<MaskIterT, NodeT, ValueT>, NodeT, ValueT>
593 const bool&
getItem(
Index pos)
const {
return this->parent().getValue(pos); }
594 const bool&
getValue()
const {
return this->getItem(this->pos()); }
602 template<
typename ModifyOp>
603 void modifyItem(
Index n,
const ModifyOp& op)
const { this->parent().modifyValue(n, op); }
605 template<
typename ModifyOp>
606 void modifyValue(
const ModifyOp& op)
const { this->modifyItem(this->pos(), op); }
610 template<
typename MaskIterT,
typename NodeT>
616 MaskIterT, ChildIter<MaskIterT, NodeT>, NodeT, bool>(iter, parent) {}
619 template<
typename NodeT,
typename ValueT>
621 MaskDenseIter, DenseIter<NodeT, ValueT>, NodeT, void, ValueT>
631 value = this->parent().getValue(pos);
640 void unsetItem(
Index pos,
const ValueT& val)
const {this->parent().setValueOnly(pos, val);}
645 using ValueOnCIter = ValueIter<MaskOnIter, const LeafNode, const bool>;
721 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
722 static inline void doVisit(NodeT&, VisitorOp&);
724 template<
typename NodeT,
typename OtherNodeT,
typename VisitorOp,
725 typename ChildAllIterT,
typename OtherChildAllIterT>
726 static inline void doVisit2Node(NodeT&
self, OtherNodeT& other, VisitorOp&);
728 template<
typename NodeT,
typename VisitorOp,
729 typename ChildAllIterT,
typename OtherChildAllIterT>
730 static inline void doVisit2(NodeT&
self, OtherChildAllIterT&, VisitorOp&,
bool otherIsLHS);
739 #if OPENVDB_ABI_VERSION_NUMBER >= 9
770 template<Index Log2Dim>
778 template<Index Log2Dim>
783 , mOrigin(xyz & (~(DIM - 1)))
788 template<Index Log2Dim>
793 , mOrigin(xyz & (~(DIM - 1)))
801 template<Index Log2Dim>
804 : mValueMask(other.valueMask())
805 , mBuffer(other.mBuffer)
806 , mOrigin(other.mOrigin)
807 #if OPENVDB_ABI_VERSION_NUMBER >= 9
808 , mTransientData(other.mTransientData)
815 template<Index Log2Dim>
816 template<
typename ValueT>
819 : mValueMask(other.valueMask())
820 , mOrigin(other.origin())
821 #if OPENVDB_ABI_VERSION_NUMBER >= 9
822 , mTransientData(other.mTransientData)
827 static inline bool convertValue(
const ValueT& val) {
return bool(val); }
831 mBuffer.
setValue(i, Local::convertValue(other.mBuffer[i]));
836 template<Index Log2Dim>
837 template<
typename ValueT>
841 : mValueMask(other.valueMask())
842 , mBuffer(background)
843 , mOrigin(other.origin())
844 #if OPENVDB_ABI_VERSION_NUMBER >= 9
845 , mTransientData(other.mTransientData)
851 template<Index Log2Dim>
852 template<
typename ValueT>
855 : mValueMask(other.valueMask())
856 , mBuffer(other.valueMask())
857 , mOrigin(other.origin())
858 #if OPENVDB_ABI_VERSION_NUMBER >= 9
859 , mTransientData(other.mTransientData)
865 template<Index Log2Dim>
866 template<
typename ValueT>
870 : mValueMask(other.valueMask())
871 , mBuffer(other.valueMask())
872 , mOrigin(other.origin())
873 #if OPENVDB_ABI_VERSION_NUMBER >= 9
874 , mTransientData(other.mTransientData)
877 if (offValue) {
if (!onValue) mBuffer.
mData.toggle();
else mBuffer.
mData.setOn(); }
881 template<Index Log2Dim>
891 template<Index Log2Dim>
896 return sizeof(*this);
900 template<Index Log2Dim>
905 return sizeof(*this);
909 template<Index Log2Dim>
914 if (bbox.
isInside(this_bbox))
return;
918 for(; iter; ++iter) this_bbox.
expand(this->offsetToLocalCoord(iter.pos()));
926 template<Index Log2Dim>
927 template<
typename OtherType, Index OtherLog2Dim>
932 return (Log2Dim == OtherLog2Dim && mValueMask == other->
getValueMask());
936 template<Index Log2Dim>
940 std::ostringstream ostr;
941 ostr <<
"LeafNode @" << mOrigin <<
": ";
942 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mValueMask.
isOn(n) ?
'#' :
'.');
950 template<Index Log2Dim>
954 assert ((xyz[0] & (
DIM-1u)) <
DIM && (xyz[1] & (
DIM-1u)) <
DIM && (xyz[2] & (
DIM-1u)) <
DIM);
955 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
956 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
957 + (xyz[2] & (
DIM-1u));
961 template<Index Log2Dim>
965 assert(n < (1 << 3*Log2Dim));
967 xyz.
setX(n >> 2*Log2Dim);
968 n &= ((1 << 2*Log2Dim) - 1);
969 xyz.
setY(n >> Log2Dim);
970 xyz.
setZ(n & ((1 << Log2Dim) - 1));
975 template<Index Log2Dim>
986 template<Index Log2Dim>
994 template<Index Log2Dim>
1002 template<Index Log2Dim>
1012 bool background =
false;
1014 background = *
static_cast<const bool*
>(bgPtr);
1016 this->
clip(clipBBox, background);
1020 template<Index Log2Dim>
1025 mValueMask.
load(is);
1031 mBuffer.
mData.load(is);
1036 int8_t numBuffers = 0;
1037 is.read(
reinterpret_cast<char*
>(&numBuffers),
sizeof(int8_t));
1041 std::unique_ptr<bool[]> buf{
new bool[
SIZE]};
1042 io::readData<bool>(is, buf.get(),
SIZE,
true);
1045 mBuffer.
mData.setOff();
1047 if (buf[i]) mBuffer.
mData.setOn(i);
1050 if (numBuffers > 1) {
1053 for (
int i = 1; i < numBuffers; ++i) {
1054 io::readData<bool>(is, buf.get(),
SIZE,
true);
1061 template<Index Log2Dim>
1066 mValueMask.
save(os);
1068 os.write(
reinterpret_cast<const char*
>(&mOrigin),
sizeof(
Coord::ValueType) * 3);
1070 mBuffer.
mData.save(os);
1077 template<Index Log2Dim>
1081 return mOrigin == other.mOrigin &&
1083 mBuffer == other.mBuffer;
1087 template<Index Log2Dim>
1098 template<Index Log2Dim>
1102 if (!mValueMask.
isConstant(state))
return false;
1105 if (!tolerance && !(mBuffer.
mData.isOn() || mBuffer.
mData.isOff()))
return false;
1107 constValue = mBuffer.
mData.isOn();
1113 template<Index Log2Dim>
1117 const Index countTrue = mBuffer.
mData.countOn();
1121 template<Index Log2Dim>
1131 template<Index Log2Dim>
1144 template<Index Log2Dim>
1151 template<Index Log2Dim>
1155 assert(offset <
SIZE);
1160 template<Index Log2Dim>
1161 template<
typename AccessorT>
1164 bool val,
bool active, AccessorT&)
1166 this->
addTile(level, xyz, val, active);
1173 template<Index Log2Dim>
1178 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1182 template<Index Log2Dim>
1186 assert(offset <
SIZE);
1188 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1192 template<Index Log2Dim>
1197 val = mBuffer.
mData.isOn(offset);
1198 return mValueMask.
isOn(offset);
1202 template<Index Log2Dim>
1210 template<Index Log2Dim>
1214 assert(offset <
SIZE);
1215 mValueMask.
setOn(offset);
1216 mBuffer.
mData.set(offset, val);
1220 template<Index Log2Dim>
1228 template<Index Log2Dim>
1236 template<Index Log2Dim>
1244 template<Index Log2Dim>
1248 assert(offset <
SIZE);
1249 mValueMask.
setOff(offset);
1250 mBuffer.
mData.set(offset, val);
1254 template<Index Log2Dim>
1255 template<
typename ModifyOp>
1259 bool val = mBuffer.
mData.isOn(offset);
1261 mBuffer.
mData.set(offset, val);
1262 mValueMask.
setOn(offset);
1266 template<Index Log2Dim>
1267 template<
typename ModifyOp>
1275 template<Index Log2Dim>
1276 template<
typename ModifyOp>
1281 bool val = mBuffer.
mData.isOn(offset), state = mValueMask.
isOn(offset);
1283 mBuffer.
mData.set(offset, val);
1284 mValueMask.
set(offset, state);
1291 template<Index Log2Dim>
1295 if (newBackground != oldBackground) {
1299 mBuffer.
mData = (mBuffer.
mData & mValueMask) | bgMask;
1307 template<Index Log2Dim>
1308 template<MergePolicy Policy>
1315 const Index n = iter.pos();
1316 if (mValueMask.
isOff(n)) {
1317 mBuffer.
mData.set(n, other.mBuffer.
mData.isOn(n));
1318 mValueMask.
setOn(n);
1324 template<Index Log2Dim>
1325 template<MergePolicy Policy>
1331 if (!tileActive)
return;
1333 if (tileValue) mBuffer.
mData |= !mValueMask;
1334 else mBuffer.
mData &= mValueMask;
1343 template<Index Log2Dim>
1344 template<
typename OtherType>
1352 template<Index Log2Dim>
1353 template<
typename OtherType>
1362 template<Index Log2Dim>
1363 template<
typename OtherType>
1375 template<Index Log2Dim>
1382 this->
fill(nodeBBox, background,
false);
1383 }
else if (clipBBox.
isInside(nodeBBox)) {
1395 int &x = xyz.
x(), &y = xyz.
y(), &z = xyz.
z();
1396 for (x = nodeBBox.
min().
x(); x <= nodeBBox.
max().
x(); ++x) {
1397 for (y = nodeBBox.
min().
y(); y <= nodeBBox.
max().
y(); ++y) {
1398 for (z = nodeBBox.
min().
z(); z <= nodeBBox.
max().
z(); ++z) {
1415 template<Index Log2Dim>
1420 clippedBBox.intersect(bbox);
1421 if (!clippedBBox)
return;
1423 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1424 const Index offsetX = (x & (
DIM-1u))<<2*Log2Dim;
1425 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1426 const Index offsetXY = offsetX + ((y & (
DIM-1u))<< Log2Dim);
1427 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1428 const Index offset = offsetXY + (z & (
DIM-1u));
1429 mValueMask.
set(offset, active);
1436 template<Index Log2Dim>
1443 template<Index Log2Dim>
1448 mValueMask.
set(active);
1455 template<Index Log2Dim>
1456 template<
typename DenseT>
1460 using DenseValueType =
typename DenseT::ValueType;
1462 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1463 const Coord&
min = dense.bbox().min();
1464 DenseValueType* t0 = dense.data() + zStride * (bbox.
min()[2] -
min[2]);
1466 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1467 DenseValueType* t1 = t0 + xStride * (x -
min[0]);
1469 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1470 DenseValueType* t2 = t1 + yStride * (y -
min[1]);
1472 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2] + 1; z < ez; ++z, t2 += zStride) {
1473 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1480 template<Index Log2Dim>
1481 template<
typename DenseT>
1484 bool background,
bool tolerance)
1486 using DenseValueType =
typename DenseT::ValueType;
1488 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1491 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1492 const Coord&
min = dense.bbox().min();
1493 const DenseValueType* s0 = dense.data() + zStride * (bbox.
min()[2] -
min[2]);
1495 for (
Int32 x = bbox.
min()[0], ex = bbox.
max()[0] + 1; x < ex; ++x) {
1496 const DenseValueType* s1 = s0 + xStride * (x -
min[0]);
1498 for (
Int32 y = bbox.
min()[1], ey = bbox.
max()[1] + 1; y < ey; ++y) {
1499 const DenseValueType* s2 = s1 + yStride * (y -
min[1]);
1501 for (
Int32 z = bbox.
min()[2], ez = bbox.
max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1503 if (tolerance || (background == Local::toBool(*s2))) {
1505 mBuffer.
mData.set(n2, background);
1507 mValueMask.
setOn(n2);
1508 mBuffer.
mData.set(n2, Local::toBool(*s2));
1519 template<Index Log2Dim>
1520 template<
typename CombineOp>
1526 bool result =
false, aVal = mBuffer.
mData.isOn(i), bVal = other.mBuffer.
mData.isOn(i);
1533 mBuffer.
mData.set(i, result);
1538 template<Index Log2Dim>
1539 template<
typename CombineOp>
1546 bool result =
false, aVal = mBuffer.
mData.isOn(i);
1551 mBuffer.
mData.set(i, result);
1559 template<Index Log2Dim>
1560 template<
typename CombineOp,
typename OtherType>
1563 bool valueIsActive, CombineOp& op)
1568 bool result =
false, aVal = other.mBuffer.
mData.isOn(i);
1573 mBuffer.
mData.set(i, result);
1578 template<Index Log2Dim>
1579 template<
typename CombineOp,
typename OtherNodeT>
1582 bool valueIsActive, CombineOp& op)
1587 bool result =
false, bVal = other.mBuffer.mData.isOn(i);
1592 mBuffer.
mData.set(i, result);
1597 template<Index Log2Dim>
1598 template<
typename CombineOp,
typename OtherNodeT>
1607 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1614 mBuffer.
mData.set(i, result);
1621 template<Index Log2Dim>
1622 template<
typename BBoxOp>
1626 if (op.template descent<LEVEL>()) {
1636 template<Index Log2Dim>
1637 template<
typename VisitorOp>
1641 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1645 template<Index Log2Dim>
1646 template<
typename VisitorOp>
1650 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1654 template<Index Log2Dim>
1655 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1659 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1668 template<Index Log2Dim>
1669 template<
typename OtherLeafNodeType,
typename VisitorOp>
1674 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1678 template<Index Log2Dim>
1679 template<
typename OtherLeafNodeType,
typename VisitorOp>
1684 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1688 template<Index Log2Dim>
1691 typename OtherNodeT,
1693 typename ChildAllIterT,
1694 typename OtherChildAllIterT>
1699 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1700 "can't visit nodes of different sizes simultaneously");
1701 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1702 "can't visit nodes at different tree levels simultaneously");
1704 ChildAllIterT iter =
self.beginChildAll();
1705 OtherChildAllIterT otherIter = other.beginChildAll();
1707 for ( ; iter && otherIter; ++iter, ++otherIter) {
1708 op(iter, otherIter);
1716 template<Index Log2Dim>
1717 template<
typename IterT,
typename VisitorOp>
1721 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1725 template<Index Log2Dim>
1726 template<
typename IterT,
typename VisitorOp>
1730 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1734 template<Index Log2Dim>
1738 typename ChildAllIterT,
1739 typename OtherChildAllIterT>
1742 VisitorOp& op,
bool otherIsLHS)
1744 if (!otherIter)
return;
1747 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1748 op(otherIter, iter);
1751 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1752 op(iter, otherIter);
ValueT value
Definition: GridBuilder.h:1287
ChildT * child
Definition: GridBuilder.h:1286
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: Types.h:530
CombineArgs & setResultRef(AValueType &val)
Redirect the result value to a new external destination.
Definition: Types.h:586
CombineArgs & setBIsActive(bool b)
Set the active state of the B value.
Definition: Types.h:598
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: Types.h:582
CombineArgs & setAIsActive(bool b)
Set the active state of the A value.
Definition: Types.h:596
bool resultIsActive() const
Definition: Types.h:593
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: Types.h:584
Tag dispatch class that distinguishes constructors during file input.
Definition: Types.h:650
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:644
Axis-aligned bounding box of signed integer coordinates.
Definition: Coord.h:249
const Coord & min() const
Definition: Coord.h:321
void translate(const Coord &t)
Translate this bounding box by (tx, ty, tz).
Definition: Coord.h:458
void expand(ValueType padding)
Pad this bounding box with the specified padding.
Definition: Coord.h:418
const Coord & max() const
Definition: Coord.h:322
bool hasOverlap(const CoordBBox &b) const
Return true if the given bounding box overlaps with this bounding box.
Definition: Coord.h:412
bool isInside(const Coord &xyz) const
Return true if point (x, y, z) is inside this bounding box.
Definition: Coord.h:400
void intersect(const CoordBBox &bbox)
Intersect this bounding box with the given bounding box.
Definition: Coord.h:444
void reset()
Definition: Coord.h:327
static CoordBBox createCube(const Coord &min, ValueType dim)
Definition: Coord.h:313
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:25
Int32 ValueType
Definition: Coord.h:32
Coord & setX(Int32 x)
Definition: Coord.h:79
Int32 y() const
Definition: Coord.h:131
Coord & setY(Int32 y)
Definition: Coord.h:80
Int32 x() const
Definition: Coord.h:130
Int32 z() const
Definition: Coord.h:132
Coord & setZ(Int32 z)
Definition: Coord.h:81
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:30
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:226
ValueType * mData
Definition: LeafBuffer.h:126
void setValue(Index i, const ValueType &)
Set the i'th value of this buffer to the specified value.
Definition: LeafBuffer.h:190
LeafNode specialization for values of type bool that stores both the active states and the values of ...
Definition: LeafNodeBool.h:29
void stealNodes(ArrayT &, const ValueType &, bool)
Definition: LeafNodeBool.h:531
const NodeMaskType & valueMask() const
Definition: LeafNodeBool.h:707
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeBool.h:279
static Index64 onTileCount()
Definition: LeafNodeBool.h:122
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Definition: LeafNodeBool.h:157
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeBool.h:679
bool BuildType
Definition: LeafNodeBool.h:32
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition: LeafNodeBool.h:149
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeBool.h:249
bool isChildMaskOn(Index) const
Definition: LeafNodeBool.h:710
ChildOnCIter beginChildOn() const
Definition: LeafNodeBool.h:680
ChildOnIter beginChildOn()
Definition: LeafNodeBool.h:681
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:277
ValueOnIter endValueOn()
Definition: LeafNodeBool.h:669
LeafNode * probeLeaf(const Coord &)
Definition: LeafNodeBool.h:544
bool isChildMaskOff() const
Definition: LeafNodeBool.h:712
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeBool.h:660
Index32 transientData() const
Return the transient data value.
Definition: LeafNodeBool.h:170
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Definition: LeafNodeBool.h:565
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeBool.h:36
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Definition: LeafNodeBool.h:548
static Index getChildDim()
Definition: LeafNodeBool.h:109
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeBool.h:709
ChildOnIter endChildOn()
Definition: LeafNodeBool.h:691
ValueAllIter endValueAll()
Definition: LeafNodeBool.h:675
bool isValueMaskOff() const
Definition: LeafNodeBool.h:705
LeafNode(const LeafNode< ValueType, Log2Dim > &other, bool offValue, bool onValue, TopologyCopy)
Topology copy constructor.
void prune(const ValueType &=zeroVal< ValueType >())
This function exists only to enable template instantiation.
Definition: LeafNodeBool.h:520
bool isValueMaskOn() const
Definition: LeafNodeBool.h:703
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeBool.h:655
void getNodes(ArrayT &) const
Definition: LeafNodeBool.h:530
NodeMaskType mValueMask
Bitmask that determines which voxels are active.
Definition: LeafNodeBool.h:734
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeBool.h:274
ValueAllCIter endValueAll() const
Definition: LeafNodeBool.h:674
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeBool.h:651
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeBool.h:406
Index64 onLeafVoxelCount() const
Definition: LeafNodeBool.h:120
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:234
ChildOffCIter endChildOff() const
Definition: LeafNodeBool.h:693
NodeT * stealNode(const Coord &, const ValueType &, bool)
Definition: LeafNodeBool.h:525
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Definition: LeafNodeBool.h:563
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeBool.h:663
ValueOnCIter beginValueOn() const
Definition: LeafNodeBool.h:658
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:290
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeBool.h:719
void setValueMaskOn(Index n)
Definition: LeafNodeBool.h:715
Index64 offLeafVoxelCount() const
Definition: LeafNodeBool.h:121
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeBool.h:402
const NodeMaskType & getValueMask() const
Definition: LeafNodeBool.h:706
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:152
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeBool.h:224
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeBool.h:578
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeBool.h:437
Buffer mBuffer
Bitmask representing the values of voxels.
Definition: LeafNodeBool.h:736
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeBool.h:645
bool isValueMaskOff(Index n) const
Definition: LeafNodeBool.h:704
ValueOnCIter cendValueOn() const
Definition: LeafNodeBool.h:667
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNodeBool.h:132
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Definition: LeafNodeBool.h:543
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeBool.h:397
static Index numValues()
Definition: LeafNodeBool.h:106
ValueOffCIter beginValueOff() const
Definition: LeafNodeBool.h:661
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Definition: LeafNodeBool.h:560
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeBool.h:646
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeBool.h:685
Buffer & buffer()
Definition: LeafNodeBool.h:194
ChildOffIter endChildOff()
Definition: LeafNodeBool.h:694
ChildAllIter beginChildAll()
Definition: LeafNodeBool.h:687
static Index getLevel()
Definition: LeafNodeBool.h:107
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeBool.h:338
void addLeaf(LeafNode *)
Definition: LeafNodeBool.h:521
NodeMaskType & getValueMask()
Definition: LeafNodeBool.h:708
const Buffer & buffer() const
Definition: LeafNodeBool.h:193
ValueOnIter beginValueOn()
Definition: LeafNodeBool.h:659
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:363
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:354
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeBool.h:653
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeBool.h:648
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeBool.h:682
ChildOffIter beginChildOff()
Definition: LeafNodeBool.h:684
bool isChildMaskOff(Index) const
Definition: LeafNodeBool.h:711
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeBool.h:117
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeBool.h:579
ChildOffCIter beginChildOff() const
Definition: LeafNodeBool.h:683
LeafNode(const LeafNode< ValueType, Log2Dim > &other, bool background, TopologyCopy)
static Index64 offTileCount()
Definition: LeafNodeBool.h:123
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeBool.h:237
bool ValueType
Definition: LeafNodeBool.h:33
ValueOffIter endValueOff()
Definition: LeafNodeBool.h:672
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeBool.h:239
ChildAllCIter endChildAll() const
Definition: LeafNodeBool.h:696
ValueOnCIter cbeginValueOn() const
Definition: LeafNodeBool.h:657
LeafNode * touchLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeBool.h:541
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeBool.h:102
const LeafNode * probeConstLeaf(const Coord &) const
Definition: LeafNodeBool.h:561
static void getNodeLog2Dims(std::vector< Index > &dims)
Definition: LeafNodeBool.h:108
ChildOnCIter endChildOn() const
Definition: LeafNodeBool.h:690
static Index32 nonLeafCount()
Definition: LeafNodeBool.h:114
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Definition: LeafNodeBool.h:546
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:389
ChildOnCIter cendChildOn() const
Definition: LeafNodeBool.h:689
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeBool.h:282
ChildAllCIter cendChildAll() const
Definition: LeafNodeBool.h:695
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeBool.h:644
const NodeT * probeConstNode(const Coord &) const
Definition: LeafNodeBool.h:529
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:349
LeafNode & operator=(const LeafNode &)=default
Deep assignment operator.
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeBool.h:654
ChildAllIter endChildAll()
Definition: LeafNodeBool.h:697
void setValueMask(Index n, bool on)
Definition: LeafNodeBool.h:714
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeBool.h:119
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeBool.h:333
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:192
ValueAllCIter cendValueAll() const
Definition: LeafNodeBool.h:673
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeBool.h:650
LeafNode(const LeafNode< ValueType, Log2Dim > &other, TopologyCopy)
Topology copy constructor.
void negate()
Definition: LeafNodeBool.h:441
ChildAllCIter beginChildAll() const
Definition: LeafNodeBool.h:686
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:380
const LeafNode * probeLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeBool.h:558
void getOrigin(Coord &origin) const
Definition: LeafNodeBool.h:156
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeBool.h:272
void setTransientData(Index32 transientData)
Set the transient data value.
Definition: LeafNodeBool.h:172
void nodeCount(std::vector< Index32 > &) const
no-op
Definition: LeafNodeBool.h:113
static Index size()
Definition: LeafNodeBool.h:105
ChildOffCIter cendChildOff() const
Definition: LeafNodeBool.h:692
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeBool.h:580
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeBool.h:126
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:343
ValueOffIter beginValueOff()
Definition: LeafNodeBool.h:662
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeBool.h:247
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:229
static Index32 leafCount()
Definition: LeafNodeBool.h:111
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeBool.h:136
void addLeafAndCache(LeafNode *, AccessorT &)
Definition: LeafNodeBool.h:523
ValueOffCIter cendValueOff() const
Definition: LeafNodeBool.h:670
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeBool.h:649
void setValueMaskOff(Index n)
Definition: LeafNodeBool.h:716
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeBool.h:155
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeBool.h:128
ValueOffCIter endValueOff() const
Definition: LeafNodeBool.h:671
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:254
ValueOnCIter endValueOn() const
Definition: LeafNodeBool.h:668
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeBool.h:449
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeBool.h:371
ValueAllCIter beginValueAll() const
Definition: LeafNodeBool.h:664
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeBool.h:738
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeBool.h:104
NodeT * probeNode(const Coord &)
Definition: LeafNodeBool.h:527
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeBool.h:652
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeBool.h:647
bool isValueMaskOn(Index n) const
Definition: LeafNodeBool.h:702
ValueAllIter beginValueAll()
Definition: LeafNodeBool.h:665
LeafNode(const LeafNode< OtherValueType, Log2Dim > &other)
Value conversion copy constructor.
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim....
Definition: LeafNode.h:38
void visit(VisitorOp &)
Definition: LeafNode.h:1872
const NodeMaskType & valueMask() const
Definition: LeafNode.h:877
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:297
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0,...
Definition: LeafNode.h:1062
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node.
Definition: LeafNode.h:167
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1976
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1318
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:1246
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:203
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:1273
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1087
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:1145
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1952
void topologyDifference(const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
Difference this node's set of active values with the active values of the other node,...
Definition: LeafNode.h:1732
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1589
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1547
~LeafNode()
Destructor.
Definition: LeafNode.h:1032
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1890
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1310
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1565
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1616
void resetBackground(const ValueType &oldBackground, const ValueType &newBackground)
Replace inactive occurrences of oldBackground with newBackground, and inactive occurrences of -oldBac...
Definition: LeafNode.h:1645
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:875
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:458
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1929
void topologyIntersection(const LeafNode< OtherType, Log2Dim > &other, const ValueType &)
Intersect this node's set of active values with the active values of the other node,...
Definition: LeafNode.h:1723
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1163
static const Index DIM
Definition: LeafNode.h:50
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:1137
void topologyUnion(const LeafNode< OtherType, Log2Dim > &other, const bool preserveTiles=false)
Union this node's set of active values with the active values of the other node, whose ValueType may ...
Definition: LeafNode.h:1715
static const Index LEVEL
Definition: LeafNode.h:54
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1052
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:409
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:1503
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:299
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1438
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1756
Index64 memUsageIfLoaded() const
Definition: LeafNode.h:1475
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1796
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:1203
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1857
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1346
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1511
friend class LeafNode
Definition: LeafNode.h:854
static const Index NUM_VALUES
Definition: LeafNode.h:51
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1076
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:328
static const Index LOG2DIM
Definition: LeafNode.h:48
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1455
static const Index SIZE
Definition: LeafNode.h:53
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1485
void merge(const LeafNode &)
Definition: LeafNode.h:1666
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:419
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1633
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:437
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:173
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1465
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1039
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1103
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:296
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1904
Definition: NodeMasks.h:271
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation.
Definition: NodeMasks.h:308
bool isOff(Index32 n) const
Return true if the nth bit is off.
Definition: NodeMasks.h:508
Index32 countOn() const
Return the total number of on bits.
Definition: NodeMasks.h:443
OnIterator beginOn() const
Definition: NodeMasks.h:352
OffIterator beginOff() const
Definition: NodeMasks.h:354
void set(Index32 n, bool On)
Set the nth bit to the specified state.
Definition: NodeMasks.h:462
bool isOn(Index32 n) const
Return true if the nth bit is on.
Definition: NodeMasks.h:502
bool isConstant(bool &isOn) const
Definition: NodeMasks.h:526
Index32 countOff() const
Return the total number of on bits.
Definition: NodeMasks.h:450
void load(std::istream &is)
Definition: NodeMasks.h:569
void save(std::ostream &os) const
Definition: NodeMasks.h:565
void setOff(Index32 n)
Set the nth bit off.
Definition: NodeMasks.h:457
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
Definition: NodeMasks.h:240
Definition: NodeMasks.h:209
OPENVDB_API const void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
OPENVDB_API uint32_t getFormatVersion(std::ios_base &)
Return the file format version number associated with the given input stream.
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:338
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:477
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:485
Index32 Index
Definition: Types.h:54
uint32_t Index32
Definition: Types.h:52
@ OPENVDB_FILE_VERSION_BOOL_LEAF_OPTIMIZATION
Definition: version.h.in:240
int32_t Int32
Definition: Types.h:56
uint64_t Index64
Definition: Types.h:53
std::shared_ptr< T > SharedPtr
Definition: Types.h:114
@ MERGE_NODES
Definition: Types.h:469
@ MERGE_ACTIVE_STATES_AND_NODES
Definition: Types.h:470
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition: AttributeTransferUtil.h:141
Definition: Exceptions.h:13
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:179
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:615
ChildIter()
Definition: LeafNodeBool.h:614
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeBool.h:629
DenseIter()
Definition: LeafNodeBool.h:626
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeBool.h:627
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeBool.h:624
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeBool.h:640
void setItem(Index pos, bool value) const
Definition: LeafNodeBool.h:597
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeBool.h:606
const bool & getValue() const
Definition: LeafNodeBool.h:594
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeBool.h:591
const bool & getItem(Index pos) const
Definition: LeafNodeBool.h:593
ValueIter()
Definition: LeafNodeBool.h:590
void setValue(bool value) const
Definition: LeafNodeBool.h:599
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeBool.h:603
Definition: LeafNode.h:924
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:115
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:116
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:202