# A question about vtkStructuredGrid

**URL:** https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318
**Category:** Support
**Tags:** jobs
**Created:** [December 3, 2021, 3:57am UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318 "2021-12-03T03:57:32Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![KeyboardMan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/keyboardman/32/968_2.png) [@KeyboardMan](https://discourse.vtk.org/u/KeyboardMan)
#### Post date: [December 3, 2021, 3:57am UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/1 "2021-12-03T03:57:33Z")

</div>

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](https://discourse.vtk.org/uploads/default/original/2X/a/ac79cea59a83a6c6b542c05d04c7dccd163c9f9f.png)  
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/](https://kitware.github.io/vtk-examples/site/Cxx/VisualizationAlgorithms/LOxGrid/)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)
#### Post date: [December 3, 2021, 1:11pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/2 "2021-12-03T13:11:32Z")

</div>

> [@KeyboardMan](#):
>
> But the hexahedral cell in vtkCellType is not fan-shaped。

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

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [December 3, 2021, 1:20pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/3 "2021-12-03T13:20:08Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Yohann\_Bearzi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/yohann_bearzi/32/671_2.png) [@Yohann\_Bearzi](https://discourse.vtk.org/u/Yohann_Bearzi)
#### Post date: [December 3, 2021, 1:26pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/4 "2021-12-03T13:26:54Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 3, 2021, 8:46pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/5 "2021-12-03T20:46:37Z")

</div>

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:

 ![image](https://discourse.vtk.org/uploads/default/original/2X/c/ce6b6de655402c8670dc0185b29b73437bb6e541.png)

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 3, 2021, 9:00pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/6 "2021-12-03T21:00:23Z")

</div>

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/](https://kitware.github.io/vtk-examples/site/Cxx/StructuredGrid/SGrid/)

---

<div class="post-metadata">

### Author: ![KeyboardMan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/keyboardman/32/968_2.png) [@KeyboardMan](https://discourse.vtk.org/u/KeyboardMan)
#### Post date: [December 4, 2021, 1:57am UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/7 "2021-12-04T01:57:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![KeyboardMan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/keyboardman/32/968_2.png) [@KeyboardMan](https://discourse.vtk.org/u/KeyboardMan)
#### Post date: [December 4, 2021, 2:05am UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/8 "2021-12-04T02:05:57Z")

</div>

Processing: Screenshot\_2021-12-04-10-04-04-779\_com.miui.notes.jpg…  
like this

---

<div class="post-metadata">

### Author: ![KeyboardMan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/keyboardman/32/968_2.png) [@KeyboardMan](https://discourse.vtk.org/u/KeyboardMan)
#### Post date: [December 4, 2021, 2:17am UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/9 "2021-12-04T02:17:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![KeyboardMan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/keyboardman/32/968_2.png) [@KeyboardMan](https://discourse.vtk.org/u/KeyboardMan)
#### Post date: [December 4, 2021, 2:29am UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/10 "2021-12-04T02:29:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)
#### Post date: [December 4, 2021, 2:33pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/11 "2021-12-04T14:33:16Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [December 6, 2021, 6:00pm UTC](https://discourse.vtk.org/t/a-question-about-vtkstructuredgrid/7318/12 "2021-12-06T18:00:18Z")

</div>

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.
