Loading...
Searching...
No Matches
PointRasterizeTrilinear.h
Go to the documentation of this file.
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
//
/// @author Nick Avramoussis
///
/// @file PointRasterizeTrilinear.h
///
/// @brief Transfer schemes for rasterizing point data
///
#ifndef OPENVDB_POINTS_RASTERIZE_TRILINEAR_HAS_BEEN_INCLUDED
#define OPENVDB_POINTS_RASTERIZE_TRILINEAR_HAS_BEEN_INCLUDED
#include <openvdb/openvdb.h>
#include <openvdb/Types.h>
#include <openvdb/Grid.h>
#include <openvdb/math/Math.h>
#include <openvdb/math/Transform.h>
#include <openvdb/tools/Morphology.h>
#include <openvdb/tree/ValueAccessor.h>
#include "PointDataGrid.h"
#include "PointMask.h"
#include "PointTransfer.h"
#include <string>
namespace openvdb {
OPENVDB_USE_VERSION_NAMESPACE
namespace OPENVDB_VERSION_NAME {
namespace points {
///
template <typename ValueT, bool Staggered = true>
struct TrilinearTraits
{
using ResultT = typename std::conditional<
VecTraits<ValueT>::IsVec, ValueT, math::Vec3<ValueT>>::type;
template <typename PointDataTreeT>
using TreeT = typename PointDataTreeT::template ValueConverter<ResultT>::Type;
};
///
template <typename ValueT>
struct TrilinearTraits<ValueT, false>
{
using ResultT = ValueT;
template <typename PointDataTreeT>
using TreeT = typename PointDataTreeT::template ValueConverter<ResultT>::Type;
};
/// @brief Perform weighted trilinear rasterization of all points within a
/// voxel. This method takes and returns a tree i.e. ignores grid
/// transformations.
/// @details Accumulates values and weights according to a simple 0-1-0 weighted
/// hat function. This algorithm is an exact inverse of a trilinear
/// interpolation and thus a key method used in PIC/FLIP style simulations.
/// Returns a tree of the same precision as the input source attribute, but
/// may be of a different math type depending on the value of the Staggered
/// template attribute. If Staggered is true, this method produces values at
/// each voxels negative faces, causing scalar attributes to produce
/// math::Vec3<ValueT> tree types. The result Tree type is equal to:
/// TrilinearTraits<ValueT, Staggered>::template TreeT<PointDataTreeT>
/// @tparam Staggered whether to perform a staggered or collocated rasterization
/// @tparam ValueT the value type of the point attribute to rasterize
/// @param points the point tree to be rasterized
/// @param attribute the name of the attribute to rasterize. Must be a scalar
/// or Vec3 attribute.
/// @param filter an optional point filter to use
template <bool Staggered,
typename ValueT,
typename FilterT = NullFilter,
typename PointDataTreeT = PointDataTree>
inline auto
rasterizeTrilinear(const PointDataTreeT& points,
const std::string& attribute,
const FilterT& filter = NullFilter());
} // namespace points
} // namespace OPENVDB_VERSION_NAME
} // namespace openvdb
#include "impl/PointRasterizeTrilinearImpl.h"
#endif //OPENVDB_POINTS_RASTERIZE_TRILINEAR_HAS_BEEN_INCLUDED
Grid.h
Math.h
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Morphology.h
Implementation of morphological dilation and erosion.
PointDataGrid.h
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
PointMask.h
Methods for extracting masks from VDB Point grids.
PointRasterizeTrilinearImpl.h
PointTransfer.h
Framework methods for rasterizing PointDataGrid data to Trees.
Transform.h
Types.h
ValueAccessor.h
ValueAccessors are designed to help accelerate accesses into the OpenVDB Tree structures by storing c...
openvdb::v11_0::math::Vec3
Definition Vec3.h:24
openvdb::v11_0::points::NullFilter
A no-op filter that can be used when iterating over all indices.
Definition IndexIterator.h:51
openvdb::v11_0::points
Definition AttributeArray.h:41
openvdb::v11_0::points::rasterizeTrilinear
auto rasterizeTrilinear(const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
Perform weighted trilinear rasterization of all points within a voxel. This method takes and returns ...
Definition PointRasterizeTrilinearImpl.h:330
openvdb::v11_0::points::PointDataTree
tree::Tree< tree::RootNode< tree::InternalNode< tree::InternalNode< PointDataLeafNode< PointDataIndex32, 3 >, 4 >, 5 > > > PointDataTree
Point index tree configured to match the default VDB configurations.
Definition PointDataGrid.h:189
openvdb
Definition Exceptions.h:13
openvdb.h
openvdb::v11_0::VecTraits::IsVec
static const bool IsVec
Definition Types.h:245
openvdb::v11_0::points::TrilinearTraits< ValueT, false >::TreeT
typename PointDataTreeT::template ValueConverter< ResultT >::Type TreeT
Definition PointRasterizeTrilinear.h:49
openvdb::v11_0::points::TrilinearTraits< ValueT, false >::ResultT
ValueT ResultT
Definition PointRasterizeTrilinear.h:47
openvdb::v11_0::points::TrilinearTraits
Definition PointRasterizeTrilinear.h:36
openvdb::v11_0::points::TrilinearTraits::ResultT
typename std::conditional< VecTraits< ValueT >::IsVec, ValueT, math::Vec3< ValueT > >::type ResultT
Definition PointRasterizeTrilinear.h:37
openvdb::v11_0::points::TrilinearTraits::TreeT
typename PointDataTreeT::template ValueConverter< ResultT >::Type TreeT
Definition PointRasterizeTrilinear.h:40
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212