# Re: Gridded3DSet.isosurf() and int[][] Pol_f_Vert

```Hi Bob,

> i have a question about the int[] Pol_f_Vert array in the
> Gridded3DSet.isosurf() method (actually, the 2nd-to-last parameter in the
> isosurf() method, i'm referring to it as Pol_f_Vert).  As Bill said
> before, Pol_f_Vert, "is an array that specifies the set of indices of
> polygons adjacent to each vertex".

First, note that Pol_f_Vert is actually passed to isosurf as:

int[][] arg_Pol_f_Vert = new int[][] {Pol_f_Vert};

so that isosurf can modify the length of Pol_f_Vert in case
the actual number of total polygon vertics exceeds the
initial estimate.

> My question is (a detail oriented one) how is this array populated? If i
> am correct the array is a mapping from vertices to polygons.  So the array
> stores vertex indices that indicate which polygon(s) the vertices belong
> to.  Is this correct?
>
> But i do not understand how this array is populated.  It looks as if the
> method starts off by allocating 9 index entries per polygon, meaning that
> a vertex could belong to up to 8 polygons and (i'm guessing) the 9th entry
> is a number indicating how many polygons the vertex belongs to.  Is this
> correct?

You mean '9 index entries per vertex'.  The Pol_f_Vert array
contains lists of polygons adjacent to each vertex, and the
Vert_f_Pol array contains lists of vertices forming each
polygon.

In 'int[] Pol_f_Vert' the information for the i-th vertex is
in Pol_f_Vert[9*i], Pol_f_Vert[9*i+1], ..., Pol_f_Vert[9*i+8].
The number of polygons adjacent to vertex i is Pol_f_Vert[9*i+8],
and the indices of those polygons are in Pol_f_Vert[9*i], ...,
Pol_f_Vert[9*i + Pol_f_Vert[9*i+8] - 1].

Conversely, in 'int[] Vert_f_Pol' the information about the j-th
polygon is in Vert_f_Pol[7*j], Vert_f_Pol[7*j+1], ...,
Vert_f_Pol[7*j+6].  The number of vertices forming polygon j is
Vert_f_Pol[7*j+6], and the  indices of those vertices are in
Vert_f_Pol[7*j], ..., Vert_f_Pol[7*j + Vert_f_Pol[7*j+6] - 1].

The (x, y, z) location of vertex i is in VX[i], VY[i],
VZ[i].  Again, the first array index is to allow isosurf
to increase the sizes of these arrays if necessary.

> Also, it is not clear how each vertex number is assigned to 1 of the 8
> possible reserved slots for each polygon.  For example, let's say we
> discover that vertex 1 belongs to polygons 1, 2, and 3.  How does the
> method decide which of the possible 8 reserved slots to put a 1 into (for
> polygons 1, 2 & 3, assuming that is how it works)?  Although from looking
> at printouts of the array, it looks as if it's doing more computations
> than i am querying about here.  There are in some cases quite a few more
> slots of 9 entries than there are polygons, implying that the array is not
> set up for 9 indices/polygon.

The vertices in Vert_f_Pol[7*j], ..., Vert_f_Pol[7*j + Vert_f_Pol[7*j+6] - 1]
are ordered according to their natural order around the polygon.

The allocation of these arrays cannot be done precisely because
there is no prior count of the number of vertices.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html

```
• 2000 messages navigation, sorted by:
• Search the `visad` archives: