<br><br><div class="gmail_quote">On Sat, May 3, 2008 at 9:16 PM, T.R.Shashwath <<a href="mailto:trshash84@gmail.com">trshash84@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Saturday 03 May 2008 20:58:51 Darren Weber wrote:<br>
> I have a closed surface where the faces contain triangles of the points,<br>
> eg:<br>
><br>
> vtkSurf = vtk.vtkPolyData()<br>
> vtkSurf.SetPoints(points)<br>
> vtkSurf.SetPolys(faces)<br>
><br>
> I also have a time-series of scalar values for every point. How do I<br>
> display one time-point with a reasonable colormap? How do I create a loop<br>
> that changes the point values that map into the colormap?<br>
><br>
> Thanks in advance, Darren<br>
<br>
</div></div>Hi,<br>
<br>
You'll have to create a vtkPointData instance to add to your surface. You can<br>
assign the scalar values of each point to that point data, and turn on scalar<br>
color mode in the poly data mapper. That will display one time-point. If you<br>
want to do an animation of the time-series, just replace all the point values<br>
again.<br>
<br>
-- Shash<br>
</blockquote><div><br><br>From the longer snip of my code below, you can see that I used vtk.vtkPoints() to create the point data, which was then added to the vtk.vtkPolyData() object. Should I replace the use of vtk.vtkPoints() with vtk.vtkPointData()? Perhaps these objects are complementary, so I should use both?<br>
<br>### BEGIN SNIP<br><span style="font-family: courier new,monospace;"> # put data into vtk data structure</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> points = vtk.vtkPoints()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> points.SetNumberOfPoints(nVert)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for i in range(nVert):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> v = self.vert['xyz'][i]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> points.SetPoint(i, v[0], v[1], v[2])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> faces = vtk.vtkCellArray()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> faces.Allocate(nFace, 1)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> for i in range(nFace):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> fv = self.face['vertex'][i]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> faces.InsertNextCell(3)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> # double check the order of vertices for vtk outward normals</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> faces.InsertCellPoint(fv[0])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> faces.InsertCellPoint(fv[1])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> faces.InsertCellPoint(fv[2])</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkSurf = vtk.vtkPolyData()</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> vtkSurf.SetPoints(points)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> vtkSurf.SetPolys(faces)</span><br style="font-family: courier new,monospace;">
### END SNIP<br>
<span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;"><br>Thanks in advance, Darren (Noob)<br><br></div></div>