# Glyph3D normal to polygon

**URL:** https://discourse.vtk.org/t/glyph3d-normal-to-polygon/3709
**Category:** Development
**Created:** [July 6, 2020, 9:31am UTC](https://discourse.vtk.org/t/glyph3d-normal-to-polygon/3709 "2020-07-06T09:31:11Z")
**Posts on this page:** 2
**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 6, 2020, 9:31am UTC](https://discourse.vtk.org/t/glyph3d-normal-to-polygon/3709/1 "2020-07-06T09:31:11Z")

</div>

I’m trying to make a glyph3D normal to a polygon. Maybe I’m misinterpreting the use of normals or my approach is wrong, but I can’t make the glyphs normal to the polygon. This is what I’m getting at the moment.

\*\* EDIT\*\* : I solved the orientation part (The updated code is below). I still looking for a way to show only on normal in the polygon center.

 ![python_TmvepYu8ek](https://discourse.vtk.org/uploads/default/original/2X/3/3af10e22ad20c9736fb697d3d4831eaa8d0cc7cb.png)

This is my function to generate the glyphs.

```
def create_glyph(actor):

    poly_data = actor.GetMapper().GetInput()
    normals = vtk.vtkPolyDataNormals()

    normals.SetInputData(poly_data)
    normals.ComputePointNormalsOff()
    normals.ComputeCellNormalsOn()
    normals.SplittingOff()
    normals.FlipNormalsOn()
    normals.ConsistencyOn()
    normals.AutoOrientNormalsOn()
    normals.Update()

    arrowSource = vtk.vtkArrowSource()

    glyph3D = vtk.vtkGlyph3D()
    glyph3D.SetSourceConnection(arrowSource.GetOutputPort())
    glyph3D.SetVectorModeToUseNormal()
    glyph3D.SetInputData(normals.GetOutput())
    glyph3D.SetScaleFactor(20)
    glyph3D.OrientOn()
    glyph3D.Update()

    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(glyph3D.GetOutputPort())

    actor = vtk.vtkActor()
    actor.SetMapper(mapper)
    actor.GetProperty().SetColor(colores.GetColor3d('Yellow'))

    return actor

```

I also wanted to ask if it is possible to just make a glyph in the middle of the polygon.

---

<div class="post-metadata">

### Author: ![dcthomp](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dcthomp/32/60_2.png) [@dcthomp](https://discourse.vtk.org/u/dcthomp)
#### Post date: [August 6, 2020, 1:15pm UTC](https://discourse.vtk.org/t/glyph3d-normal-to-polygon/3709/2 "2020-08-06T13:15:44Z")

</div>

For normals at cell centers, you can try running the `vtkCellCenters` algorithm on your dataset. If you compute cell normals before running `vtkCellCenters`, the vertices placed at centers should have point normals.
