I am implementing a program in C++ using the vtk9.3.0 library. The vector diagram of vtkUnstructuredGrid works normally, but when I draw a vector diagram on a cross section, it is aligned in the normal direction of the cut plane. Does anyone know the cause?
I implemented the program as follows.
// cx,cy,cz : org coord
// nx,ny,nz : normal vector
vtkSmartPointer plane = vtkSmartPointer::New();
plane->SetOrigin(cx, cy, cz);
plane->SetNormal(nx, ny, nz);
vtkSmartPointer cutter = vtkSmartPointer::New();
cutter->SetInputData(unstructured_grid);// unstructured_grid vtkUnstructuredGrid
cutter->SetCutFunction(plane);
cutter->Update();
vtkSmartPointer lut;
lut = setupColor(num_color, alph);// generate for LookupTable
vtkSmartPointer glyph = vtkSmartPointer::New();
glyph->SetInputConnection(cutter->GetOutputPort());
glyph->SetRange(minval, maxval); // minval=minimum value, maxval=max value
glyph->SetColorMode(VTK_COLOR_BY_VECTOR);
glyph->SetVectorModeToUseVector();
glyph->SetScaleModeToScaleByVector();
glyph->SetScaleFactor(scale);
vtkSmartPointer arrow = vtkSmartPointer::New();
glyph->SetSourceConnection(arrow->GetOutputPort());
glyph->Update();
vtkSmartPointer cut_mapper = vtkSmartPointer::New();
cut_mapper->SetInputConnection(glyph->GetOutputPort());
cut_mapper->ScalarVisibilityOn();
cut_mapper->SetScalarRange(minval, maxval);
cut_mapper->SetLookupTable(lut);
cut_mapper->Update();
vtkSmartPointer cut_actor = vtkSmartPointer::New();
cut_actor->SetMapper(cut_mapper);
pWnd->getRenderer()->AddActor(cut_actor);// pWnd : Qt MainWindow