[vtkusers] Re: Strange VTK Behavior...

Jeff Lee jeff at cdnorthamerica.com
Tue Apr 4 16:00:45 EDT 2006


Andrea Gavana wrote:

> Hello NG,
>  
>     OK, after a day of trying different things, I have a VTK data file 
> in which only the first 2 vertical "layers" of my unstructured grid 
> are shown. The new grid is composed by 5014 hexahedron cells (having 
> thus 40112 points), with a single property as scalar. By using the 
> script attached to the mail, I have checked that there are *NO* 
> coincident cells. The file in which the coincident cells should be 
> stored comes out empty.
> So, now, this is what I have by trying my script, Mayavi and Paraview:
>  
> 1) My script:  http://xoomer.virgilio.it/infinity77/myscript.JPG
> 2) Mayavi: http://xoomer.virgilio.it/infinity77/mayavi.jpg
> 3) Paraview: http://xoomer.virgilio.it/infinity77/paraview.jpg
>  
> All of them shows this problematic behavior... the cells seems 
> corrupted with severe artifacts, even if I have checked that there are 
> no coincident cells (at this point I hope that my checking script is 
> wrong...). The VTK data file, for those interested in, is here:
>  
> http://xoomer.virgilio.it/infinity77/KPO5.zip
>  
> Is about 250 Kb, much smaller than the other :-)
>
> I really hope that I am doing something wrong somewhere... otherwise 
> it starts to look like a bug, but I am clearly too inexperienced to 
> talk about bugs.

What are the bounds of your mesh?  If you translate the mesh to the
origin, do the artifacts disappear?  It looks like depth buffer
artifacts caused by coordinates being far (millions of meters) from the
origin.
-Jeff

>  
> Thank you very mucg for your help and suggestions.
>  
> Andrea.
>
>  
> On 4/4/06, *Andrea Gavana* <andrea.gavana at gmail.com 
> <mailto:andrea.gavana at gmail.com>> wrote:
>
>
>     Hello Goodwin & NG,
>      
>         thank you very much for your help. Unfortunately, it seems
>     that the use of these 2 methods does not make any difference :-( .
>     Anyway, you are right, there are quite a lot of duplicated
>     cells... the problem is that the grid comes in a binary format
>     from another gridding software (which I can not control). Mhm...
>     is there a way in VTK to "hide" or filter out the cells that are
>     duplicated (share the same points)? I think this is the last
>     alternative I have...
>      
>     Thank you very much for your help and suggestions.
>      
>     Andrea.
>      
>     On 4/4/06, *Goodwin Lawlor* <goodwin.lawlor at ucd.ie
>     <mailto:goodwin.lawlor at ucd.ie>> wrote:
>
>         Andrea Gavana wrote:
>>
>> Hello John & NG,
>>
>>     I made a relatively small example (with a VTK data file)
>         that shows
>> the problem. Basically, once loaded the VTK file, just zoom
>         since the
>> grid occupies all the available screen space of the VTK
>         window (more or
>> less). Then, if you rotate the scene you will see that the
>         grid is
>> corrupted in some zones (you will see some artifacts). This
>         may be
>> reproduced using:
>>
>> 1) The script I am attaching (sorry it's Python);
>> 2) Mayavi
>> 3) Paraview
>>
>> At this point I don't know what to do or to think... does
>         anyone have a
>> suggestion? Could please someone try and see if he/she gets
>         the same
>> results? The VTK Data file is here:
>>
>> http://xoomer.virgilio.it/infinity77/KPO3.zip
>         <http://xoomer.virgilio.it/infinity77/KPO3.zip>
>>
>> It's 600 Kb zipped and about 5 MB unzipped... sorry for that,
>         but it is
>> the only grid I have to show that problem...
>>
>> Thank you very much for every suggestion/hint.
>>
>> Andrea.
>         <SNIP>
>
>         Hi Andrea,
>
>         Looks like coincident cells... try:
>
>         surfaceMapper.SetResolveCoincidentTopologyToPolygonOffset()
>
>         or
>
>         surfaceMapper.SetResolveCoincidentTopologyToShiftZBuffer ()
>
>         hth
>
>         Goodwin
>
>
>         _______________________________________________
>         This is the private VTK discussion list.
>         Please keep messages on-topic. Check the FAQ at:
>         http://www.vtk.org/Wiki/VTK_FAQ <http://www.vtk.org/Wiki/VTK_FAQ>
>         Follow this link to subscribe/unsubscribe:
>         http://www.vtk.org/mailman/listinfo/vtkusers
>         <http://www.vtk.org/mailman/listinfo/vtkusers>
>
>
>
>
>     -- 
>     "Imagination Is The Only Weapon In The War Against Reality."
>
>     http://xoomer.virgilio.it/infinity77/
>     <http://xoomer.virgilio.it/infinity77/>
>
>
>
>
> -- 
> "Imagination Is The Only Weapon In The War Against Reality."
>
> http://xoomer.virgilio.it/infinity77/ 
> <http://xoomer.virgilio.it/infinity77/>
>
>------------------------------------------------------------------------
>
>
>fid = open("KPO5.vtk", "rt")
>
>cellpoints = []
>linecount = 0
>singlecell = []
>
>while 1:
>
>    tline = fid.readline()
>
>    if not tline:
>        break
>
>    if tline.find("POINTS ") >= 0:
>
>        while 1:
>
>            tline = fid.readline().strip("\n")
>
>            if len(tline.strip()) == 0 or tline.find("CELLS") >= 0:
>                break
>
>            singlecell.extend(tline.split(" "))
>            linecount = linecount + 1
>            
>            if linecount%8 == 0:
>                cellpoints.append(singlecell)
>                singlecell = []
>                
>        break
>
>fid.close()
>
>fid = open("ResultsVTK.txt", "wt")
>
>count = 0
>
>for cells in cellpoints:
>    if cellpoints[count+1:].count(cells) > 0:
>        indx = cellpoints[count+1:].index(cells)
>        fid.write(str(count) + " " + str(indx+count+1) + "\n")
>
>    count = count + 1
>    print "Cell Number: ", count
>
>fid.close()
>
>
>
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>  
>




More information about the vtkusers mailing list