[vtkusers] suggestions for defining data

walizada at ucalgary.ca walizada at ucalgary.ca
Thu Nov 7 12:56:54 EST 2002


Hi, 

I'm just begun to use vtk and so please forgive me if my questions seem 
misdirected. 

I have a XDR encoded file which has the following type of geometry:

The model comprises points which are placed in cables. and cables are
organized into layers. Within a layer, each cable has the same number of
points and cables are assumed to be parallel.
A surface is created for each layer
by forming quadrilaterals between the cables:

                    n       n+1
Cable m       --*--------*--
               /          \
Cable m+1    --*----------*--
               n         n+1

In the above example, a quadrilateral is formed from the 4 points shown.
Note that perfect rectangles are not formed. There are three types of
layers denoted by the following numbers:

0 - do nothing extra
1 - longitudinally running cables. Make quadrilaterals between the first
and last cable.
2 - latitudinally running cables. The first and last point in each cable
are connected so make an extra quadrilateral using the first and last
points of adjacent cables.

-666+layer_type     #layer separator - float
-777                #cable separator - float
p0.x                #float
p0.y
p0.z
.
pn.x
pn.y
pn.z
-777                #start next cable
p0.x
p0.y
p0.z
.
-777
.
-666+layer_type    #start next layer
.
-333               #end of file marker - float


-------------

I don't have a problem reading in the file using the XDR library but I'm 
considering what would be the most efficient way for me to represent the 
data. I need to create quadrilaterals from the points 
but I feel the data structure would have a lot of redundancy since all the 
quadrilaterals would share common points. 
Here is my initial steps at trying to get the data in:

1. Read in all the points for each layer as vtkPoints.
2. Based on the layer type and cable structure create quadrilaterals
by storing the vertexs in vtkIdType. 
3. Create a vtkCellArray to hold the quadrilaterals.
4. create a vtkPolyData using the vtkCellArray.

I would like some suggestions if this is the best way forward. What's the 
other choices that I have that may be less work, such as creating new class 
based on other vtk IO classes that handle some of this.

Thanks for any suggestions and for reading this far!

Wahid





More information about the vtkusers mailing list