4#include <vtkDoubleArray.h>
5#include <vtkInformation.h>
6#include <vtkIntArray.h>
7#include <vtkObjectFactory.h>
8#include <vtkPointData.h>
9#include <vtkUnstructuredGrid.h>
14#include <vtkPythonInterpreter.h>
23 this->SetNumberOfInputPorts(0);
24 this->SetNumberOfOutputPorts(1);
34 vtkInformation *info) {
36 info->Set(vtkDataObject::DATA_TYPE_NAME(),
"vtkUnstructuredGrid");
47 std::string
const code(R
"(
48from paraview.simple import GetActiveView
49from paraview.simple import FindSource
51self = FindSource("TTKDarkroomCamera1")
55 self.Position = view.CameraPosition
56 self.Up = view.CameraViewUp
57 self.FocalPoint = view.CameraFocalPoint
60 vtkPythonInterpreter::RunSimpleString(code.data());
91 vtkInformationVector **
ttkNotUsed(inputVector),
92 vtkInformationVector *outputVector) {
97 auto output = vtkUnstructuredGrid::GetData(outputVector);
102 points->InsertNextPoint(this->Position);
103 output->SetPoints(points);
111 offsetArray->SetNumberOfTuples(2);
114 offsetArrayData[0] = 0;
115 offsetArrayData[1] = 1;
120 connectivityArray->SetNumberOfTuples(1);
121 auto connectivityArrayData
123 connectivityArrayData[0] = 0;
126 cells->SetData(offsetArray, connectivityArray);
127 output->SetCells(VTK_VERTEX, cells);
132 = [](vtkPointData *pd,
const std::string &name,
const double *data) {
134 array->SetName(name.data());
135 array->SetNumberOfComponents(3);
136 array->SetNumberOfTuples(1);
138 arrayData[0] = data[0];
139 arrayData[1] = data[1];
140 arrayData[2] = data[2];
143 auto pd = output->GetPointData();
144 generateArray(pd,
"CamUp", this->Up);
145 generateArray(pd,
"CamFocalPoint", this->FocalPoint);
#define ttkNotUsed(x)
Mark function/method parameters that are not used in the function body at all.
This source generates a Cinema Darkroom Camera.
int FillOutputPortInformation(int port, vtkInformation *info) override
int SyncWithParaViewCamera()
~ttkCinemaDarkroomCamera() override
int FillInputPortInformation(int port, vtkInformation *info) override
ttkCinemaDarkroomCamera()
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
static void * GetVoidPointer(vtkDataArray *array, vtkIdType start=0)
void setDebugMsgPrefix(const std::string &prefix)
vtkStandardNewMacro(ttkCinemaDarkroomCamera)
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)