OpenVDB 11.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: MPL-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
13#include <openvdb/points/PointDataGrid.h>
14#include <openvdb/tools/Prune.h>
15
16 namespace openvdb {
17 OPENVDB_USE_VERSION_NAMESPACE
18 namespace OPENVDB_VERSION_NAME {
19 namespace points {
20
21/// @brief Replicates points provided in a source grid into a new grid,
22/// transfering and creating attributes found in a provided
23/// attribute vector. If an attribute doesn't exist, it is ignored.
24/// Position is always replicated, leaving the new points exactly
25/// over the top of the source points.
26/// @note The position attribute must exist
27/// @param source The source grid to replicate points from
28/// @param multiplier The base number of points to replicate per point
29/// @param attributes Attributes to transfer to the new grid
30/// @param scaleAttribute A scale float attribute which multiplies the base
31/// multiplier to vary the point count per point.
32/// @param replicationIndex When provided, creates a replication attribute
33/// of the given name which holds the replication
34/// index. This can be subsequently used to modify
35/// the replicated points as a post process.
36 template <typename PointDataGridT>
37 typename PointDataGridT::Ptr
38 replicate(const PointDataGridT& source,
39 const Index multiplier,
40 const std::vector<std::string>& attributes,
41 const std::string& scaleAttribute = "",
42 const std::string& replicationIndex = "");
43
44/// @brief Replicates points provided in a source grid into a new grid,
45/// transfering and creating all attributes from the source grid.
46/// Position is always replicated, leaving the new points exactly
47/// over the top of the source points.
48/// @note The position attribute must exist
49/// @param source The source grid to replicate points from
50/// @param multiplier The base number of points to replicate per point
51/// @param scaleAttribute A scale float attribute which multiplies the base
52/// multiplier to vary the point count per point.
53/// @param replicationIndex When provided, creates a replication attribute
54/// of the given name which holds the replication
55/// index. This can be subsequently used to modify
56/// the replicated points as a post process.
57 template <typename PointDataGridT>
58 typename PointDataGridT::Ptr
59 replicate(const PointDataGridT& source,
60 const Index multiplier,
61 const std::string& scaleAttribute = "",
62 const std::string& replicationIndex = "");
63
64} // namespace points
65} // namespace OPENVDB_VERSION_NAME
66} // namespace openvdb
67
68#include "impl/PointReplicateImpl.h"
69
70#endif // OPENVDB_POINTS_POINT_REPLICATE_HAS_BEEN_INCLUDED
PointDataGrid.h
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
PointReplicateImpl.h
Prune.h
Defined various multi-threaded utility functions for trees.
openvdb::v11_0::points::replicate
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
openvdb
Definition Exceptions.h:13
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