A question about vtkStructuredGrid

I try to use vtkStructuredGrid to draw the grid in the polar coordinate system。But the hexahedral cell in vtkCellType is not fan-shaped。
image
I found this when I was looking for information(like c), but it didn’t explain how to achieve it, so I want to ask.

I want to achieve this effect https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/LOxGrid/

What do you mean fan-shaped ? The cell will juste be linking the point you positioned yourself.

I think that what @KeyboardMan would like to achieve would be to have curved hexahedra in his polar grid so that the grid is angularly smooth. Unfortunately, as of today, cells inside a vtkStructuredGrid are linear.

EDIT: The illustration for vtkStructuredGrid is kind of deceptive… Sorry it lead to a confusion.

1 Like

You could get this kind of smooth result if you used non linear cells in a vtkUnstructuredGrid. You might have to create a custom class so you can automatize indexing (your class could inherit from vtkUnstructuredGrid and add relevant methods). Look at vtkHigherOrderHexahedron and related cells. There are a handful to choose from.

1 Like

Like @Yohann_Bearzi, I’d also go for vtkUnstructuredGrid. That’s the class I use to model grids with cells of arbitrary shapes like those we need for geology applications:

If you want an specific “fan shaped” grid, you might be interested in looking at this example: https://kitware.github.io/vtk-examples/site/Cxx/StructuredGrid/SGrid/

I think this is not what I need, what I need is grid drawing in polar coordinate system

Processing: Screenshot_2021-12-04-10-04-04-779_com.miui.notes.jpg…
like this

That’s the case, so I can only make as many grids as possible in the theta direction to get an approximate effect?

You can really try this, and try again on weekdays. thank you very much

My point is that you need to express each cell geometry explicitly with vtkUnstructuredGrid. VTK doesn’t have a “vtkPolarGrid”. Either this or elaborate over the example I posted further above that uses vtkStructuredGrid.

We use a grid transform and a transform filter to warp VTK objects stored in polar coordinates to Cartesian coordinate system. It works on polydata, unstructured grid, etc. directly. For images, we use the same transform with a vtkImageResample filter.