42 #include <pcl/common/generate.h>
43 #include <pcl/console/print.h>
52 template <
typename Po
intT,
typename GeneratorT>
60 template <
typename Po
intT,
typename GeneratorT>
63 setParameters (params);
67 template <
typename Po
intT,
typename GeneratorT>
71 : x_generator_ (x_params)
72 , y_generator_ (y_params)
73 , z_generator_ (z_params)
77 template <
typename Po
intT,
typename GeneratorT>
void
84 x_generator_.setParameters (params);
85 y_generator_.setParameters (y_params);
86 z_generator_.setParameters (z_params);
90 template <
typename Po
intT,
typename GeneratorT>
void
93 x_generator_.setParameters (x_params);
97 template <
typename Po
intT,
typename GeneratorT>
void
100 y_generator_.setParameters (y_params);
104 template <
typename Po
intT,
typename GeneratorT>
void
107 z_generator_.setParameters (z_params);
114 return x_generator_.getParameters ();
121 return y_generator_.getParameters ();
128 return z_generator_.getParameters ();
132 template <
typename Po
intT,
typename GeneratorT>
PointT
136 p.x = x_generator_.run ();
137 p.y = y_generator_.run ();
138 p.z = z_generator_.run ();
143 template <
typename Po
intT,
typename GeneratorT>
int
150 template <
typename Po
intT,
typename GeneratorT>
int
155 PCL_ERROR (
"[pcl::common::CloudGenerator] Cloud width must be >= 1!\n");
161 PCL_ERROR (
"[pcl::common::CloudGenerator] Cloud height must be >= 1!\n");
167 PCL_WARN (
"[pcl::common::CloudGenerator] Cloud data will be erased with new data!\n");
174 for (
auto& point: cloud)
176 point.x = x_generator_.run ();
177 point.y = y_generator_.run ();
178 point.z = z_generator_.run ();
184 template <
typename GeneratorT>
191 template <
typename GeneratorT>
194 : x_generator_ (x_params)
195 , y_generator_ (y_params)
199 template <
typename GeneratorT>
206 template <
typename GeneratorT>
void
209 x_generator_.setParameters (params);
212 y_generator_.setParameters (y_params);
216 template <
typename GeneratorT>
void
219 x_generator_.setParameters (x_params);
223 template <
typename GeneratorT>
void
226 y_generator_.setParameters (y_params);
233 return x_generator_.getParameters ();
240 return y_generator_.getParameters ();
248 p.
x = x_generator_.run ();
249 p.
y = y_generator_.run ();
254 template <
typename GeneratorT>
int
261 template <
typename GeneratorT>
int
266 PCL_ERROR (
"[pcl::common::CloudGenerator] Cloud width must be >= 1\n!");
272 PCL_ERROR (
"[pcl::common::CloudGenerator] Cloud height must be >= 1\n!");
277 PCL_WARN (
"[pcl::common::CloudGenerator] Cloud data will be erased with new data\n!");
279 cloud.
resize (width, height);
282 for (
auto &point : cloud)
284 point.x = x_generator_.run ();
285 point.y = y_generator_.run ();
PointCloud represents the base class in PCL for storing collections of 3D points.
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields).
void resize(std::size_t count)
Resizes the container to contain count elements.
std::uint32_t width
The point cloud width (if organized as an image-structure).
std::uint32_t height
The point cloud height (if organized as an image-structure).
typename GeneratorT::Parameters GeneratorParameters
int fill(pcl::PointCloud< PointT > &cloud)
Generates a cloud with X Y Z picked within given ranges.
const GeneratorParameters & getParametersForX() const
void setParametersForY(const GeneratorParameters &y_params)
Set parameters for y values generation.
const GeneratorParameters & getParametersForY() const
void setParametersForZ(const GeneratorParameters &z_params)
Set parameters for z values generation.
void setParameters(const GeneratorParameters ¶ms)
Set parameters for x, y and z values.
typename GeneratorT::Parameters GeneratorParameters
void setParametersForX(const GeneratorParameters &x_params)
Set parameters for x values generation.
const GeneratorParameters & getParametersForZ() const
CloudGenerator()
Default constructor.
A 2D point structure representing Euclidean xy coordinates.
A point structure representing Euclidean xyz coordinates, and the RGB color.