38 vtkInformationVector **
ttkNotUsed(inputVector),
39 vtkInformationVector *outputVector) {
42 = this->Centers ? this->Centers->GetNumberOfTuples() : 1;
46 bool const useDoublePrecision
47 = this->Centers ? this->Centers->GetDataType() == VTK_DOUBLE :
false;
51 size_t nTriangles = 0;
53 nVertices, nTriangles, nSubdivisions);
55 const size_t nTotalVertices = nSpheres * nVertices;
56 const size_t nTotalTriangles = nSpheres * nTriangles;
59 points->SetDataType(useDoublePrecision ? VTK_DOUBLE : VTK_FLOAT);
60 points->SetNumberOfPoints(nTotalVertices);
63 if(this->ComputeNormals) {
64 if(useDoublePrecision)
69 normals->SetName(
"Normals");
70 normals->SetNumberOfComponents(3);
71 normals->SetNumberOfTuples(nTotalVertices);
75 offsets->SetNumberOfTuples(nTotalTriangles + 1);
78 for(
size_t i = 0; i <= nTotalTriangles; i++)
79 offsetsData[i] = i * 3;
82 connectivity->SetNumberOfTuples(nTotalTriangles * 3);
85 if(useDoublePrecision) {
87 status = this->computeIcospheres<DT, vtkIdType>(
88 ttkUtils::GetPointer<DT>(points->GetData()),
89 ttkUtils::GetPointer<vtkIdType>(connectivity),
91 nSpheres, nSubdivisions, radius,
92 this->Centers ? ttkUtils::GetPointer<DT>(this->Centers) : this->Center,
93 this->ComputeNormals ? ttkUtils::GetPointer<DT>(normals) :
nullptr);
97 (DT)this->Center[0], (DT)this->Center[1], (DT)this->Center[2]};
98 status = this->computeIcospheres<DT, vtkIdType>(
99 ttkUtils::GetPointer<DT>(points->GetData()),
100 ttkUtils::GetPointer<vtkIdType>(connectivity),
102 nSpheres, nSubdivisions, radius,
103 this->Centers ? ttkUtils::GetPointer<DT>(this->Centers) : centerFloat,
104 this->ComputeNormals ? ttkUtils::GetPointer<DT>(normals) :
nullptr);
112 auto output = vtkPolyData::GetData(outputVector);
113 output->SetPoints(points);
116 cells->SetData(offsets, connectivity);
117 output->SetPolys(cells);
119 if(this->ComputeNormals)
120 output->GetPointData()->SetNormals(normals);