3#include <vtkInformation.h>
4#include <vtkObjectFactory.h>
7#include <vtkMultiBlockDataSet.h>
13 this->SetNumberOfInputPorts(1);
18 vtkInformation *info) {
20 info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(),
"vtkDataObject");
27 vtkInformationVector **inputVector,
28 vtkInformationVector *outputVector) {
29 auto input = vtkDataObject::GetData(inputVector[0], 0);
31 double bounds[6] = {0, 0, 0, 0, 0, 0};
32 if(input->IsA(
"vtkMultiBlockDataSet")) {
33 auto inputAsMB = vtkMultiBlockDataSet::SafeDownCast(input);
34 inputAsMB->GetBounds(bounds);
35 }
else if(input->IsA(
"vtkDataSet")) {
36 auto inputAsDS = vtkDataSet::SafeDownCast(input);
37 inputAsDS->GetBounds(bounds);
39 this->
printErr(
"Unable to compute bounding box of "
40 + std::string(input->GetClassName()));
44 double dx = bounds[1] - bounds[0];
45 double dy = bounds[3] - bounds[2];
46 double dz = bounds[5] - bounds[4];
48 this->
SetRadius(this->Scale * std::sqrt(dx * dx + dy * dy + dz * dz) / 2.0);
50 bounds[0] + dx * 0.5, bounds[2] + dy * 0.5, bounds[4] + dz * 0.5);
int FillInputPortInformation(int port, vtkInformation *info) override
~ttkIcosphereFromObject() override
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
virtual void SetCenter(double, double, double)
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
virtual void SetRadius(double)
void setDebugMsgPrefix(const std::string &prefix)
int printErr(const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const
vtkStandardNewMacro(ttkIcosphereFromObject)