OpenVDB  5.2.0
Classes | Namespaces | Enumerations | Functions
MeshToVolume.h File Reference

Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance field volumes. More...

#include <openvdb/Platform.h>
#include <openvdb/Types.h>
#include <openvdb/math/FiniteDifference.h>
#include <openvdb/math/Proximity.h>
#include <openvdb/util/NullInterrupter.h>
#include <openvdb/util/Util.h>
#include "ChangeBackground.h"
#include "Prune.h"
#include "SignedFloodFill.h"
#include <tbb/blocked_range.h>
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <tbb/partitioner.h>
#include <tbb/task_group.h>
#include <tbb/task_scheduler_init.h>
#include <boost/mpl/at.hpp>
#include <boost/mpl/int.hpp>
#include <boost/mpl/size.hpp>
#include <algorithm>
#include <cmath>
#include <deque>
#include <limits>
#include <memory>
#include <sstream>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

struct  QuadAndTriangleDataAdapter< PointType, PolygonType >
 Contiguous quad and triangle data adapter class. More...
 
class  MeshToVoxelEdgeData
 Extracts and stores voxel edge intersection data from a mesh. More...
 
struct  MeshToVoxelEdgeData::EdgeData
 Internal edge data type. More...
 
struct  TransformPoints< PointType >
 
struct  Tolerance< ValueType >
 
class  CombineLeafNodes< TreeType >
 
struct  StashOriginAndStoreOffset< TreeType >
 
struct  RestoreOrigin< TreeType >
 
class  ComputeNodeConnectivity< TreeType >
 
struct  LeafNodeConnectivityTable< TreeType >
 
class  SweepExteriorSign< TreeType >
 
class  SeedFillExteriorSign< TreeType >
 
struct  FillArray< ValueType >
 
class  SyncVoxelMask< TreeType >
 
class  SeedPoints< TreeType >
 
struct  ComputeIntersectingVoxelSign< TreeType, MeshDataAdapter >
 
struct  ValidateIntersectingVoxels< TreeType >
 
struct  ValidateIntersectingVoxels< TreeType >::IsNegative
 
struct  RemoveSelfIntersectingSurface< TreeType >
 
struct  RemoveSelfIntersectingSurface< TreeType >::Comp
 
struct  ReleaseChildNodes< NodeType >
 
struct  StealUniqueLeafNodes< TreeType >
 
struct  VoxelizationData< TreeType >
 TBB body object to voxelize a mesh of triangles and/or quads into a collection of VDB grids, namely a squared distance grid, a closest primitive grid and an intersecting voxels grid (masks the mesh intersecting voxels) More...
 
class  VoxelizePolygons< TreeType, MeshDataAdapter, Interrupter >
 
struct  DiffLeafNodeMask< TreeType >
 
struct  UnionValueMasks< LeafNodeTypeA, LeafNodeTypeB >
 
struct  ConstructVoxelMask< TreeType >
 
struct  ExpandNarrowband< TreeType, MeshDataAdapter >
 
struct  ExpandNarrowband< TreeType, MeshDataAdapter >::Fragment
 
struct  AddNodes< TreeType >
 
struct  TransformValues< TreeType >
 
struct  InactivateValues< TreeType >
 
struct  OffsetValues< TreeType >
 
struct  Renormalize< TreeType >
 
struct  MinCombine< TreeType >
 
class  MeshToVoxelEdgeData::GenEdgeData
 

Namespaces

 openvdb
 
 openvdb::v5_2
 
 openvdb::v5_2::tools
 
 openvdb::v5_2::tools::mesh_to_volume_internal
 

Enumerations

enum  MeshToVolumeFlags { UNSIGNED_DISTANCE_FIELD = 0x1, DISABLE_INTERSECTING_VOXEL_REMOVAL = 0x2, DISABLE_RENORMALIZATION = 0x4, DISABLE_NARROW_BAND_TRIMMING = 0x8 }
 Mesh to volume conversion flags. More...
 

Functions

template<typename GridType , typename MeshDataAdapter >
GridType::Ptr meshToVolume (const MeshDataAdapter &mesh, const math::Transform &transform, float exteriorBandWidth=3.0f, float interiorBandWidth=3.0f, int flags=0, typename GridType::template ValueConverter< Int32 >::Type *polygonIndexGrid=nullptr)
 
template<typename GridType , typename MeshDataAdapter , typename Interrupter >
GridType::Ptr meshToVolume (Interrupter &interrupter, const MeshDataAdapter &mesh, const math::Transform &transform, float exteriorBandWidth=3.0f, float interiorBandWidth=3.0f, int flags=0, typename GridType::template ValueConverter< Int32 >::Type *polygonIndexGrid=nullptr)
 Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance field volumes. More...
 
template<typename GridType >
GridType::Ptr meshToLevelSet (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Convert a triangle mesh to a level set volume. More...
 
template<typename GridType , typename Interrupter >
GridType::Ptr meshToLevelSet (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Adds support for a interrupter callback used to cancel the conversion. More...
 
template<typename GridType >
GridType::Ptr meshToLevelSet (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Convert a quad mesh to a level set volume. More...
 
template<typename GridType , typename Interrupter >
GridType::Ptr meshToLevelSet (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Adds support for a interrupter callback used to cancel the conversion. More...
 
template<typename GridType >
GridType::Ptr meshToLevelSet (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Convert a triangle and quad mesh to a level set volume. More...
 
template<typename GridType , typename Interrupter >
GridType::Ptr meshToLevelSet (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Adds support for a interrupter callback used to cancel the conversion. More...
 
template<typename GridType >
GridType::Ptr meshToSignedDistanceField (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float exBandWidth, float inBandWidth)
 Convert a triangle and quad mesh to a signed distance field with an asymmetrical narrow band. More...
 
template<typename GridType , typename Interrupter >
GridType::Ptr meshToSignedDistanceField (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float exBandWidth, float inBandWidth)
 Adds support for a interrupter callback used to cancel the conversion. More...
 
template<typename GridType >
GridType::Ptr meshToUnsignedDistanceField (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float bandWidth)
 Convert a triangle and quad mesh to an unsigned distance field. More...
 
template<typename GridType , typename Interrupter >
GridType::Ptr meshToUnsignedDistanceField (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float bandWidth)
 Adds support for a interrupter callback used to cancel the conversion. More...
 
template<typename GridType , typename VecType >
GridType::Ptr createLevelSetBox (const math::BBox< VecType > &bbox, const openvdb::math::Transform &xform, typename VecType::ValueType halfWidth=LEVEL_SET_HALF_WIDTH)
 Return a grid of type GridType containing a narrow-band level set representation of a box. More...
 
template<typename FloatTreeT >
void traceExteriorBoundaries (FloatTreeT &tree)
 Traces the exterior voxel boundary of closed objects in the input volume tree. Exterior voxels are marked with a negative sign, voxels with a value below 0.75 are left unchanged and act as the boundary layer. More...
 
template<typename LeafNodeType >
void seedFill (LeafNodeType &node)
 
template<typename LeafNodeType >
bool scanFill (LeafNodeType &node)
 
template<typename ValueType >
void fillArray (ValueType *array, const ValueType val, const size_t length)
 
template<typename LeafNodeType >
void maskNodeInternalNeighbours (const Index pos, bool(&mask)[26])
 
template<typename Compare , typename LeafNodeType >
bool checkNeighbours (const Index pos, const typename LeafNodeType::ValueType *data, bool(&mask)[26])
 
template<typename Compare , typename AccessorType >
bool checkNeighbours (const Coord &ijk, AccessorType &acc, bool(&mask)[26])
 
template<typename TreeType >
void releaseLeafNodes (TreeType &tree)
 
template<typename DistTreeType , typename IndexTreeType >
void combineData (DistTreeType &lhsDist, IndexTreeType &lhsIdx, DistTreeType &rhsDist, IndexTreeType &rhsIdx)
 
template<typename TreeType , typename Int32TreeType , typename BoolTreeType , typename MeshDataAdapter >
void expandNarrowband (TreeType &distTree, Int32TreeType &indexTree, BoolTreeType &maskTree, std::vector< typename BoolTreeType::LeafNodeType * > &maskNodes, const MeshDataAdapter &mesh, typename TreeType::ValueType exteriorBandWidth, typename TreeType::ValueType interiorBandWidth, typename TreeType::ValueType voxelSize)
 
std::ostream & operator<< (std::ostream &ostr, const MeshToVoxelEdgeData::EdgeData &rhs)
 
MeshToVoxelEdgeData::EdgeData Abs (const MeshToVoxelEdgeData::EdgeData &x)
 

Detailed Description

Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance field volumes.

Note
The signed distance field conversion requires a closed surface but not necessarily a manifold surface. Supports surfaces with self intersections and degenerate faces and is independent of mesh surface normals / polygon orientation.
Author
Mihai Alden