HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VolumeToMesh.h File Reference

Extract polygonal surfaces from scalar volumes. More...

#include <openvdb/Platform.h>
#include <openvdb/math/Operators.h>
#include <openvdb/tree/ValueAccessor.h>
#include <openvdb/util/Util.h>
#include <hboost/scoped_array.hpp>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <tbb/task_scheduler_init.h>
#include <cmath>
#include <map>
#include <memory>
#include <set>
#include <type_traits>
#include <vector>
+ Include dependency graph for VolumeToMesh.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  openvdb::OPENVDB_VERSION_NAME::tools::PolygonPool
 Collection of quads and triangles. More...
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::VolumeToMesh
 Mesh any scalar grid that has a continuous isosurface. More...
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::FillArray< ValueType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::ComputePoints< InputTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::SeamLineWeights< InputTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::SetSeamLineFlags< TreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::TransferSeamLineFlags< BoolTreeType, SignDataType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MaskSeamLineVoxels< TreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MergeVoxelRegions< InputGridType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::UniformPrimBuilder
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::AdaptivePrimBuilder
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MaskTileBorders< InputTreeType >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::PointListCopy
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::LeafNodeVoxelOffsets
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::VoxelEdgeAccessor< AccessorT, _AXIS >
 Utility method to marks all voxels that share an edge. More...
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::IdentifyIntersectingVoxels< InputTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MaskIntersectingVoxels< InputTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MaskBorderVoxels< BoolTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::SyncMaskValues< BoolTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MaskSurface< BoolTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::ComputeAuxiliaryData< InputTreeType >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::LeafNodePointCount< LeafNodeLog2Dim >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::AdaptiveLeafNodePointCount< PointIndexLeafNode >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MapPoints< PointIndexLeafNode >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::ComputePolygons< TreeType, PrimBuilder >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::CopyArray< T >
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::FlagAndCountQuadsToSubdivide
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::SubdivideQuads
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::ReviseSeamLineFlags
 
struct  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MaskDisorientedTrianglePoints< InputTreeType >
 

Namespaces

 openvdb
 
 openvdb::OPENVDB_VERSION_NAME
 
 openvdb::OPENVDB_VERSION_NAME::tools
 
 openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal
 

Typedefs

using openvdb::OPENVDB_VERSION_NAME::tools::PointList = hboost::scoped_array< openvdb::Vec3s >
 Point and primitive list types. More...
 
using openvdb::OPENVDB_VERSION_NAME::tools::PolygonPoolList = hboost::scoped_array< PolygonPool >
 Point and primitive list types. More...
 

Enumerations

enum  { openvdb::OPENVDB_VERSION_NAME::tools::POLYFLAG_EXTERIOR = 0x1, openvdb::OPENVDB_VERSION_NAME::tools::POLYFLAG_FRACTURE_SEAM = 0x2, openvdb::OPENVDB_VERSION_NAME::tools::POLYFLAG_SUBDIVIDED = 0x4 }
 Polygon flags, used for reference based meshing. More...
 
enum  {
  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::SIGNS = 0xFF, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::EDGES = 0xE00, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::INSIDE = 0x100, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::XEDGE = 0x200,
  openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::YEDGE = 0x400, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::ZEDGE = 0x800, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::SEAM = 0x1000
}
 Bit-flags used to classify cells. More...
 

Functions

template<typename GridType >
void openvdb::OPENVDB_VERSION_NAME::tools::volumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec4I > &quads, double isovalue=0.0)
 Uniformly mesh any scalar grid that has a continuous isosurface. More...
 
template<typename GridType >
void openvdb::OPENVDB_VERSION_NAME::tools::volumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec3I > &triangles, std::vector< Vec4I > &quads, double isovalue=0.0, double adaptivity=0.0, bool relaxDisorientedTriangles=true)
 Adaptively mesh any scalar grid that has a continuous isosurface. More...
 
Vec3d openvdb::OPENVDB_VERSION_NAME::tools::findFeaturePoint (const std::vector< Vec3d > &points, const std::vector< Vec3d > &normals)
 Given a set of tangent elements, points with corresponding normals, this method returns the intersection point of all tangent elements. More...
 
template<typename ValueType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::fillArray (ValueType *array, const ValueType &val, const size_t length)
 
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isPlanarQuad (const Vec3d &p0, const Vec3d &p1, const Vec3d &p2, const Vec3d &p3, double epsilon=0.001)
 
template<typename T >
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isBoolValue ()
 
template<>
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isBoolValue< bool > ()
 
template<typename T >
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isInsideValue (T value, T isovalue)
 
template<>
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isInsideValue< bool > (bool value, bool)
 
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::getCellVertexValues (const AccessorT &accessor, Coord ijk, math::Tuple< 8, typename AccessorT::ValueType > &values)
 
template<typename LeafT >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::getCellVertexValues (const LeafT &leaf, const Index offset, math::Tuple< 8, typename LeafT::ValueType > &values)
 
template<typename ValueType >
uint8_t openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computeSignFlags (const math::Tuple< 8, ValueType > &values, const ValueType iso)
 
template<typename AccessorT >
uint8_t openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::evalCellSigns (const AccessorT &accessor, const Coord &ijk, typename AccessorT::ValueType iso)
 General method that computes the cell-sign configuration at the given ijk coordinate. More...
 
template<typename LeafT >
uint8_t openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::evalCellSigns (const LeafT &leaf, const Index offset, typename LeafT::ValueType iso)
 Leaf node optimized method that computes the cell-sign configuration at the given local offset. More...
 
template<class AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::correctCellSigns (uint8_t &signs, uint8_t face, const AccessorT &acc, Coord ijk, typename AccessorT::ValueType iso)
 Used to correct topological ambiguities related to two adjacent cells that share an ambiguous face. More...
 
template<class AccessorT >
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isNonManifold (const AccessorT &accessor, const Coord &ijk, typename AccessorT::ValueType isovalue, const int dim)
 
template<class LeafType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::mergeVoxels (LeafType &leaf, const Coord &start, int dim, int regionId)
 
template<class LeafType >
bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::isMergable (LeafType &leaf, const Coord &start, int dim, typename LeafType::ValueType::value_type adaptivity)
 
double openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::evalZeroCrossing (double v0, double v1, double iso)
 linear interpolation. More...
 
template<typename LeafT >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::collectCornerValues (const LeafT &leaf, const Index offset, std::vector< double > &values)
 Extracts the eight corner values for leaf inclusive cells. More...
 
template<typename AccessorT >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::collectCornerValues (const AccessorT &acc, const Coord &ijk, std::vector< double > &values)
 Extracts the eight corner values for a cell starting at the given coordinate. More...
 
Vec3d openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computePoint (const std::vector< double > &values, unsigned char signs, unsigned char edgeGroup, double iso)
 Computes the average cell point for a given edge group. More...
 
int openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computeMaskedPoint (Vec3d &avg, const std::vector< double > &values, unsigned char signs, unsigned char signsMask, unsigned char edgeGroup, double iso)
 Computes the average cell point for a given edge group, ignoring edge samples present in the signsMask configuration. More...
 
Vec3d openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computeWeightedPoint (const Vec3d &p, const std::vector< double > &values, unsigned char signs, unsigned char edgeGroup, double iso)
 Computes the average cell point for a given edge group, by computing convex weights based on the distance from the sample point p. More...
 
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computeCellPoints (std::vector< Vec3d > &points, const std::vector< double > &values, unsigned char signs, double iso)
 Computes the average cell points defined by the sign configuration signs and the given corner values values. More...
 
int openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::matchEdgeGroup (unsigned char groupId, unsigned char lhsSigns, unsigned char rhsSigns)
 Given a sign configuration lhsSigns and an edge group groupId, finds the corresponding edge group in a different sign configuration rhsSigns. Returns -1 if no match is found. More...
 
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computeCellPoints (std::vector< Vec3d > &points, std::vector< bool > &weightedPointMask, const std::vector< double > &lhsValues, const std::vector< double > &rhsValues, unsigned char lhsSigns, unsigned char rhsSigns, double iso, size_t pointIdx, const uint32_t *seamPointArray)
 Computes the average cell points defined by the sign configuration signs and the given corner values values. Combines data from two different level sets to eliminate seam lines when meshing fractured segments. More...
 
template<typename SignDataTreeType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::markSeamLineData (SignDataTreeType &signFlagsTree, const SignDataTreeType &refSignFlagsTree)
 
template<typename SignAccT , typename IdxAccT , typename PrimBuilder >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::constructPolygons (bool invertSurfaceOrientation, Int16 flags, Int16 refFlags, const Vec3i &offsets, const Coord &ijk, const SignAccT &signAcc, const IdxAccT &idxAcc, PrimBuilder &mesher)
 
template<typename InputTreeType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::maskActiveTileBorders (const InputTreeType &inputTree, typename InputTreeType::ValueType iso, typename InputTreeType::template ValueConverter< bool >::Type &mask)
 
template<typename VoxelEdgeAcc , typename LeafNode >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::evalInternalVoxelEdges (VoxelEdgeAcc &edgeAcc, const LeafNode &leafnode, const LeafNodeVoxelOffsets &voxels, const typename LeafNode::ValueType iso)
 
template<typename LeafNode , typename TreeAcc , typename VoxelEdgeAcc >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::evalExtrenalVoxelEdges (VoxelEdgeAcc &edgeAcc, TreeAcc &acc, const LeafNode &lhsNode, const LeafNodeVoxelOffsets &voxels, const typename LeafNode::ValueType iso)
 
template<typename LeafNode , typename TreeAcc , typename VoxelEdgeAcc >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::evalExtrenalVoxelEdgesInv (VoxelEdgeAcc &edgeAcc, TreeAcc &acc, const LeafNode &leafnode, const LeafNodeVoxelOffsets &voxels, const typename LeafNode::ValueType iso)
 
template<typename InputTreeType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::identifySurfaceIntersectingVoxels (typename InputTreeType::template ValueConverter< bool >::Type &intersectionTree, const InputTreeType &inputTree, typename InputTreeType::ValueType isovalue)
 
template<typename InputGridType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::applySurfaceMask (typename InputGridType::TreeType::template ValueConverter< bool >::Type &intersectionTree, typename InputGridType::TreeType::template ValueConverter< bool >::Type &borderTree, const InputGridType &inputGrid, const GridBase::ConstPtr &maskGrid, bool invertMask, typename InputGridType::ValueType isovalue)
 
template<typename InputTreeType >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::computeAuxiliaryData (typename InputTreeType::template ValueConverter< Int16 >::Type &signFlagsTree, typename InputTreeType::template ValueConverter< Index32 >::Type &pointIndexTree, const typename InputTreeType::template ValueConverter< bool >::Type &intersectionTree, const InputTreeType &inputTree, typename InputTreeType::ValueType isovalue)
 
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::subdivideNonplanarSeamLineQuads (PolygonPoolList &polygonPoolList, size_t polygonPoolListSize, PointList &pointList, size_t &pointListSize, std::vector< uint8_t > &pointFlags)
 
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::reviseSeamLineFlags (PolygonPoolList &polygonPoolList, size_t polygonPoolListSize, std::vector< uint8_t > &pointFlags)
 
template<typename InputTree >
void openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::relaxDisorientedTriangles (bool invertSurfaceOrientation, const InputTree &inputTree, const math::Transform &transform, PolygonPoolList &polygonPoolList, size_t polygonPoolListSize, PointList &pointList, const size_t pointListSize)
 
template<typename GridType >
std::enable_if< std::is_scalar
< typename GridType::ValueType >
::value, void >::type 
openvdb::OPENVDB_VERSION_NAME::tools::doVolumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec3I > &triangles, std::vector< Vec4I > &quads, double isovalue, double adaptivity, bool relaxDisorientedTriangles)
 
template<typename GridType >
std::enable_if<!std::is_scalar
< typename GridType::ValueType >
::value, void >::type 
openvdb::OPENVDB_VERSION_NAME::tools::doVolumeToMesh (const GridType &, std::vector< Vec3s > &, std::vector< Vec3I > &, std::vector< Vec4I > &, double, double, bool)
 

Variables

const bool openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::sAdaptable [256]
 Used to quickly determine if a given cell is adaptable. More...
 
const unsigned char openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::sAmbiguousFace [256]
 Contains the ambiguous face index for certain cell configuration. More...
 
const unsigned char openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::sEdgeGroupTable [256][13]
 Lookup table for different cell sign configurations. The first entry specifies the total number of points that need to be generated inside a cell and the remaining 12 entries indicate different edge groups. More...
 
enum  { openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MASK_FIRST_10_BITS = 0x000003FF, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MASK_DIRTY_BIT = 0x80000000, openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::MASK_INVALID_BIT = 0x40000000 }
 Utility methods for point quantization. More...
 
uint32_t openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::packPoint (const Vec3d &v)
 Utility methods for point quantization. More...
 
Vec3d openvdb::OPENVDB_VERSION_NAME::tools::volume_to_mesh_internal::unpackPoint (uint32_t data)
 Utility methods for point quantization. More...
 

Detailed Description

Extract polygonal surfaces from scalar volumes.

Author
Mihai Alden

Definition in file VolumeToMesh.h.