OpenVDB 12.0.0
 
Loading...
Searching...
No Matches
PointReplicate.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: Apache-2.0
3
4/// @author Nick Avramoussis
5///
6/// @file PointReplicate.h
7///
8/// @brief Algorithms to duplicate points in PointDataGrids.
9
10#ifndef OPENVDB_POINTS_POINT_REPLICATE_HAS_BEEN_INCLUDED
11#define OPENVDB_POINTS_POINT_REPLICATE_HAS_BEEN_INCLUDED
12
14#include <openvdb/tools/Prune.h>
15#include <openvdb/util/Assert.h>
16
17namespace openvdb {
19namespace OPENVDB_VERSION_NAME {
20namespace points {
21
22/// @brief Replicates points provided in a source grid into a new grid,
23/// transfering and creating attributes found in a provided
24/// attribute vector. If an attribute doesn't exist, it is ignored.
25/// Position is always replicated, leaving the new points exactly
26/// over the top of the source points.
27/// @note The position attribute must exist
28/// @param source The source grid to replicate points from
29/// @param multiplier The base number of points to replicate per point
30/// @param attributes Attributes to transfer to the new grid
31/// @param scaleAttribute A scale float attribute which multiplies the base
32/// multiplier to vary the point count per point.
33/// @param replicationIndex When provided, creates a replication attribute
34/// of the given name which holds the replication
35/// index. This can be subsequently used to modify
36/// the replicated points as a post process.
37template <typename PointDataGridT>
38typename PointDataGridT::Ptr
39replicate(const PointDataGridT& source,
40 const Index multiplier,
41 const std::vector<std::string>& attributes,
42 const std::string& scaleAttribute = "",
43 const std::string& replicationIndex = "");
44
45/// @brief Replicates points provided in a source grid into a new grid,
46/// transfering and creating all attributes from the source grid.
47/// Position is always replicated, leaving the new points exactly
48/// over the top of the source points.
49/// @note The position attribute must exist
50/// @param source The source grid to replicate points from
51/// @param multiplier The base number of points to replicate per point
52/// @param scaleAttribute A scale float attribute which multiplies the base
53/// multiplier to vary the point count per point.
54/// @param replicationIndex When provided, creates a replication attribute
55/// of the given name which holds the replication
56/// index. This can be subsequently used to modify
57/// the replicated points as a post process.
58template <typename PointDataGridT>
59typename PointDataGridT::Ptr
60replicate(const PointDataGridT& source,
61 const Index multiplier,
62 const std::string& scaleAttribute = "",
63 const std::string& replicationIndex = "");
64
65} // namespace points
66} // namespace OPENVDB_VERSION_NAME
67} // namespace openvdb
68
70
71#endif // OPENVDB_POINTS_POINT_REPLICATE_HAS_BEEN_INCLUDED
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
Defined various multi-threaded utility functions for trees.
PointDataGridT::Ptr replicate(const PointDataGridT &source, const Index multiplier, const std::vector< std::string > &attributes, const std::string &scaleAttribute="", const std::string &replicationIndex="")
Replicates points provided in a source grid into a new grid, transfering and creating attributes foun...
Definition PointReplicateImpl.h:19
Definition Exceptions.h:13
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218