How can i use the vtkStreamtracer to generate a streamline with my polydata
Sample code is here:
auto poly_data = GetPolyData(entity);
( This polydata contains Points and Verts)
// Here I am setting Velocity scalr values
poly_data->GetPointData()->SetScalars(scalars_values);
poly_data->GetPointData()->SetVectors(scalars_values);
poly_data->GetPointData()->SetActiveVectors("velocity");
// Point source
vtkSmartPointer<vtkPointSource> seeds = vtkSmartPointer<vtkPointSource>::New();
seeds->SetCenter(poly_data->GetCenter());
seeds->SetRadius(0.2);
seeds->SetDistributionToUniform();
seeds->SetNumberOfPoints(4);
vtkSmartPointer<vtkStreamTracer> stream_line = vtkSmartPointer<vtkStreamTracer>::New();
stream_line->SetInputData(poly_data);
stream_line->SetSourceConnection(seeds->GetOutputPort());
stream_line->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "velocity");
stream_line->SetComputeVorticity(true);
stream_line->SetMaximumPropagation(500);
stream_line->SetMaximumIntegrationStep(0.1);
stream_line->SetMinimumIntegrationStep(0.01);
stream_line->SetInitialIntegrationStep(0.05);
stream_line->SetIntegrationDirectionToBoth();
stream_line->SetIntegratorTypeToRungeKutta45();
stream_line->Update();
//Compute the velocity magnitues and create the ribbons
vtkNew<vtkArrayCalculator> magCalc;
magCalc->SetInputConnection(stream_line->GetOutputPort());
magCalc->AddVectorArrayName("velocity");
magCalc->SetResultArrayName("MagVelocity");
magCalc->SetFunction("mag(velocity)");
magCalc->Update();
//Create and render the ribbons
vtkNew<vtkRibbonFilter> ribbonFilter;
ribbonFilter->SetInputConnection(magCalc->GetOutputPort());
ribbonFilter->SetWidth(0.05);
vtkNew<vtkPolyDataMapper> streamLineMapper;
streamLineMapper->SetInputConnection(ribbonFilter->GetOutputPort());
streamLineMapper->SelectColorArray("MagVelocity");
streamLineMapper->SetScalarRange(poly_data->GetPointData()->GetScalars()->GetRange());
vtkNew<vtkActor> streamLineActor;
streamLineActor->SetMapper(streamLineMapper.Get());
auto outline = vtkSmartPointer<vtkOutlineFilter>::New();
outline->SetInputData(poly_data);
auto mapOutline = vtkSmartPointer<vtkPolyDataMapper>::New();
mapOutline->SetInputConnection(outline->GetOutputPort());
auto outlineActor = vtkSmartPointer<vtkActor>::New();
outlineActor->SetMapper(mapOutline);
outlineActor->GetProperty()->SetColor(0, 0, 0);
renderer_->AddActor(streamLineActor.Get());
renderer_->AddActor(outlineActor);
//Rest of the pipeline goes here
.....