4 #ifndef OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED 5 #define OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED 17 #include <type_traits> 29 template<Index Log2Dim>
41 static const Index LOG2DIM = Log2Dim;
42 static const Index TOTAL = Log2Dim;
43 static const Index DIM = 1 << TOTAL;
44 static const Index NUM_VALUES = 1 << 3 * Log2Dim;
45 static const Index NUM_VOXELS = NUM_VALUES;
46 static const Index SIZE = NUM_VALUES;
51 template<
typename OtherValueType>
56 template<
typename OtherNodeType>
57 struct SameConfiguration {
68 explicit LeafNode(
const Coord& xyz,
bool value =
false,
bool dummy =
false);
77 template<
typename OtherValueType>
81 template<
typename ValueType>
85 template<
typename ValueType>
89 template<
typename ValueType>
130 bool isEmpty()
const {
return mBuffer.mData.isOff(); }
132 bool isDense()
const {
return mBuffer.mData.isOn(); }
148 void evalActiveBoundingBox(CoordBBox& bbox,
bool visitVoxels =
true)
const;
155 void setOrigin(
const Coord& origin) { mOrigin = origin; }
157 const Coord& origin()
const {
return mOrigin; }
159 void getOrigin(Coord& origin)
const { origin = mOrigin; }
164 static Index coordToOffset(
const Coord& xyz);
167 static Coord offsetToLocalCoord(
Index n);
169 Coord offsetToGlobalCoord(
Index n)
const;
172 std::string str()
const;
176 template<
typename OtherType, Index OtherLog2Dim>
196 void readTopology(std::istream&,
bool fromHalf =
false);
198 void writeTopology(std::ostream&,
bool toHalf =
false)
const;
201 void readBuffers(std::istream&,
bool fromHalf =
false);
202 void readBuffers(std::istream& is,
const CoordBBox&,
bool fromHalf =
false);
204 void writeBuffers(std::ostream&,
bool toHalf =
false)
const;
210 const bool& getValue(
const Coord& xyz)
const;
212 const bool& getValue(
Index offset)
const;
217 bool probeValue(
const Coord& xyz,
bool& val)
const;
223 void setActiveState(
const Coord& xyz,
bool on);
228 void setValueOnly(
const Coord& xyz,
bool val);
230 void setValueOnly(
Index offset,
bool val) { assert(offset<SIZE); mBuffer.setValue(offset,val); }
233 void setValueOff(
const Coord& xyz) { mBuffer.mData.setOff(this->coordToOffset(xyz)); }
238 void setValueOff(
const Coord& xyz,
bool val);
240 void setValueOff(
Index offset,
bool val);
243 void setValueOn(
const Coord& xyz) { mBuffer.mData.setOn(this->coordToOffset(xyz)); }
248 void setValueOn(
const Coord& xyz,
bool val);
250 void setValue(
const Coord& xyz,
bool val) { this->setValueOn(xyz, val); }
252 void setValueOn(
Index offset,
bool val);
256 template<
typename ModifyOp>
257 void modifyValue(
Index offset,
const ModifyOp& op);
260 template<
typename ModifyOp>
261 void modifyValue(
const Coord& xyz,
const ModifyOp& op);
264 template<
typename ModifyOp>
265 void modifyValueAndActiveState(
const Coord& xyz,
const ModifyOp& op);
273 bool isValueOn(
const Coord& xyz)
const {
return mBuffer.mData.isOn(this->coordToOffset(xyz)); }
275 bool isValueOn(
Index offset)
const { assert(offset < SIZE);
return mBuffer.mData.isOn(offset); }
281 void clip(
const CoordBBox&,
bool background);
284 void fill(
const CoordBBox& bbox,
bool value,
bool =
false);
286 void denseFill(
const CoordBBox& bbox,
bool value,
bool =
false) { this->fill(bbox, value); }
289 void fill(
const bool& value,
bool dummy =
false);
302 template<
typename DenseT>
303 void copyToDense(
const CoordBBox& bbox, DenseT& dense)
const;
321 template<
typename DenseT>
322 void copyFromDense(
const CoordBBox& bbox,
const DenseT& dense,
bool background,
bool tolerance);
326 template<
typename AccessorT>
327 const bool&
getValueAndCache(
const Coord& xyz, AccessorT&)
const {
return this->getValue(xyz);}
331 template<
typename AccessorT>
336 template<
typename AccessorT>
337 void setValueAndCache(
const Coord& xyz,
bool val, AccessorT&) { this->setValueOn(xyz, val); }
342 template<
typename AccessorT>
347 template<
typename AccessorT>
350 this->setValueOff(xyz, value);
356 template<
typename ModifyOp,
typename AccessorT>
359 this->modifyValue(xyz, op);
364 template<
typename ModifyOp,
typename AccessorT>
367 this->modifyValueAndActiveState(xyz, op);
373 template<
typename AccessorT>
376 this->setActiveState(xyz, on);
382 template<
typename AccessorT>
385 return this->probeValue(xyz, val);
390 template<
typename AccessorT>
396 const bool&
getFirstValue()
const {
if (mBuffer.mData.isOn(0))
return Buffer::sOn;
else return Buffer::sOff; }
400 const bool&
getLastValue()
const {
if (mBuffer.mData.isOn(SIZE-1))
return Buffer::sOn;
else return Buffer::sOff; }
405 bool isConstant(
bool& constValue,
bool& state,
bool tolerance = 0)
const;
412 bool medianAll()
const;
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=
false);
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&);
540 LeafNode* touchLeaf(
const Coord&) {
return this; }
542 template<
typename AccessorT>
545 template<
typename AccessorT>
547 template<
typename NodeT,
typename AccessorT>
551 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
552 return reinterpret_cast<NodeT*
>(
this);
557 const LeafNode* probeLeaf(
const Coord&)
const {
return this; }
559 template<
typename AccessorT>
562 template<
typename AccessorT>
564 template<
typename NodeT,
typename AccessorT>
568 if (!(std::is_same<NodeT, LeafNode>::value))
return nullptr;
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()); }
597 void setItem(
Index pos,
bool value)
const { this->parent().setValueOnly(pos, value); }
599 void setValue(
bool value)
const { this->setItem(this->pos(), value); }
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);
766 template<Index Log2Dim>
773 template<Index Log2Dim>
776 : mBuffer(value || active)
777 , mOrigin(xyz & (~(
DIM - 1)))
782 template<Index Log2Dim>
785 : mBuffer(value || active)
786 , mOrigin(xyz & (~(
DIM - 1)))
791 template<Index Log2Dim>
794 : mBuffer(other.mBuffer)
795 , mOrigin(other.mOrigin)
801 template<Index Log2Dim>
802 template<
typename ValueT>
811 template<Index Log2Dim>
812 template<
typename ValueT>
822 template<Index Log2Dim>
823 template<
typename ValueT>
832 template<Index Log2Dim>
833 template<
typename ValueT>
840 if (offValue==
true) {
841 if (onValue==
false) {
842 mBuffer.
mData.toggle();
844 mBuffer.
mData.setOn();
850 template<Index Log2Dim>
860 template<Index Log2Dim>
865 return sizeof(*this);
869 template<Index Log2Dim>
874 if (bbox.isInside(this_bbox))
return;
878 for(; iter; ++iter) this_bbox.expand(this->offsetToLocalCoord(iter.pos()));
879 this_bbox.translate(this->
origin());
881 bbox.expand(this_bbox);
886 template<Index Log2Dim>
887 template<
typename OtherType, Index OtherLog2Dim>
896 template<Index Log2Dim>
900 std::ostringstream ostr;
901 ostr <<
"LeafNode @" << mOrigin <<
": ";
902 for (
Index32 n = 0; n <
SIZE; ++n) ostr << (mBuffer.
mData.isOn(n) ?
'#' :
'.');
910 template<Index Log2Dim>
914 assert ((xyz[0] & (
DIM-1u)) <
DIM && (xyz[1] & (
DIM-1u)) <
DIM && (xyz[2] & (
DIM-1u)) <
DIM);
915 return ((xyz[0] & (
DIM-1u)) << 2*Log2Dim)
916 + ((xyz[1] & (
DIM-1u)) << Log2Dim)
917 + (xyz[2] & (
DIM-1u));
921 template<Index Log2Dim>
925 assert(n < (1 << 3*Log2Dim));
927 xyz.setX(n >> 2*Log2Dim);
928 n &= ((1 << 2*Log2Dim) - 1);
929 xyz.setY(n >> Log2Dim);
930 xyz.setZ(n & ((1 << Log2Dim) - 1));
935 template<Index Log2Dim>
946 template<Index Log2Dim>
950 mBuffer.
mData.load(is);
954 template<Index Log2Dim>
958 mBuffer.
mData.save(os);
962 template<Index Log2Dim>
972 bool background =
false;
974 background = *
static_cast<const bool*
>(bgPtr);
976 this->
clip(clipBBox, background);
980 template<Index Log2Dim>
985 mBuffer.
mData.load(is);
987 is.read(reinterpret_cast<char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
991 template<Index Log2Dim>
996 mBuffer.
mData.save(os);
998 os.write(reinterpret_cast<const char*>(&mOrigin),
sizeof(Coord::ValueType) * 3);
1005 template<Index Log2Dim>
1009 return mOrigin == other.mOrigin && mBuffer == other.mBuffer;
1013 template<Index Log2Dim>
1024 template<Index Log2Dim>
1028 if (!mBuffer.
mData.isConstant(state))
return false;
1037 template<Index Log2Dim>
1041 const Index countTrue = mBuffer.
mData.countOn();
1045 template<Index Log2Dim>
1049 const Index countTrueOn = mBuffer.
mData.countOn();
1054 template<Index Log2Dim>
1058 const Index countFalseOff = mBuffer.
mData.countOff();
1060 return countFalseOff;
1067 template<Index Log2Dim>
1074 template<Index Log2Dim>
1078 assert(offset <
SIZE);
1083 template<Index Log2Dim>
1084 template<
typename AccessorT>
1087 bool val,
bool active, AccessorT&)
1089 this->
addTile(level, xyz, val, active);
1096 template<Index Log2Dim>
1101 if (mBuffer.
mData.isOn(this->coordToOffset(xyz)))
return Buffer::sOn;
else return Buffer::sOff;
1105 template<Index Log2Dim>
1109 assert(offset <
SIZE);
1111 if (mBuffer.
mData.isOn(offset))
return Buffer::sOn;
else return Buffer::sOff;
1115 template<Index Log2Dim>
1120 val = mBuffer.
mData.isOn(offset);
1125 template<Index Log2Dim>
1133 template<Index Log2Dim>
1137 assert(offset <
SIZE);
1138 mBuffer.
mData.set(offset, val);
1142 template<Index Log2Dim>
1150 template<Index Log2Dim>
1158 template<Index Log2Dim>
1166 template<Index Log2Dim>
1170 assert(offset <
SIZE);
1171 mBuffer.
mData.set(offset, val);
1175 template<Index Log2Dim>
1176 template<
typename ModifyOp>
1180 bool val = mBuffer.
mData.isOn(offset);
1182 mBuffer.
mData.set(offset, val);
1186 template<Index Log2Dim>
1187 template<
typename ModifyOp>
1195 template<Index Log2Dim>
1196 template<
typename ModifyOp>
1201 bool val = mBuffer.
mData.isOn(offset), state = val;
1203 mBuffer.
mData.set(offset, val);
1210 template<Index Log2Dim>
1211 template<MergePolicy Policy>
1221 template<Index Log2Dim>
1222 template<MergePolicy Policy>
1228 if (tileValue) mBuffer.
mData.setOn();
1236 template<Index Log2Dim>
1237 template<
typename OtherType>
1245 template<Index Log2Dim>
1246 template<
typename OtherType>
1255 template<Index Log2Dim>
1256 template<
typename OtherType>
1268 template<Index Log2Dim>
1273 if (!clipBBox.hasOverlap(nodeBBox)) {
1275 this->
fill(nodeBBox, background,
false);
1276 }
else if (clipBBox.isInside(nodeBBox)) {
1286 nodeBBox.intersect(clipBBox);
1288 int &x = xyz.x(), &y = xyz.y(), &z = xyz.z();
1289 for (x = nodeBBox.min().x(); x <= nodeBBox.max().x(); ++x) {
1290 for (y = nodeBBox.min().y(); y <= nodeBBox.max().y(); ++y) {
1291 for (z = nodeBBox.min().z(); z <= nodeBBox.max().z(); ++z) {
1308 template<Index Log2Dim>
1313 clippedBBox.intersect(bbox);
1314 if (!clippedBBox)
return;
1316 for (
Int32 x = clippedBBox.min().x(); x <= clippedBBox.max().x(); ++x) {
1317 const Index offsetX = (x & (
DIM-1u))<<2*Log2Dim;
1318 for (
Int32 y = clippedBBox.min().y(); y <= clippedBBox.max().y(); ++y) {
1319 const Index offsetXY = offsetX + ((y & (
DIM-1u))<< Log2Dim);
1320 for (
Int32 z = clippedBBox.min().z(); z <= clippedBBox.max().z(); ++z) {
1321 const Index offset = offsetXY + (z & (
DIM-1u));
1322 mBuffer.
mData.set(offset, value);
1328 template<Index Log2Dim>
1332 mBuffer.
fill(value);
1339 template<Index Log2Dim>
1340 template<
typename DenseT>
1344 using DenseValueType =
typename DenseT::ValueType;
1346 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1347 const Coord&
min = dense.bbox().min();
1348 DenseValueType* t0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1349 const Int32 n0 = bbox.min()[2] & (
DIM-1u);
1350 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1351 DenseValueType* t1 = t0 + xStride * (x - min[0]);
1353 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1354 DenseValueType* t2 = t1 + yStride * (y - min[1]);
1356 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2] + 1; z < ez; ++z, t2 += zStride) {
1357 *t2 = DenseValueType(mBuffer.
mData.isOn(n2++));
1364 template<Index Log2Dim>
1365 template<
typename DenseT>
1368 bool background,
bool tolerance)
1370 using DenseValueType =
typename DenseT::ValueType;
1372 inline static bool toBool(
const DenseValueType& v) {
return !
math::isZero(v); }
1375 const size_t xStride = dense.xStride(), yStride = dense.yStride(), zStride = dense.zStride();
1376 const Coord&
min = dense.bbox().min();
1377 const DenseValueType* s0 = dense.data() + zStride * (bbox.min()[2] - min[2]);
1378 const Int32 n0 = bbox.min()[2] & (
DIM-1u);
1379 for (
Int32 x = bbox.min()[0], ex = bbox.max()[0] + 1; x < ex; ++x) {
1380 const DenseValueType* s1 = s0 + xStride * (x - min[0]);
1382 for (
Int32 y = bbox.min()[1], ey = bbox.max()[1] + 1; y < ey; ++y) {
1383 const DenseValueType* s2 = s1 + yStride * (y - min[1]);
1385 for (
Int32 z = bbox.min()[2], ez = bbox.max()[2]+1; z < ez; ++z, ++n2, s2 += zStride) {
1387 if (tolerance || (background == Local::toBool(*s2))) {
1388 mBuffer.mData.set(n2, background);
1390 mBuffer.mData.set(n2, Local::toBool(*s2));
1401 template<Index Log2Dim>
1402 template<
typename CombineOp>
1408 bool result =
false, aVal = mBuffer.mData.isOn(i), bVal = other.mBuffer.
mData.isOn(i);
1413 .setResultRef(result));
1414 mBuffer.mData.set(i, result);
1419 template<Index Log2Dim>
1420 template<
typename CombineOp>
1425 args.
setBRef(value).setBIsActive(valueIsActive);
1427 bool result =
false, aVal = mBuffer.mData.isOn(i);
1430 .setResultRef(result));
1431 mBuffer.mData.set(i, result);
1439 template<Index Log2Dim>
1440 template<
typename CombineOp,
typename OtherType>
1443 bool valueIsActive, CombineOp& op)
1446 args.
setBRef(value).setBIsActive(valueIsActive);
1448 bool result =
false, aVal = other.mBuffer.
mData.isOn(i);
1451 .setResultRef(result));
1452 mBuffer.mData.set(i, result);
1457 template<Index Log2Dim>
1458 template<
typename CombineOp,
typename OtherNodeT>
1461 bool valueIsActive, CombineOp& op)
1464 args.
setARef(value).setAIsActive(valueIsActive);
1466 bool result =
false, bVal = other.mBuffer.mData.isOn(i);
1469 .setResultRef(result));
1470 mBuffer.mData.set(i, result);
1475 template<Index Log2Dim>
1476 template<
typename CombineOp,
typename OtherNodeT>
1482 bool result =
false, b0Val = b0.mBuffer.
mData.isOn(i), b1Val = b1.mBuffer.mData.isOn(i);
1484 .setAIsActive(b0Val)
1486 .setBIsActive(b1Val)
1487 .setResultRef(result));
1488 mBuffer.mData.set(i, result);
1495 template<Index Log2Dim>
1496 template<
typename BBoxOp>
1500 if (op.template descent<LEVEL>()) {
1502 op.template operator()<
LEVEL>(CoordBBox::createCube(i.getCoord(), 1));
1510 template<Index Log2Dim>
1511 template<
typename VisitorOp>
1515 doVisit<LeafNode, VisitorOp, ChildAllIter>(*
this, op);
1519 template<Index Log2Dim>
1520 template<
typename VisitorOp>
1524 doVisit<const LeafNode, VisitorOp, ChildAllCIter>(*
this, op);
1528 template<Index Log2Dim>
1529 template<
typename NodeT,
typename VisitorOp,
typename ChildAllIterT>
1533 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1542 template<Index Log2Dim>
1543 template<
typename OtherLeafNodeType,
typename VisitorOp>
1548 typename OtherLeafNodeType::ChildAllIter>(*
this, other, op);
1552 template<Index Log2Dim>
1553 template<
typename OtherLeafNodeType,
typename VisitorOp>
1558 typename OtherLeafNodeType::ChildAllCIter>(*
this, other, op);
1562 template<Index Log2Dim>
1565 typename OtherNodeT,
1567 typename ChildAllIterT,
1568 typename OtherChildAllIterT>
1573 static_assert(OtherNodeT::SIZE == NodeT::SIZE,
1574 "can't visit nodes of different sizes simultaneously");
1575 static_assert(OtherNodeT::LEVEL == NodeT::LEVEL,
1576 "can't visit nodes at different tree levels simultaneously");
1578 ChildAllIterT iter =
self.beginChildAll();
1579 OtherChildAllIterT otherIter = other.beginChildAll();
1581 for ( ; iter && otherIter; ++iter, ++otherIter) {
1582 op(iter, otherIter);
1590 template<Index Log2Dim>
1591 template<
typename IterT,
typename VisitorOp>
1595 doVisit2<LeafNode, VisitorOp, ChildAllIter, IterT>(*
this, otherIter, op, otherIsLHS);
1599 template<Index Log2Dim>
1600 template<
typename IterT,
typename VisitorOp>
1604 doVisit2<const LeafNode, VisitorOp, ChildAllCIter, IterT>(*
this, otherIter, op, otherIsLHS);
1608 template<Index Log2Dim>
1612 typename ChildAllIterT,
1613 typename OtherChildAllIterT>
1616 VisitorOp& op,
bool otherIsLHS)
1618 if (!otherIter)
return;
1621 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1622 op(otherIter, iter);
1625 for (ChildAllIterT iter =
self.
beginChildAll(); iter; ++iter) {
1626 op(iter, otherIter);
1635 #endif // OPENVDB_TREE_LEAF_NODE_MASK_HAS_BEEN_INCLUDED void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNodeMask.h:243
static void evalNodeOrigin(Coord &xyz)
Compute the origin of the leaf node that contains the voxel with the given coordinates.
Definition: LeafNodeMask.h:719
int32_t Int32
Definition: openvdb/Types.h:34
Buffer & buffer()
Definition: LeafNodeMask.h:190
ValueIter< MaskDenseIter, const LeafNode, const bool > ValueAllCIter
Definition: LeafNodeMask.h:649
DenseIter< const LeafNode, const ValueType, ChildAll > ChildAllCIter
Definition: LeafNode.h:289
ValueIter< MaskOnIter, const LeafNode, const bool > ValueOnCIter
Definition: LeafNodeMask.h:645
void visit2Node(OtherLeafNodeType &other, VisitorOp &)
Definition: LeafNode.h:1870
void setValuesOn()
Mark all voxels as active but don't change their values.
Definition: LeafNodeMask.h:268
ValueOffCIter beginValueOff() const
Definition: LeafNodeMask.h:661
void unsetItem(Index pos, const ValueT &val) const
Definition: LeafNodeMask.h:640
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:230
Index64 onLeafVoxelCount() const
Definition: LeafNodeMask.h:124
Base class for dense iterators over internal and leaf nodes.
Definition: Iterator.h:178
bool operator!=(const LeafNode &other) const
Definition: LeafNode.h:195
void denseFill(const CoordBBox &bbox, bool value, bool=false)
Set all voxels within an axis-aligned box to the specified value.
Definition: LeafNodeMask.h:286
Buffer mBuffer
Bitmask representing the values AND state of voxels.
Definition: LeafNodeMask.h:733
const NodeMaskType & valueMask() const
Definition: LeafNode.h:869
const bool & getLastValue() const
Return a const reference to the last entry in the buffer.
Definition: LeafNodeMask.h:400
void visitActiveBBox(BBoxOp &) const
Calls the templated functor BBoxOp with bounding box information. An additional level argument is pro...
Definition: LeafNode.h:1823
static Index dim()
Return the number of voxels in each dimension.
Definition: LeafNodeMask.h:102
Definition: NodeMasks.h:270
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
ValueIter< MaskOffIter, const LeafNode, const bool > ValueOffCIter
Definition: LeafNodeMask.h:647
void clip(const CoordBBox &, const ValueType &background)
Set all voxels that lie outside the given axis-aligned box to the background.
Definition: LeafNode.h:1139
ChildOnCIter cbeginChildOn() const
Definition: LeafNodeMask.h:679
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:225
const NodeMaskType & getValueMask() const
Definition: LeafNode.h:867
ChildOffCIter cbeginChildOff() const
Definition: LeafNodeMask.h:682
void setValueMask(const NodeMaskType &mask)
Definition: LeafNodeMask.h:709
bool probeValue(const Coord &xyz, ValueType &val) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNode.h:1079
static Coord offsetToLocalCoord(Index n)
Return the local coordinates for a linear table offset, where offset 0 has coordinates (0...
Definition: LeafNode.h:1038
ChildAllCIter beginChildAll() const
Definition: LeafNode.h:320
DenseIter(const MaskDenseIter &iter, NodeT *parent)
Definition: LeafNodeMask.h:627
const NodeMaskType & getValueMask() const
Definition: LeafNodeMask.h:706
bool isDense() const
Return true if this node only contains active voxels.
Definition: LeafNodeMask.h:132
ChildAllIter endChildAll()
Definition: LeafNodeMask.h:697
CombineArgs & setARef(const AValueType &a)
Redirect the A value to a new external source.
Definition: openvdb/Types.h:481
Index64 offVoxelCount() const
Return the number of inactive voxels.
Definition: LeafNodeMask.h:123
static void getNodeLog2Dims(std::vector< Index > &dims)
Append the Log2Dim of this LeafNode to the specified vector.
Definition: LeafNodeMask.h:110
Index64 onVoxelCount() const
Return the number of active voxels.
Definition: LeafNodeMask.h:121
const LeafNode * probeLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:560
void setValueOn(const Coord &xyz)
Mark the voxel at the given coordinates as active but don't change its value.
Definition: LeafNode.h:411
Coord offsetToGlobalCoord(Index n) const
Return the global coordinates for a linear table offset.
Definition: LeafNode.h:1052
static const Index DIM
Definition: LeafNode.h:50
ChildOffIter beginChildOff()
Definition: LeafNodeMask.h:684
ValueOnCIter beginValueOn() const
Definition: LeafNodeMask.h:658
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:1681
bool isChildMaskOn(Index) const
Definition: LeafNodeMask.h:710
void modifyItem(Index n, const ModifyOp &op) const
Definition: LeafNodeMask.h:603
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:357
void setValueOn(Index offset)
Mark the voxel at the given offset as active but don't change its value.
Definition: LeafNodeMask.h:245
ValueOnCIter cbeginValueOn() const
Definition: LeafNodeMask.h:657
Index medianOn(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the active voxels in this node.
Definition: LeafNode.h:1531
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:1469
ValueIter< MaskOnIter, LeafNode, const bool > ValueOnIter
Definition: LeafNodeMask.h:644
const bool & getValue() const
Definition: LeafNodeMask.h:594
Templated block class to hold specific data types and a fixed number of values determined by Log2Dim...
Definition: LeafNode.h:37
ChildAllCIter cendChildAll() const
Definition: LeafNodeMask.h:695
LeafNode specialization for values of type ValueMask that encodes both the active states and the bool...
Definition: LeafNodeMask.h:30
void addTileAndCache(Index, const Coord &, const ValueType &, bool, AccessorT &)
Definition: LeafNode.h:1599
void readBuffers(std::istream &is, bool fromHalf=false)
Read buffers from a stream.
Definition: LeafNode.h:1322
static Index numValues()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNodeMask.h:106
OffIterator beginOff() const
Definition: NodeMasks.h:354
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:188
void visit(VisitorOp &)
Definition: LeafNode.h:1838
void writeTopology(std::ostream &os, bool toHalf=false) const
Write out just the topology.
Definition: LeafNode.h:1294
CombineArgs & setBRef(const BValueType &b)
Redirect the B value to a new external source.
Definition: openvdb/Types.h:483
Base class for iterators over internal and leaf nodes.
Definition: Iterator.h:29
ValueOnCIter cendValueOn() const
Definition: LeafNodeMask.h:667
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:1121
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:383
bool operator!=(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Inequality operator, does exact floating point comparisons.
Definition: Vec3.h:479
Bit mask for the internal and leaf nodes of VDB. This is a 64-bit implementation. ...
Definition: NodeMasks.h:307
void setValuesOff()
Mark all voxels as inactive but don't change their values.
Definition: LeafNodeMask.h:270
LeafNode * probeLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:546
bool isAllocated() const
Return true if memory for this node's buffer has been allocated.
Definition: LeafNodeMask.h:136
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:250
NodeT * stealNode(const Coord &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:525
const Coord & origin() const
Return the grid index coordinates of this node's local origin.
Definition: LeafNode.h:172
ValueOffCIter cbeginValueOff() const
Definition: LeafNodeMask.h:660
DenseIter< const LeafNode, const bool > ChildAllCIter
Definition: LeafNodeMask.h:655
ValueAllCIter beginValueAll() const
Definition: LeafNodeMask.h:664
ChildOnIter endChildOn()
Definition: LeafNodeMask.h:691
SharedPtr< LeafNodeType > Ptr
Definition: LeafNodeMask.h:38
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:1113
ValueAllCIter endValueAll() const
Definition: LeafNodeMask.h:674
DenseIter< LeafNode, ValueType, ChildAll > ChildAllIter
Definition: LeafNode.h:288
ChildIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeMask.h:615
ValueOnIter endValueOn()
Definition: LeafNodeMask.h:669
uint64_t Index64
Definition: openvdb/Types.h:31
Definition: openvdb/Types.h:368
ChildOnCIter cendChildOn() const
Definition: LeafNodeMask.h:689
static bool hasActiveTiles()
Return false since leaf nodes never contain tiles.
Definition: LeafNodeMask.h:278
bool isValueOn(const Coord &xyz) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeMask.h:273
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:343
void modifyValue(const ModifyOp &op) const
Definition: LeafNodeMask.h:606
Definition: openvdb/Types.h:89
ChildOnCIter beginChildOn() const
Definition: LeafNodeMask.h:680
void setValue(bool value) const
Definition: LeafNodeMask.h:599
ValueAllCIter cendValueAll() const
Definition: LeafNodeMask.h:673
bool isValueOn(Index offset) const
Return true if the voxel at the given offset is active.
Definition: LeafNodeMask.h:275
Base class for sparse iterators over internal and leaf nodes.
Definition: Iterator.h:114
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:94
void setValueMaskOff(Index n)
Definition: LeafNodeMask.h:716
void merge(const LeafNode &)
Definition: LeafNode.h:1632
ChildOffCIter beginChildOff() const
Definition: LeafNodeMask.h:683
void getOrigin(Int32 &x, Int32 &y, Int32 &z) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:160
const NodeT * probeConstNode(const Coord &) const
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:529
static void doVisit2(NodeT &self, OtherChildAllIterT &, VisitorOp &, bool otherIsLHS)
Definition: LeafNode.h:1942
ValueIter< MaskDenseIter, LeafNode, const bool > ValueAllIter
Definition: LeafNodeMask.h:648
ValueAllIter endValueAll()
Definition: LeafNodeMask.h:675
ChildOnCIter endChildOn() const
Definition: LeafNodeMask.h:690
bool allocate()
Allocate memory for this node's buffer if it has not already been allocated.
Definition: LeafNodeMask.h:140
Index medianOff(ValueType &value, ValueType *tmp=nullptr) const
Computes the median value of all the inactive voxels in this node.
Definition: LeafNode.h:1555
typename NodeMaskType::DenseIterator MaskDenseIter
Definition: LeafNodeMask.h:580
ValueOnCIter cbeginValueOn() const
Definition: LeafNode.h:291
typename std::remove_const< UnsetItemT >::type NonConstValueType
Definition: Iterator.h:184
const NodeMaskType & valueMask() const
Definition: LeafNodeMask.h:707
bool isChildMaskOff() const
Definition: LeafNodeMask.h:712
ValueOffCIter endValueOff() const
Definition: LeafNodeMask.h:671
bool isZero(const Type &x)
Return true if x is exactly equal to zero.
Definition: Math.h:328
void addLeaf(LeafNode *)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:521
LeafNode * touchLeafAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:543
void evalActiveBoundingBox(CoordBBox &bbox, bool visitVoxels=true) const
Definition: LeafNode.h:1451
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:471
ChildIter()
Definition: LeafNodeMask.h:614
ChildAllCIter endChildAll() const
Definition: LeafNodeMask.h:696
Definition: openvdb/Exceptions.h:13
Definition: openvdb/Types.h:369
ValueIter< MaskOffIter, LeafNode, const bool > ValueOffIter
Definition: LeafNodeMask.h:646
void negate()
Invert the bits of the voxels, i.e. states and values.
Definition: LeafNodeMask.h:441
Definition: PointDataGrid.h:170
DenseIter()
Definition: LeafNodeMask.h:626
Definition: NodeMasks.h:239
typename NodeMaskType::OffIterator MaskOffIter
Definition: LeafNodeMask.h:579
bool isEmpty() const
Return true if this node has no active voxels.
Definition: LeafNodeMask.h:130
ValueOffIter beginValueOff()
Definition: LeafNodeMask.h:662
ValueOnIter beginValueOn()
Definition: LeafNodeMask.h:659
NodeT * probeNodeAndCache(const Coord &, AccessorT &)
Return a pointer to this node.
Definition: LeafNodeMask.h:548
bool isValueMaskOn(Index n) const
Definition: LeafNodeMask.h:702
Index64 memUsage() const
Return the memory in bytes occupied by this node.
Definition: LeafNode.h:1441
const LeafNode * probeConstLeaf(const Coord &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:561
void writeBuffers(std::ostream &os, bool toHalf=false) const
Write buffers to a stream.
Definition: LeafNode.h:1414
bool isValueMaskOff() const
Definition: LeafNodeMask.h:705
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNodeMask.h:152
void visit2(IterT &otherIter, VisitorOp &, bool otherIsLHS=false)
Definition: LeafNode.h:1918
bool isValueMaskOn() const
Definition: LeafNodeMask.h:703
ValueType * mData
Definition: LeafBuffer.h:148
void getOrigin(Coord &origin) const
Return the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:159
ChildOffCIter endChildOff() const
Definition: LeafNodeMask.h:693
void nodeCount(std::vector< Index32 > &) const
no-op
Definition: LeafNodeMask.h:116
static Index32 nonLeafCount()
Return the non-leaf count for this node, which is zero.
Definition: LeafNodeMask.h:118
Library and file format version numbers.
DenseIter< LeafNode, bool > ChildAllIter
Definition: LeafNodeMask.h:654
static Index getChildDim()
Return the dimension of child nodes of this LeafNode, which is one for voxels.
Definition: LeafNodeMask.h:112
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:374
OPENVDB_API const void * getGridBackgroundValuePtr(std::ios_base &)
Return a pointer to the background value of the grid currently being read from or written to the give...
void setValueOff(Index offset)
Mark the voxel at the given offset as inactive but don't change its value.
Definition: LeafNodeMask.h:235
void combine(const LeafNode &other, CombineOp &op)
Definition: LeafNode.h:1722
void getNodes(ArrayT &) const
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:530
uint32_t Index32
Definition: openvdb/Types.h:30
ValueIter(const MaskIterT &iter, NodeT *parent)
Definition: LeafNodeMask.h:591
bool isChildMaskOff(Index) const
Definition: LeafNodeMask.h:711
ChildOffCIter cendChildOff() const
Definition: LeafNodeMask.h:692
bool ValueType
Definition: LeafNodeMask.h:35
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:348
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:1689
void modifyValueAndActiveState(const Coord &xyz, const ModifyOp &op)
Apply a functor to the voxel at the given coordinates.
Definition: LeafNode.h:450
static Index getLevel()
Return the level of this node, which by definition is zero for LeafNodes.
Definition: LeafNodeMask.h:108
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:1698
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:429
const LeafNode * probeConstLeafAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:563
const bool & getValueAndCache(const Coord &xyz, AccessorT &) const
Return the value of the voxel at the given coordinates.
Definition: LeafNodeMask.h:327
void voxelizeActiveTiles(bool=true)
No-op.
Definition: LeafNodeMask.h:449
ValueAllIter beginValueAll()
Definition: LeafNodeMask.h:665
static const Index LOG2DIM
Definition: LeafNode.h:48
ChildIter< MaskOnIter, LeafNode > ChildOnIter
Definition: LeafNodeMask.h:650
bool operator==(const LeafNode &other) const
Check for buffer, state and origin equivalence.
Definition: LeafNode.h:1431
std::shared_ptr< T > SharedPtr
Definition: openvdb/Types.h:92
void setOrigin(const Coord &origin)
Set the grid index coordinates of this node's local origin.
Definition: LeafNodeMask.h:155
static Index64 onTileCount()
Definition: LeafNodeMask.h:126
void combine2(const LeafNode &other, const OtherType &, bool valueIsActive, CombineOp &)
Definition: LeafNode.h:1762
ChildAllCIter cbeginChildAll() const
Definition: LeafNodeMask.h:685
bool getItem(Index pos, void *&child, NonConstValueT &value) const
Definition: LeafNodeMask.h:629
bool isValueMaskOff(Index n) const
Definition: LeafNodeMask.h:704
~LeafNode()
Destructor.
Definition: LeafNode.h:1008
NodeMaskType & getValueMask()
Definition: LeafNodeMask.h:708
typename BaseT::NonConstValueType NonConstValueT
Definition: LeafNodeMask.h:624
NodeT * probeNode(const Coord &)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:527
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:1222
void addLeafAndCache(LeafNode *, AccessorT &)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:523
static Index32 leafCount()
Return the leaf count for this node, which is one.
Definition: LeafNodeMask.h:114
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNode.h:401
static Index64 offTileCount()
Definition: LeafNodeMask.h:127
void modifyValueAndActiveStateAndCache(const Coord &xyz, const ModifyOp &op, AccessorT &)
Definition: LeafNodeMask.h:365
void setValueOff(const Coord &xyz)
Mark the voxel at the given coordinates as inactive but don't change its value.
Definition: LeafNodeMask.h:233
static Index getValueLevel(const Coord &)
Return the level (0) at which leaf node values reside.
Definition: LeafNodeMask.h:220
ValueIter()
Definition: LeafNodeMask.h:590
void resetBackground(bool, bool)
no-op since for this temaplte specialization voxel values and states are indistinguishable.
Definition: LeafNodeMask.h:438
ValueAllCIter cbeginValueAll() const
Definition: LeafNodeMask.h:663
bool isValueOnAndCache(const Coord &xyz, AccessorT &) const
Return true if the voxel at the given coordinates is active.
Definition: LeafNodeMask.h:332
LeafNode()
Default constructor.
Definition: LeafNode.h:924
Coord mOrigin
Global grid index coordinates (x,y,z) of the local origin of this node.
Definition: LeafNodeMask.h:736
void setValueMaskOn(Index n)
Definition: LeafNodeMask.h:715
static Index log2dim()
Return log2 of the size of the buffer storage.
Definition: LeafNodeMask.h:100
Index64 offLeafVoxelCount() const
Definition: LeafNodeMask.h:125
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: openvdb/Types.h:542
const ValueType & getValue(const Coord &xyz) const
Return the value of the voxel at the given coordinates.
Definition: LeafNode.h:1063
ValueOnCIter endValueOn() const
Definition: LeafNodeMask.h:668
void setItem(Index pos, bool value) const
Definition: LeafNodeMask.h:597
ValueOffCIter cendValueOff() const
Definition: LeafNodeMask.h:670
ChildIter< MaskOffIter, LeafNode > ChildOffIter
Definition: LeafNodeMask.h:652
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:337
void fill(const ValueType &)
Populate this buffer with a constant value.
Definition: LeafBuffer.h:247
static const Index NUM_VALUES
Definition: LeafNode.h:51
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:146
ChildIter< MaskOnIter, const LeafNode > ChildOnCIter
Definition: LeafNodeMask.h:651
typename NodeMaskType::OnIterator MaskOnIter
Definition: LeafNodeMask.h:578
ChildOnIter beginChildOn()
Definition: LeafNodeMask.h:681
ChildAllCIter beginChildAll() const
Definition: LeafNodeMask.h:686
static const Index SIZE
Definition: LeafNode.h:53
const Buffer & buffer() const
Definition: LeafNodeMask.h:189
const NodeT * probeConstNodeAndCache(const Coord &, AccessorT &) const
Return a const pointer to this node.
Definition: LeafNodeMask.h:565
ValueOffIter endValueOff()
Definition: LeafNodeMask.h:672
static void doVisit2Node(NodeT &self, OtherNodeT &other, VisitorOp &)
Definition: LeafNode.h:1895
void setOn(Index32 n)
Set the nth bit on.
Definition: NodeMasks.h:452
Index32 Index
Definition: openvdb/Types.h:32
ValueType medianAll(ValueType *tmp=nullptr) const
Computes the median value of all the active AND inactive voxels in this node.
Definition: LeafNode.h:1513
Tag dispatch class that distinguishes constructors during file input.
Definition: openvdb/Types.h:548
This struct collects both input and output arguments to "grid combiner" functors used with the tree::...
Definition: openvdb/Types.h:428
bool isConstant(ValueType &firstValue, bool &state, const ValueType &tolerance=zeroVal< ValueType >()) const
Definition: LeafNode.h:1477
ValueType combine(const ValueType &v0, const ValueType &v1, const ValueType &v2, const openvdb::Vec3d &w)
Combine different value types.
Definition: AttributeTransferUtil.h:140
ChildIter< MaskOffIter, const LeafNode > ChildOffCIter
Definition: LeafNodeMask.h:653
void addTile(Index level, const Coord &, const ValueType &, bool)
Definition: LeafNode.h:1582
ChildAllIter beginChildAll()
Definition: LeafNodeMask.h:687
void readTopology(std::istream &is, bool fromHalf=false)
Read in just the topology.
Definition: LeafNode.h:1286
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:1249
Definition: NodeMasks.h:208
LeafNode * probeLeaf(const Coord &)
Return a pointer to this node.
Definition: LeafNodeMask.h:544
static Index coordToOffset(const Coord &xyz)
Return the linear table offset of the given global or local coordinates.
Definition: LeafNode.h:1028
static Index size()
Return the total number of voxels represented by this LeafNode.
Definition: LeafNodeMask.h:104
void setValueMask(Index n, bool on)
Definition: LeafNodeMask.h:714
static const Index LEVEL
Definition: LeafNode.h:54
const bool & getFirstValue() const
Return a const reference to the first entry in the buffer.
Definition: LeafNodeMask.h:396
static Index getValueLevelAndCache(const Coord &, AccessorT &)
Return the LEVEL (=0) at which leaf node values reside.
Definition: LeafNodeMask.h:391
bool isInactive() const
Return true if all of this node's values are inactive.
Definition: LeafNodeMask.h:434
void stealNodes(ArrayT &, const ValueType &, bool)
This function exists only to enable template instantiation.
Definition: LeafNodeMask.h:531
ChildOffIter endChildOff()
Definition: LeafNodeMask.h:694
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:1179
CoordBBox getNodeBoundingBox() const
Return the bounding box of this node, i.e., the full index space spanned by this leaf node...
Definition: LeafNode.h:166
std::string str() const
Return a string representation of this node.
Definition: LeafNode.h:1015
static void doVisit(NodeT &, VisitorOp &)
Definition: LeafNode.h:1856
const bool & getItem(Index pos) const
Definition: LeafNodeMask.h:593