How to draw "Spider" shapes in vtkUnstructuredgrid

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to draw "Spider" shapes in vtkUnstructuredgrid

scotsman60
This post was updated on .
Hello!!!I'm trying to drawn what I call a "Spider" type shape in a vtkUnstructuredGrid.

"What's a Spider type shape" you might ask?

It's a shape that has one reference point, attached via edges to multiple other points.

Imagine a + sign  - the reference point is a the center and the four other points are each of the tips.I can draw this type of shape using a vtkPolyLine as follows

origin = [0.0, 0.0, 0.0]
p0 = [1.0, 0.0, 0.0]
p1 =[-1.0, 0.0, 0.0]
p2 = [0.0, 1.0, 0.0]
p3 = [0.0, -1.0, 0.0]

points=vtk.vtkPoints()
points.InsertNextPoint(origin)
points.InsertNextPoint(p0)
points.InsertNextPoint(p1)
points.InsertNextPoint(p2)
points.InsertNextPoint(p3)

mesh= vtk.vtkUnstructuredGrid()mesh.SetPoints(points)

polyLine =vtk.vtkPolyLine()

polyLine.GetPointIds().SetNumberOfIds(8)

polyLine.GetPointIds().SetId(0,0)
polyLine.GetPointIds().SetId(1, 1)
polyLine.GetPointIds().SetId(2,0)
polyLine.GetPointIds().SetId(3, 2)
polyLine.GetPointIds().SetId(4,0)
polyLine.GetPointIds().SetId(5, 3)
polyLine.GetPointIds().SetId(6,0)
polyLine.GetPointIds().SetId(7, 4)

But I have to draw 100,000+ of these shapes and this approach seems wasteful - 7 edges in the polyline when only four are required.

Any ideas for a more efficient approach will be gratefully received.

Thanks,

Doug



--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
https://vtk.org/mailman/listinfo/vtkusers