[vtkusers] Hexahedrons in unstructured grids with bad aspect ratios

Bryn Lloyd blloyd at vision.ee.ethz.ch
Tue Jul 15 02:25:03 EDT 2008


I tried your example - I can see the cell in paraview. Don't know why 
you can't.

Here is the python script I used to create the cell:

newPoints = vtkPoints()
newPoints.InsertNextPoint(2.9892,      0.0,          0.0)
newPoints.InsertNextPoint(2.9299,      0.0,           0.05)
newPoints.InsertNextPoint(2.3707,      0.981,       0.05)
newPoints.InsertNextPoint(2.372,        0.9828,     0.0)
newPoints.InsertNextPoint(3.2342,      0.0,           0.0)
newPoints.InsertNextPoint(3.174,        0.0,           0.05)
newPoints.InsertNextPoint(2.59248,    1.0738,      0.05)
newPoints.InsertNextPoint(2.584,        1.070,       0.0)

newCells = vtkCellArray()
pids = vtkIdList()
pids.InsertNextId(0)
pids.InsertNextId(1)
pids.InsertNextId(2)
pids.InsertNextId(3)
pids.InsertNextId(4)
pids.InsertNextId(5)
pids.InsertNextId(6)
pids.InsertNextId(7)
newCells.InsertNextCell( pids )

usGrid = vtkUnstructuredGrid()
usGrid.SetPoints(newPoints)
usGrid.SetCells(12, newCells) # VTK_HEXAHEDRON=12

writer = vtkUnstructuredGridWriter()
writer.SetInput(usGrid)
writer.SetFileName("hex.vtk")
writer.Update()

quality = vtkMeshQuality();
cell = usGrid.GetCell(0)
print "HexShape \t\t", quality.HexShape(cell)
print "HexJacobian \t\t", quality.HexJacobian(cell)
print "HexMaxEdgeRatio \t\t", quality.HexMaxEdgeRatio(cell)


Cheers, Bryn






Sarah Macumber wrote:
> Does VTK have any known problem drawing Hexahedrons with bad aspect ratios?  I can get VTK to draw the points but not the cells.  I have been going over my data for a while & can't find any problems with the data or the cells.  I included an example cell below.
>  
> Any help is appreciated,
> Sarah
>  
> ID          X              Y              Z
> 0           2.9892      0.0          0.0
> 16         2.9299      0.0           0.05
> 17         2.3707      0.981       0.05
> 1           2.372        0.9828     0.0
> 16000    3.2342      0.0           0.0
> 16016    3.174        0.0           0.05
> 16017    2.59248    1.0738      0.05
> 16001    2.584        1.070       0.0
>  
> With a hexahedron cell ID list of :
> 0 16 17 1 16000 16016 16017 16001
> _______________________________________________
> 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
> 


-- 
-------------------------------------------------
Bryn Lloyd
Computer Vision Laboratory
ETH Zürich, Sternwartstrasse 7
CH - 8092 Zürich, Switzerland
Tel: +41 44 63 27690
Fax: +41 44 63 21199
-------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hex.png
Type: image/png
Size: 4568 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080715/39ade702/attachment.png>


More information about the vtkusers mailing list