OpenVDB  3.0.0
Classes | Namespaces | Enumerations | Functions | Variables
VolumeToMesh.h File Reference
#include <openvdb/Platform.h>
#include <openvdb/tree/ValueAccessor.h>
#include <openvdb/util/Util.h>
#include <openvdb/math/Operators.h>
#include <openvdb/tools/Morphology.h>
#include <openvdb/tree/LeafManager.h>
#include "Prune.h"
#include <boost/scoped_array.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/type_traits/is_scalar.hpp>
#include <boost/utility/enable_if.hpp>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <vector>
#include <memory>

Go to the source code of this file.

Classes

class  PolygonPool
 Collection of quads and triangles. More...
 
class  VolumeToMesh
 Mesh any scalar grid that has a continuous isosurface. More...
 
struct  UniquePtr< T >
 
class  SignData< TreeT, LeafManagerT >
 
class  CountPoints
 Counts the total number of points per leaf, accounts for cells with multiple points. More...
 
class  MapPoints< Int16TreeT >
 Computes the point list indices for the index tree. More...
 
class  CountRegions< IntTreeT >
 Counts the total number of points per collapsed region. More...
 
class  GenPoints< TreeT, LeafManagerT >
 
class  SeamWeights< TreeT >
 
class  MergeVoxelRegions< TreeT, LeafManagerT >
 
struct  UniformPrimBuilder
 
struct  AdaptivePrimBuilder
 
class  GenPolygons< LeafManagerT, PrimBuilder >
 
struct  PartOp
 
class  PartGen< SrcTreeT >
 
class  GenSeamMask< TreeT, LeafManagerT >
 
class  TagSeamEdges< TreeT >
 
struct  MaskEdges< BoolTreeT >
 
class  FlagUsedPoints
 
class  RemapIndices
 
class  MovePoints
 
class  GenTopologyMask< SrcTreeT >
 
class  GenBoundaryMask< SrcTreeT >
 
class  GenTileMask< TreeT >
 
class  PointListCopy
 

Namespaces

 openvdb
 
 openvdb::v3_0_0
 
 openvdb::v3_0_0::tools
 
 openvdb::v3_0_0::tools::internal
 

Typedefs

typedef boost::scoped_array< openvdb::Vec3s > PointList
 Point and primitive list types. More...
 
typedef boost::scoped_array< PolygonPool > PolygonPoolList
 Point and primitive list types. More...
 

Enumerations

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

Functions

template<typename GridType >
void 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 volumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec3I > &triangles, std::vector< Vec4I > &quads, double isovalue=0.0, double adaptivity=0.0)
 Adaptively mesh any scalar grid that has a continuous isosurface. More...
 
Vec3d 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...
 
bool isPlanarQuad (const Vec3d &p0, const Vec3d &p1, const Vec3d &p2, const Vec3d &p3, double epsilon=0.001)
 
template<typename AccessorT >
unsigned char 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 >
unsigned char 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 correctCellSigns (unsigned char &signs, unsigned char 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 isNonManifold (const AccessorT &accessor, const Coord &ijk, typename AccessorT::ValueType isovalue, const int dim)
 
template<class LeafType >
void mergeVoxels (LeafType &leaf, const Coord &start, int dim, int regionId)
 
template<class LeafType >
bool isMergable (LeafType &leaf, const Coord &start, int dim, typename LeafType::ValueType::value_type adaptivity)
 
double evalRoot (double v0, double v1, double iso)
 
template<typename LeafT >
void 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 collectCornerValues (const AccessorT &acc, const Coord &ijk, std::vector< double > &values)
 Extracts the eight corner values for a cell starting at the given $(i,j,k)$ coordinate. More...
 
Vec3d 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 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 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 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 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 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 boost::scoped_array< uint32_t > &seamPoints)
 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 SignAccT , typename IdxAccT , typename PrimBuilder >
void constructPolygons (Int16 flags, Int16 refFlags, const Vec4i &offsets, const Coord &ijk, const SignAccT &signAcc, const IdxAccT &idxAcc, PrimBuilder &mesher, Index32 pointListSize)
 
template<class DistTreeT , class SignTreeT , class IdxTreeT >
void tileData (const DistTreeT &distTree, SignTreeT &signTree, IdxTreeT &idxTree, double iso)
 
template<typename LeafManagerT >
bool needsActiveVoxePadding (const LeafManagerT &leafs, double iso, double voxelSize)
 
template<typename GridType >
boost::enable_if< boost::is_scalar< typename GridType::ValueType >, void >::type doVolumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec3I > &triangles, std::vector< Vec4I > &quads, double isovalue, double adaptivity)
 
template<typename GridType >
boost::disable_if< boost::is_scalar< typename GridType::ValueType >, void >::type doVolumeToMesh (const GridType &, std::vector< Vec3s > &, std::vector< Vec3I > &, std::vector< Vec4I > &, double, double)
 

Variables

const bool sAdaptable [256]
 Used to quickly determine if a given cell is adaptable. More...
 
const unsigned char sAmbiguousFace [256]
 Contains the ambiguous face index for certain cell configuration. More...
 
const unsigned char 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  { MASK_FIRST_10_BITS = 0x000003FF, MASK_DIRTY_BIT = 0x80000000, MASK_INVALID_BIT = 0x40000000 }
 Utility methods for point quantization. More...
 
uint32_t packPoint (const Vec3d &v)
 Utility methods for point quantization. More...
 
Vec3d unpackPoint (uint32_t data)
 Utility methods for point quantization. More...