Advertisement
Guest User

Odd normals pt1

a guest
Mar 5th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. unstructured_grid = vtk.vtkUnstructuredGrid()
  2. unstructured_grid.SetPoints(points)
  3. unstructured_grid.InsertNextCell(vtk.VTK_POLYHEDRON, face_stream)
  4.  
  5. # Get cube normals
  6. cell = unstructured_grid.GetCell(0)
  7. normals = vtk.vtkPolyDataNormals()
  8. normals.SetInputData(cell.GetPolyData())
  9. normals.ComputePointNormalsOff()
  10. normals.ComputeCellNormalsOn()
  11. normals.Update()
  12. print
  13. for i in xrange(cell.GetNumberOfFaces()):
  14.     print i, "=>", normals.GetOutput().GetCellData().GetNormals().GetTuple(i)
  15. # 0 => (-1.0, 0.0, 0.0)
  16. # 1 => (1.0, 0.0, 0.0)
  17. # 2 => (0.0, -1.0, 0.0)
  18. # 3 => (0.0, 1.0, 0.0)
  19. # 4 => (0.0, 0.0, -1.0)
  20. # 5 => (0.5773502588272095, -0.5773502588272095, 0.5773502588272095) -> Odd Result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement