Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unstructured_grid = vtk.vtkUnstructuredGrid()
- unstructured_grid.SetPoints(points)
- unstructured_grid.InsertNextCell(vtk.VTK_POLYHEDRON, face_stream)
- # Get cube normals
- cell = unstructured_grid.GetCell(0)
- normals = vtk.vtkPolyDataNormals()
- normals.SetInputData(cell.GetPolyData())
- normals.ComputePointNormalsOff()
- normals.ComputeCellNormalsOn()
- normals.Update()
- print
- for i in xrange(cell.GetNumberOfFaces()):
- print i, "=>", normals.GetOutput().GetCellData().GetNormals().GetTuple(i)
- # 0 => (-1.0, 0.0, 0.0)
- # 1 => (1.0, 0.0, 0.0)
- # 2 => (0.0, -1.0, 0.0)
- # 3 => (0.0, 1.0, 0.0)
- # 4 => (0.0, 0.0, -1.0)
- # 5 => (0.5773502588272095, -0.5773502588272095, 0.5773502588272095) -> Odd Result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement