[vtkusers] Visualize cell normal vector of polydata
woshizyc at gmail.com
woshizyc at gmail.com
Tue Nov 28 08:20:13 EST 2017
Hi, experts,
I want to visualize the normal vectors of a polydata to be centered in the center of each triangle.
I tried to do this for a sphere generated from vtkSphereSource.
I used the following python codes to calculate the normal vectors of the sphere:
sphere = vtk.vtkSphereSource()
sphere.SetCenter(0, 0, 0)
sphere.SetRadius(5.0)
arrow = vtk.vtkArrowSource()
arrow.Update()
normals = vtk.vtkPolyDataNormals()
normals.SetInputConnection(sphere.GetOutputPort())
normals.ComputePointNormalsOff()
normals.ComputeCellNormalsOn()
normals.SplittingOff()
normals.FlipNormalsOff()
normals.ConsistencyOn()
normals.AutoOrientNormalsOn()
normals.Update()
However, it seemed that I did not get the correct normal vectors of each triangle, as you can see in the attached figure.
In addition, I also do not know how to move the vectors to the center of each triangle.
Could any experts give me some clue for solving this problem.
Are there any example for doing this?
Thanks in advance.
Best,
Yuanchao
woshizyc at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171128/3f81c809/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Normal.png
Type: application/octet-stream
Size: 40371 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171128/3f81c809/attachment.obj>
More information about the vtkusers
mailing list