TTK
Loading...
Searching...
No Matches
ttkGaussianPointCloud.cpp
Go to the documentation of this file.
1#include <vtkIdTypeArray.h>
2#include <vtkInformation.h>
3#include <vtkNew.h>
4#include <vtkPolyData.h>
5
7#include <ttkUtils.h>
8
10
12 SetNumberOfInputPorts(0);
13 SetNumberOfOutputPorts(1);
14}
15
17 vtkInformation *info) {
18 if(port == 0) {
19 info->Set(vtkDataObject::DATA_TYPE_NAME(), "vtkPolyData");
20 return 1;
21 }
22 return 0;
23}
24
26 vtkInformation *ttkNotUsed(request),
27 vtkInformationVector **ttkNotUsed(inputVector),
28 vtkInformationVector *outputVector) {
29
30 auto domain = vtkPolyData::GetData(outputVector);
31
32 vtkNew<vtkPoints> points{};
33 points->SetNumberOfPoints(NumberOfSamples);
34
35 if(points->GetDataType() == VTK_FLOAT) {
36 this->generate<float>(
37 Dimension, NumberOfSamples, RandomSeed,
38 static_cast<float *>(ttkUtils::GetVoidPointer(points)));
39 } else if(points->GetDataType() == VTK_DOUBLE) {
40 this->generate<double>(
41 Dimension, NumberOfSamples, RandomSeed,
42 static_cast<double *>(ttkUtils::GetVoidPointer(points)));
43 }
44
45 ttkUtils::CellVertexFromPoints(domain, points);
46
47 return 1;
48}
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
Definition: BaseClass.h:47
TTK VTK-filter that generates a 1D, 2D or 3D point cloud by randomly casting samples from a Gaussian ...
int FillOutputPortInformation(int port, vtkInformation *info) override
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
static void * GetVoidPointer(vtkDataArray *array, vtkIdType start=0)
Definition: ttkUtils.cpp:225
static int CellVertexFromPoints(vtkDataSet *const dataSet, vtkPoints *const points)
Definition: ttkUtils.cpp:327
vtkStandardNewMacro(ttkGaussianPointCloud)