[vtkusers] texture mapping animation

Amy Squillacote ahs at cfdrc.com
Mon May 5 09:25:32 EDT 2008



Darren Weber wrote:
>
>
> On Sat, May 3, 2008 at 9:16 PM, T.R.Shashwath <trshash84 at gmail.com 
> <mailto:trshash84 at gmail.com>> wrote:
>
>     On Saturday 03 May 2008 20:58:51 Darren Weber wrote:
>     > I have a closed surface where the faces contain triangles of the
>     points,
>     > eg:
>     >
>     > vtkSurf = vtk.vtkPolyData()
>     > vtkSurf.SetPoints(points)
>     > vtkSurf.SetPolys(faces)
>     >
>     > I also have a time-series of scalar values for every point.  How
>     do I
>     > display one time-point with a reasonable colormap?  How do I
>     create a loop
>     > that changes the point values that map into the colormap?
>     >
>     > Thanks in advance, Darren
>
>     Hi,
>
>     You'll have to create a vtkPointData instance to add to your
>     surface. You can
>     assign the scalar values of each point to that point data, and
>     turn on scalar
>     color mode in the poly data mapper. That will display one
>     time-point. If you
>     want to do an animation of the time-series, just replace all the
>     point values
>     again.
>
>     -- Shash
>
>
>
> 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?
>
> ### BEGIN SNIP
>            # put data into vtk data structure
>             points = vtk.vtkPoints()
>             points.SetNumberOfPoints(nVert)
>             for i in range(nVert):
>                 v = self.vert['xyz'][i]
>                 points.SetPoint(i, v[0], v[1], v[2])
>            
>             faces = vtk.vtkCellArray()
>             faces.Allocate(nFace, 1)
>             for i in range(nFace):
>                 fv = self.face['vertex'][i]
>                 faces.InsertNextCell(3)
>                 # double check the order of vertices for vtk outward 
> normals
>                 faces.InsertCellPoint(fv[0])
>                 faces.InsertCellPoint(fv[1])
>                 faces.InsertCellPoint(fv[2])
>            
>             vtkSurf = vtk.vtkPolyData()
>             vtkSurf.SetPoints(points)
>             vtkSurf.SetPolys(faces)
> ### END SNIP
>
>
> Thanks in advance, Darren (Noob)

Hi Darren,

vtkPoints contains the coordinates of the points in your dataset. 
vtkPointData holds arrays that have a data value (scalar, vector, 
normal, etc.) for every point.

- Amy

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list