# Get the normal vector of a polygon using vtkPolyDataNormals

**URL:** https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751
**Category:** Support
**Created:** [July 11, 2020, 9:04pm UTC](https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751 "2020-07-11T21:04:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![efdiloreto](https://discourse.vtk.org/user_avatar/discourse.vtk.org/efdiloreto/32/2059_2.png) [@efdiloreto](https://discourse.vtk.org/u/efdiloreto)
#### Post date: [July 11, 2020, 9:04pm UTC](https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751/1 "2020-07-11T21:04:04Z")

</div>

I have a simple polygon where all points belong to the same plane, therefore the normal vectors at each point should be the same. The problem I have is that I can’t get those vectors.

For example, I have the following code.

```
normals = vtk.vtkPolyDataNormals()

normals.SetInputData(poly_data) # existing polydata
normals.ComputePointNormalsOn()
normals.ComputeCellNormalsOn()
normals.SplittingOff()
normals.ConsistencyOn()
normals.AutoOrientNormalsOn()
normals.Update()

```

From here I do not know how to obtain these vectors. I have tried different ways but apparently I am doing something wrong.

---

<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: [July 11, 2020, 10:23pm UTC](https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751/2 "2020-07-11T22:23:31Z")

</div>

Point normal is computed by averaging neighbor polygon cell normals, so it is expected to be different from the polygon cell normal. See details in [Chapter 9 of VTK textbook](https://lorensen.github.io/VTKExamples/site/VTKBook/09Chapter9/).

---

<div class="post-metadata">

### Author: ![efdiloreto](https://discourse.vtk.org/user_avatar/discourse.vtk.org/efdiloreto/32/2059_2.png) [@efdiloreto](https://discourse.vtk.org/u/efdiloreto)
#### Post date: [July 11, 2020, 10:27pm UTC](https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751/3 "2020-07-11T22:27:05Z")

</div>

Thanks Andras. My polygon only has one cell, does this also apply in this case?

---

<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: [July 11, 2020, 11:32pm UTC](https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751/4 "2020-07-11T23:32:57Z")

</div>

Can you provide a full example (including setting of `poly_data` and retrieving of normal vectors)?  
What result do you expect and what do you get?

---

<div class="post-metadata">

### Author: ![efdiloreto](https://discourse.vtk.org/user_avatar/discourse.vtk.org/efdiloreto/32/2059_2.png) [@efdiloreto](https://discourse.vtk.org/u/efdiloreto)
#### Post date: [July 11, 2020, 11:48pm UTC](https://discourse.vtk.org/t/get-the-normal-vector-of-a-polygon-using-vtkpolydatanormals/3751/5 "2020-07-11T23:48:31Z")

</div>

Yes of course.
