OpenVDB: openvdb/points/PointReplicate.h Source File

OpenVDB 12.1.1

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
13#include <openvdb/points/PointDataGrid.h>
14#include <openvdb/tools/Prune.h>
15#include <openvdb/util/Assert.h>
16
17namespace openvdb {
18 OPENVDB_USE_VERSION_NAMESPACE
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
39 replicate(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
60 replicate(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
69#include "impl/PointReplicateImpl.h"
70
71#endif // OPENVDB_POINTS_POINT_REPLICATE_HAS_BEEN_INCLUDED
Assert.h
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::v12_1::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:218