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