16#ifndef NANOVDB_PRIMITIVES_H_HAS_BEEN_INCLUDED
17#define NANOVDB_PRIMITIVES_H_HAS_BEEN_INCLUDED
41template<
typename ValueT = float,
42 typename VoxelT = ValueT,
43 typename BufferT = HostBuffer>
46 const Vec3<ValueT>& center = Vec3<ValueT>(0),
47 double voxelSize = 1.0,
48 double halfWidth = 3.0,
50 const std::string& name =
"sphere_ls",
53 float tolerance = -1.0f,
54 bool ditherOn =
false,
55 const BufferT& buffer = BufferT());
80template<
typename ValueT = float,
81 typename VoxelT = ValueT,
82 typename BufferT = HostBuffer>
85 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
86 double voxelSize = 1.0f,
87 double halfWidth = 3.0f,
89 const std::string& name =
"sphere_fog",
92 float tolerance = -1.0f,
93 bool ditherOn =
false,
94 const BufferT& buffer = BufferT());
111template<
typename ValueT = float,
112 typename BufferT = HostBuffer>
113inline GridHandle<BufferT>
115 ValueT radius = 100.0f,
116 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
117 double voxelSize = 1.0f,
119 const std::string& name =
"sphere_points",
121 const BufferT& buffer = BufferT());
144template<
typename ValueT = float,
145 typename VoxelT = ValueT,
146 typename BufferT = HostBuffer>
149 ValueT minorRadius = 50.0f,
150 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
151 double voxelSize = 1.0,
152 double halfWidth = 3.0,
154 const std::string& name =
"torus_ls",
157 float tolerance = -1.0f,
158 bool ditherOn =
false,
159 const BufferT& buffer = BufferT());
185template<
typename ValueT = float,
186 typename VoxelT = ValueT,
187 typename BufferT = HostBuffer>
190 ValueT minorRadius = 50.0f,
191 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
192 double voxelSize = 1.0,
193 double halfWidth = 3.0,
195 const std::string& name =
"torus_fog",
198 float tolerance = -1.0f,
199 bool ditherOn =
false,
200 const BufferT& buffer = BufferT());
218template<
typename ValueT = float,
219 typename BufferT = HostBuffer>
220inline GridHandle<BufferT>
222 ValueT majorRadius = 100.0f,
223 ValueT minorRadius = 50.0f,
224 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
225 double voxelSize = 1.0,
227 const std::string& name =
"torus_points",
229 const BufferT& buffer = BufferT());
253template<
typename ValueT = float,
254 typename VoxelT = ValueT,
255 typename BufferT = HostBuffer>
258 ValueT height = 60.0f,
259 ValueT depth = 100.0f,
260 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
261 double voxelSize = 1.0,
262 double halfWidth = 3.0,
264 const std::string& name =
"box_ls",
267 float tolerance = -1.0f,
268 bool ditherOn =
false,
269 const BufferT& buffer = BufferT());
296template<
typename ValueT = float,
297 typename VoxelT = ValueT,
298 typename BufferT = HostBuffer>
301 ValueT height = 60.0f,
302 ValueT depth = 100.0f,
303 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
304 double voxelSize = 1.0,
305 double halfWidth = 3.0,
307 const std::string& name =
"box_fog",
310 float tolerance = -1.0f,
311 bool ditherOn =
false,
312 const BufferT& buffer = BufferT());
334template<
typename ValueT = float,
335 typename VoxelT = ValueT,
336 typename BufferT = HostBuffer>
339 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
340 double voxelSize = 1.0,
341 double halfWidth = 3.0,
343 const std::string& name =
"octadedron_ls",
346 float tolerance = -1.0f,
347 bool ditherOn =
false,
348 const BufferT& buffer = BufferT());
373template<
typename ValueT = float,
374 typename VoxelT = ValueT,
375 typename BufferT = HostBuffer>
378 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
379 double voxelSize = 1.0,
380 double halfWidth = 3.0,
382 const std::string& name =
"octadedron_fog",
385 float tolerance = -1.0f,
386 bool ditherOn =
false,
387 const BufferT& buffer = BufferT());
412template<
typename ValueT = float,
413 typename VoxelT = ValueT,
414 typename BufferT = HostBuffer>
417 ValueT height = 60.0f,
418 ValueT depth = 100.0f,
419 ValueT thickness = 10.0f,
420 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
421 double voxelSize = 1.0,
422 double halfWidth = 3.0,
424 const std::string& name =
"bbox_ls",
427 float tolerance = -1.0f,
428 bool ditherOn =
false,
429 const BufferT& buffer = BufferT());
447template<
typename ValueT = float,
448 typename BufferT = HostBuffer>
449inline GridHandle<BufferT>
451 ValueT width = 40.0f,
452 ValueT height = 60.0f,
453 ValueT depth = 100.0f,
454 const Vec3<ValueT>& center = Vec3<ValueT>(0.0f),
455 double voxelSize = 1.0,
457 const std::string& name =
"box_points",
459 const BufferT& buffer = BufferT());
471template<
typename ValueT = float,
472 typename BufferT = HostBuffer>
473inline GridHandle<BufferT>
475 int pointsPerVoxel = 1,
476 const std::string& name =
"point_scatter",
478 const BufferT& buffer = BufferT());
492template<
typename ValueT,
typename VoxelT>
493std::shared_ptr<GridBuilder<ValueT, VoxelT>>
494initSphere(ValueT radius,
495 const Vec3<ValueT>& center,
501 static_assert(is_floating_point<typename BuildToValueMap<VoxelT>::Type>
::value,
"initSphere: expect floating point");
503 throw std::runtime_error(
"Sphere: radius must be positive!");
504 if (!(voxelSize > 0))
505 throw std::runtime_error(
"Sphere: voxelSize must be positive!");
506 if (!(halfWidth > 0))
507 throw std::runtime_error(
"Sphere: halfWidth must be positive!");
509 auto builder = std::make_shared<GridBuilder<ValueT, VoxelT>>(ValueT(halfWidth * voxelSize));
510 auto acc = builder->getAccessor();
513 const ValueT r0 = radius / ValueT(voxelSize), rmax = r0 + ValueT(halfWidth);
516 if (r0 < ValueT(1.5f)) {
521 const Vec3<ValueT> c(ValueT(center[0] - origin[0]) / ValueT(voxelSize),
522 ValueT(center[1] - origin[1]) / ValueT(voxelSize),
523 ValueT(center[2] - origin[2]) / ValueT(voxelSize));
526 const int imin =
Floor(c[0] - rmax), imax =
Ceil(c[0] + rmax);
527 const int jmin =
Floor(c[1] - rmax), jmax =
Ceil(c[1] + rmax);
528 const int kmin =
Floor(c[2] - rmax), kmax =
Ceil(c[2] + rmax);
531 int & i = ijk[0], &j = ijk[1], &k = ijk[2], m = 1;
533 for (i = imin; i <= imax; ++i) {
534 const auto x2 =
Pow2(ValueT(i) - c[0]);
535 for (j = jmin; j <= jmax; ++j) {
536 const auto x2y2 =
Pow2(ValueT(j) - c[1]) + x2;
537 for (k = kmin; k <= kmax; k += m) {
539 const auto v =
Sqrt(x2y2 +
Pow2(ValueT(k) - c[2])) - r0;
540 const auto d = v < 0 ? -v : v;
542 acc.setValue(ijk, ValueT(voxelSize) * v);
544 m +=
Floor(d - halfWidth);
553template<
typename ValueT,
typename VoxelT>
554std::shared_ptr<GridBuilder<ValueT, VoxelT>>
555initTorus(ValueT radius1,
557 const Vec3<ValueT>& center,
563 static_assert(is_floating_point<typename BuildToValueMap<VoxelT>::Type>
::value,
"initTorus: expect floating point");
565 throw std::runtime_error(
"Torus: radius2 must be positive!");
566 if (!(radius1 > radius2))
567 throw std::runtime_error(
"Torus: radius1 must be larger than radius2!");
568 if (!(voxelSize > 0))
569 throw std::runtime_error(
"Torus: voxelSize must be positive!");
570 if (!(halfWidth > 0))
571 throw std::runtime_error(
"Torus: halfWidth must be positive!");
573 auto builder = std::make_shared<GridBuilder<ValueT, VoxelT>>(ValueT(halfWidth * voxelSize));
574 auto acc = builder->getAccessor();
577 const ValueT r1 = radius1 / ValueT(voxelSize), r2 = radius2 / ValueT(voxelSize), rmax1 = r1 + r2 + ValueT(halfWidth), rmax2 = r2 + ValueT(halfWidth);
580 if (r2 < ValueT(1.5))
584 const Vec3<ValueT> c(ValueT(center[0] - origin[0]) / ValueT(voxelSize),
585 ValueT(center[1] - origin[1]) / ValueT(voxelSize),
586 ValueT(center[2] - origin[2]) / ValueT(voxelSize));
589 const int imin =
Floor(c[0] - rmax1), imax =
Ceil(c[0] + rmax1);
590 const int jmin =
Floor(c[1] - rmax2), jmax =
Ceil(c[1] + rmax2);
591 const int kmin =
Floor(c[2] - rmax1), kmax =
Ceil(c[2] + rmax1);
594 int & i = ijk[0], &j = ijk[1], &k = ijk[2], m = 1;
596 for (i = imin; i <= imax; ++i) {
597 const auto x2 =
Pow2(ValueT(i) - c[0]);
598 for (k = kmin; k <= kmax; ++k) {
599 const auto x2z2 =
Pow2(
Sqrt(
Pow2(ValueT(k) - c[2]) + x2) - r1);
600 for (j = jmin; j <= jmax; j += m) {
602 const auto v =
Sqrt(x2z2 +
Pow2(ValueT(j) - c[1])) - r2;
603 const auto d = v < 0 ? -v : v;
605 acc.setValue(ijk, ValueT(voxelSize) * v);
607 m +=
Floor(d - halfWidth);
616template<
typename ValueT,
typename VoxelT>
617std::shared_ptr<GridBuilder<ValueT, VoxelT>>
621 const Vec3<ValueT>& center,
627 static_assert(is_floating_point<typename BuildToValueMap<VoxelT>::Type>
::value,
"initBox: expect floating point");
628 using Vec3T = Vec3<ValueT>;
630 throw std::runtime_error(
"Box: width must be positive!");
632 throw std::runtime_error(
"Box: height must be positive!");
634 throw std::runtime_error(
"Box: depth must be positive!");
636 if (!(voxelSize > 0))
637 throw std::runtime_error(
"Box: voxelSize must be positive!");
638 if (!(halfWidth > 0))
639 throw std::runtime_error(
"Box: halfWidth must be positive!");
641 auto builder = std::make_shared<GridBuilder<ValueT, VoxelT>>(ValueT(halfWidth * voxelSize));
642 auto acc = builder->getAccessor();
645 const Vec3T r(width / (2 * ValueT(voxelSize)), height / (2 * ValueT(voxelSize)), depth / (2 * ValueT(voxelSize)));
648 if (r.min() < ValueT(1.5))
652 const Vec3T c(ValueT(center[0] - origin[0]) / ValueT(voxelSize),
653 ValueT(center[1] - origin[1]) / ValueT(voxelSize),
654 ValueT(center[2] - origin[2]) / ValueT(voxelSize));
657 auto Pos = [](ValueT x) {
return x > 0 ? x : 0; };
658 auto Neg = [](ValueT x) {
return x < 0 ? x : 0; };
661 const BBox<Vec3T> b(c - r - Vec3T(ValueT(halfWidth)), c + r + Vec3T(ValueT(halfWidth)));
667 for (Coord p = bbox[0]; p[0] <= bbox[1][0]; ++p[0]) {
668 const auto q1 =
Abs(ValueT(p[0]) - c[0]) - r[0];
669 const auto x2 =
Pow2(Pos(q1));
670 for (p[1] = bbox[0][1]; p[1] <= bbox[1][1]; ++p[1]) {
671 const auto q2 =
Abs(ValueT(p[1]) - c[1]) - r[1];
672 const auto q0 =
Max(q1, q2);
673 const auto x2y2 = x2 +
Pow2(Pos(q2));
674 for (p[2] = bbox[0][2]; p[2] <= bbox[1][2]; p[2] += m) {
676 const auto q3 =
Abs(ValueT(p[2]) - c[2]) - r[2];
677 const auto v =
Sqrt(x2y2 +
Pow2(Pos(q3))) + Neg(
Max(q0, q3));
678 const auto d =
Abs(v);
680 acc.setValue(p, ValueT(voxelSize) * v);
682 m +=
Floor(d - halfWidth);
691template<
typename ValueT,
typename VoxelT>
692std::shared_ptr<GridBuilder<ValueT, VoxelT>>
693initBBox(ValueT width,
697 const Vec3<ValueT>& center,
703 static_assert(is_floating_point<typename BuildToValueMap<VoxelT>::Type>
::value,
"initBBox: expect floating point");
704 using Vec3T = Vec3<ValueT>;
706 throw std::runtime_error(
"BBox: width must be positive!");
708 throw std::runtime_error(
"BBox: height must be positive!");
710 throw std::runtime_error(
"BBox: depth must be positive!");
711 if (!(thickness > 0))
712 throw std::runtime_error(
"BBox: thickness must be positive!");
713 if (!(voxelSize > 0.0))
714 throw std::runtime_error(
"BBox: voxelSize must be positive!");
716 auto builder = std::make_shared<GridBuilder<ValueT, VoxelT>>(ValueT(halfWidth * voxelSize));
717 auto acc = builder->getAccessor();
720 const Vec3T r(width / (2 * ValueT(voxelSize)), height / (2 * ValueT(voxelSize)), depth / (2 * ValueT(voxelSize)));
721 const ValueT e = thickness / ValueT(voxelSize);
724 if (r.min() < ValueT(1.5) || e < ValueT(1.5))
728 const Vec3T c(ValueT(center[0] - origin[0]) / ValueT(voxelSize),
729 ValueT(center[1] - origin[1]) / ValueT(voxelSize),
730 ValueT(center[2] - origin[2]) / ValueT(voxelSize));
733 auto Pos = [](ValueT x) {
return x > 0 ? x : 0; };
734 auto Neg = [](ValueT x) {
return x < 0 ? x : 0; };
737 const BBox<Vec3T> b(c - r - Vec3T(e + ValueT(halfWidth)), c + r + Vec3T(e + ValueT(halfWidth)));
743 for (Coord p = bbox[0]; p[0] <= bbox[1][0]; ++p[0]) {
744 const ValueT px =
Abs(ValueT(p[0]) - c[0]) - r[0];
745 const ValueT qx =
Abs(ValueT(px) + e) - e;
746 const ValueT px2 =
Pow2(Pos(px));
747 const ValueT qx2 =
Pow2(Pos(qx));
748 for (p[1] = bbox[0][1]; p[1] <= bbox[1][1]; ++p[1]) {
749 const ValueT py =
Abs(ValueT(p[1]) - c[1]) - r[1];
750 const ValueT qy =
Abs(ValueT(py) + e) - e;
751 const ValueT qy2 =
Pow2(Pos(qy));
753 const ValueT px2qy2 = px2 + qy2;
754 const ValueT qx2py2 = qx2 +
Pow2(Pos(py));
755 const ValueT qx2qy2 = qx2 + qy2;
756 const ValueT a[3] = {
Max(px, qy),
Max(qx, py),
Max(qx, qy)};
757 for (p[2] = bbox[0][2]; p[2] <= bbox[1][2]; p[2] += m) {
759 const ValueT pz =
Abs(ValueT(p[2]) - c[2]) - r[2];
760 const ValueT qz =
Abs(ValueT(pz) + e) - e;
761 const ValueT qz2 =
Pow2(Pos(qz));
762 const ValueT s1 =
Sqrt(px2qy2 + qz2) + Neg(
Max(a[0], qz));
763 const ValueT s2 =
Sqrt(qx2py2 + qz2) + Neg(
Max(a[1], qz));
764 const ValueT s3 =
Sqrt(qx2qy2 +
Pow2(Pos(pz))) + Neg(
Max(a[2], pz));
765 const ValueT v =
Min(s1,
Min(s2, s3));
766 const ValueT d =
Abs(v);
768 acc.setValue(p, ValueT(voxelSize) * v);
770 m +=
Floor(d - halfWidth);
779template<
typename ValueT,
typename VoxelT>
780std::shared_ptr<GridBuilder<ValueT, VoxelT>>
781initOctahedron(ValueT scale,
782 const Vec3<ValueT>& center,
788 static_assert(is_floating_point<typename BuildToValueMap<VoxelT>::Type>
::value,
"initOctahedron: expect floating point");
789 using Vec3T = Vec3<ValueT>;
791 throw std::runtime_error(
"Octahedron: width must be positive!");
792 if (!(voxelSize > 0))
793 throw std::runtime_error(
"Octahedron: voxelSize must be positive!");
795 auto builder = std::make_shared<GridBuilder<ValueT>>(halfWidth * voxelSize);
796 auto acc = builder->getAccessor();
799 const ValueT s =
scale / (2 * ValueT(voxelSize));
802 if ( s < ValueT(1.5) )
806 const Vec3T c(ValueT(center[0] - origin[0]) / ValueT(voxelSize),
807 ValueT(center[1] - origin[1]) / ValueT(voxelSize),
808 ValueT(center[2] - origin[2]) / ValueT(voxelSize));
811 auto sdf = [&s](ValueT x, ValueT y, ValueT z) {
812 const ValueT d = ValueT(0.5)*(z - y + s);
814 return Vec3T(x, y - s, z).length();
816 return Vec3T(x, y, z - s).length();
818 return Vec3T(x, y - s + d, z - d).length();
822 const BBox<Vec3T> b(c - Vec3T(s + ValueT(halfWidth)), c + Vec3T(s + ValueT(halfWidth)));
828 static const ValueT a =
Sqrt(ValueT(1)/ValueT(3));
829 for (Coord p = bbox[0]; p[0] <= bbox[1][0]; ++p[0]) {
830 const ValueT px =
Abs(ValueT(p[0]) - c[0]);
831 for (p[1] = bbox[0][1]; p[1] <= bbox[1][1]; ++p[1]) {
832 const ValueT py =
Abs(ValueT(p[1]) - c[1]);
833 for (p[2] = bbox[0][2]; p[2] <= bbox[1][2]; p[2] += m) {
835 const ValueT pz =
Abs(ValueT(p[2]) - c[2]);
836 ValueT d = px + py + pz - s;
838 if (ValueT(3)*px < d) {
840 }
else if (ValueT(3)*py < d) {
842 }
else if (ValueT(3)*pz < d) {
849 acc.setValue(p, ValueT(voxelSize) * v);
851 m +=
Floor(d - halfWidth);
864template<
typename ValueT,
typename VoxelT,
typename BufferT>
865inline GridHandle<BufferT>
871 const std::string& name,
876 const BufferT& buffer)
891template<
typename ValueT,
typename VoxelT,
typename BufferT>
892inline GridHandle<BufferT>
898 const std::string& name,
903 const BufferT& buffer)
918template<
typename ValueT,
typename BufferT>
919inline GridHandle<BufferT>
925 const std::string& name,
927 const BufferT& buffer)
941template<
typename ValueT,
typename VoxelT,
typename BufferT>
942inline GridHandle<BufferT>
949 const std::string& name,
954 const BufferT& buffer)
969template<
typename ValueT,
typename VoxelT,
typename BufferT>
970inline GridHandle<BufferT>
977 const std::string& name,
982 const BufferT& buffer)
997template<
typename ValueT,
typename BufferT>
998inline GridHandle<BufferT>
1004 const Vec3d& origin,
1005 const std::string& name,
1007 const BufferT& buffer)
1021template<
typename ValueT,
typename VoxelT,
typename BufferT>
1022inline GridHandle<BufferT>
1029 const Vec3d& origin,
1030 const std::string& name,
1035 const BufferT& buffer)
1050template<
typename ValueT,
typename VoxelT,
typename BufferT>
1051inline GridHandle<BufferT>
1056 const Vec3d& origin,
1057 const std::string& name,
1062 const BufferT& buffer)
1077template<
typename ValueT,
typename VoxelT,
typename BufferT>
1078inline GridHandle<BufferT>
1086 const Vec3d& origin,
1087 const std::string& name,
1092 const BufferT& buffer)
1107template<
typename ValueT,
typename VoxelT,
typename BufferT>
1108inline GridHandle<BufferT>
1115 const Vec3d& origin,
1116 const std::string& name,
1121 const BufferT& buffer)
1136template<
typename ValueT,
typename VoxelT,
typename BufferT>
1137inline GridHandle<BufferT>
1142 const Vec3d& origin,
1143 const std::string& name,
1148 const BufferT& buffer)
1163template<
typename ValueT,
typename BufferT>
1164inline GridHandle<BufferT>
1171 const Vec3d& origin,
1172 const std::string& name,
1174 const BufferT& buffer)
1189template<
typename ValueT,
typename BufferT>
1190inline GridHandle<BufferT>
1193 const std::string& name,
1195 const BufferT& buffer)
1200 throw std::runtime_error(
"createPointScatter: Expected at least one point per voxel");
1203 throw std::runtime_error(
"createPointScatter: Expected a level set grid");
1206 throw std::runtime_error(
"createPointScatter: ActiveVoxelCount is required");
1210 if (pointCount == 0) {
1211 throw std::runtime_error(
"createPointScatter: No particles to scatter");
1213 std::vector<Vec3T> xyz;
1214 xyz.reserve(pointCount);
1218 const ValueT s = 1 / (1 + ValueT(
RAND_MAX));
1240 assert(pointCount == xyz.size());
1249 if (
dstTree.nodeCount(0) == 0) {
1250 throw std::runtime_error(
"Expect leaf nodes!");
1264 std::stringstream
ss;
1265 ss <<
"Point attribute name \"" << name <<
"\" is more then "
1267 throw std::runtime_error(
ss.str());
1269 memcpy(meta.mName, name.c_str(), name.size() + 1);
1270 if (std::is_same<ValueT, float>::value) {
1272 }
else if (std::is_same<ValueT, double>::value) {
1275 throw std::runtime_error(
"Unsupported value type");
1277 if (
const auto *
p =
dstGrid->blindData(0)) {
1278 memcpy(
const_cast<void*
>(
p), xyz.data(), xyz.size() *
sizeof(Vec3T));
1280 throw std::runtime_error(
"Blind data pointer was NULL");
Generates a NanoVDB grid from any volume or function.
ValueT value
Definition GridBuilder.h:1290
Compression oracle based on absolute difference.
Definition GridBuilder.h:39
Definition DenseGrid.h:402
uint64_t size() const
Returns the size in bytes of the raw memory buffer managed by this DenseGridHandle's allocator.
Definition DenseGrid.h:440
uint8_t * data()
Returns a non-const pointer to the data.
Definition DenseGrid.h:432
GridHandle< BufferT > createLevelSetTorus(ValueT majorRadius=100.0f, ValueT minorRadius=50.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="torus_ls", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a narrow-band level set of a torus in the xz-plane.
Definition Primitives.h:943
GridHandle< BufferT > createPointScatter(const NanoGrid< ValueT > &srcGrid, int pointsPerVoxel=1, const std::string &name="point_scatter", ChecksumMode mode=ChecksumMode::Default, const BufferT &buffer=BufferT())
Given an input NanoVDB voxel grid this methods returns a GridHandle to another NanoVDB PointDataGrid ...
Definition Primitives.h:1191
T Abs(T x)
Definition NanoVDB.h:854
Type Min(Type a, Type b)
Definition NanoVDB.h:758
GridHandle< BufferT > createLevelSetBBox(ValueT width=40.0f, ValueT height=60.0f, ValueT depth=100.0f, ValueT thickness=10.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="bbox_ls", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a narrow-band level set of a bounding-box (= wireframe of a box)
Definition Primitives.h:1079
float Sqrt(float x)
Return the square root of a floating-point value.
Definition NanoVDB.h:902
GridHandle< BufferT > createPointTorus(int pointsPerVoxel=1, ValueT majorRadius=100.0f, ValueT minorRadius=50.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, const Vec3d &origin=Vec3d(0.0f), const std::string &name="torus_points", ChecksumMode cMode=ChecksumMode::Default, const BufferT &buffer=BufferT())
Returns a handle to a PointDataGrid containing points scattered on the surface of a torus.
Definition Primitives.h:999
GridHandle< BufferT > createFogVolumeOctahedron(ValueT scale=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="octadedron_fog", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a sparse fog volume of an octahedron such that the exterior is 0 and inactive,...
Definition Primitives.h:1138
GridHandle< BufferT > createLevelSetSphere(ValueT radius=100, const Vec3< ValueT > ¢er=Vec3< ValueT >(0), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0), const std::string &name="sphere_ls", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a narrow-band level set of a sphere.
Definition Primitives.h:866
GridHandle< BufferT > createPointBox(int pointsPerVoxel=1, ValueT width=40.0f, ValueT height=60.0f, ValueT depth=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_points", ChecksumMode mode=ChecksumMode::Default, const BufferT &buffer=BufferT())
Returns a handle to a PointDataGrid containing points scattered on the surface of a box.
Definition Primitives.h:1165
GridHandle< BufferT > createLevelSetOctahedron(ValueT scale=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="octadedron_ls", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a narrow-band level set of a octahedron.
Definition Primitives.h:1052
int32_t Ceil(float x)
Definition NanoVDB.h:827
int32_t Floor(float x)
Definition NanoVDB.h:818
BBox< Coord > CoordBBox
Definition NanoVDB.h:1809
StatsMode
Grid flags which indicate what extra information is present in the grid buffer.
Definition GridStats.h:32
void updateChecksum(NanoGrid< ValueT > &grid, ChecksumMode mode=ChecksumMode::Default)
Updates the checksum of a grid.
Definition GridChecksum.h:277
Vec3< double > Vec3d
Definition NanoVDB.h:1288
GridHandle< BufferT > createLevelSetBox(ValueT width=40.0f, ValueT height=60.0f, ValueT depth=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_ls", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a narrow-band level set of a box.
Definition Primitives.h:1023
GridHandle< BufferT > createPointSphere(int pointsPerVoxel=1, ValueT radius=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0f, const Vec3d &origin=Vec3d(0.0), const std::string &name="sphere_points", ChecksumMode mode=ChecksumMode::Default, const BufferT &buffer=BufferT())
Returns a handle to a PointDataGrid containing points scattered on the surface of a sphere.
Definition Primitives.h:920
ChecksumMode
List of different modes for computing for a checksum.
Definition GridChecksum.h:33
T Pow2(T x)
Definition NanoVDB.h:837
GridHandle< BufferT > createFogVolumeSphere(ValueT radius=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0f, double halfWidth=3.0f, const Vec3d &origin=Vec3d(0.0), const std::string &name="sphere_fog", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a sparse fog volume of a sphere such that the exterior is 0 and inactive,...
Definition Primitives.h:893
Type Max(Type a, Type b)
Definition NanoVDB.h:779
GridHandle< BufferT > createFogVolumeTorus(ValueT majorRadius=100.0f, ValueT minorRadius=50.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0), const std::string &name="torus_fog", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a sparse fog volume of a torus in the xz-plane such that the exterior is 0 and in...
Definition Primitives.h:971
NodeManagerHandle< BufferT > createNodeManager(const NanoGrid< BuildT > &grid, const BufferT &buffer=BufferT())
brief Construct a NodeManager and return its handle
Definition NodeManager.h:289
GridHandle< BufferT > createFogVolumeBox(ValueT width=40.0f, ValueT height=60.0f, ValueT depth=100.0f, const Vec3< ValueT > ¢er=Vec3< ValueT >(0.0f), double voxelSize=1.0, double halfWidth=3.0, const Vec3d &origin=Vec3d(0.0), const std::string &name="box_fog", StatsMode sMode=StatsMode::Default, ChecksumMode cMode=ChecksumMode::Default, float tolerance=-1.0f, bool ditherOn=false, const BufferT &buffer=BufferT())
Returns a handle to a sparse fog volume of a box such that the exterior is 0 and inactive,...
Definition Primitives.h:1109
MatType scale(const Vec3< typename MatType::value_type > &s)
Return a matrix that scales by s.
Definition Mat.h:615
C++11 implementation of std::is_floating_point.
Definition NanoVDB.h:414
static const bool value
Definition NanoVDB.h:415