[vtkusers] texture mapping animation

T.R.Shashwath trshash84 at gmail.com
Mon May 5 00:04:44 EDT 2008


On Sunday 04 May 2008 21:30:39 Darren Weber wrote:
> On Sat, May 3, 2008 at 9:16 PM, T.R.Shashwath <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)

You'll need to set both.

--
shash




More information about the vtkusers mailing list