Hi,

I want to plot a surface over a 2D grid, and follow the example on using python
to write a vtk file that can be read by mayavi:
>
        stepu = (self.umax - self.umin )/ (res-1)
        stepv = (self.vmax - self.vmin )/ (res-1)
        unew,vnew = mgrid[self.umin:self.umax:nr,self.vmin:self.vmax:nr]
        znew = self.diff(unew[:,0],vnew[0,:])
        # Flatten the 2D array data as per VTK's requirements.
        z1 = reshape(transpose(znew), (-1,))
        # now dump the data to a VTK file.
        import pyvtk
        point_data = pyvtk.PointData(pyvtk.Scalars(z1))
        # We scale the grid to have a better picture
        scale = 1e5
        grid = pyvtk.StructuredPoints((res,res, 1), (self.umin*scale,
self.vmin*scale, 0), (stepu*scale, stepv*scale, stepu*scale))
>

Note that I need to add a scale to the grid. I have a grid over the distance
[0,1e-5], and if I import this in mayavi, nothing is visible. Blowing up the
grid, to [0,1], gives me the surface plot I want.
I noted that labview has the same behaviour, so perhaps this is a problem with
vtk? Is this a bug or standard behaviour. Should the grid not be adapted
automatically so that it is visible on screen? By blowing up the grid with a
scalefactor, I obtain the surface I want to see, but the labels are off course
wrong.
I prefer to use mayavi as I can do scalarwarp there, which is not present in
labview.

Benny

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
MayaVi-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mayavi-users

Reply via email to