Re: Gridded3DSet.make_normals() & poly_triangle_stripe()

Hi Bob,

Glad to see you're digging deeply into this, and sorry it
isn't better documented.

Pnx, Pny, Pnx, NxA, NxB, NyA, NxB, NzA and NzB are all
work arrays for computing normals at vertices as weighted
means of the normals to polygons adjacent to the vertices.
The interesting thing here is that polygon normals are
weighted inversely to the area of the polygon (because
vertices of a small polygon are likely to be near each
other and thus should have similar normals).

Vert_f_Pol is an array that specifies the set of indices
of vertices adjacent to each polygon.  Pol_f_Vert is an
array that specifies the set of indices of polygons
adjacent to each vertex.  Together they can be used to
traverse the geometry of the iso-surface.

poly_triangle_stripe() ties all the polygons of an iso-
surface (they may not all be triangles) into one long poly-
triangle strip.  This strip jumps between dis-connected
components by repeating the last vertex of one connected
component strip and repeating the first vertex of the next
connected component strip (this creates two triangles with
zero area that are not rendered).

The code in poly_triangle_stripe() is not day at the beach.
But it has been thoroughly tested by thousands of Vis5D and
VisAD users over a period of years, it is quite fast, and
tying polygons together into strips greatly increases
rendering speed.  Note that the code that calls it in the
Gridded3DSet.makeIsoSurface() method shows how to put its
output into VisADGeometries.  But please let me know if you
have any specific questions.

The size of the poly-triangle strip is just the number of
vertices in the strip.

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


On Sat, 26 Feb 2000, Robert S Laramee wrote:

> Hello to Bill Hibbard and the mailing list.
> 
> Can someone help me out and tell me what these parameters are for
> the make_normals() method in the Gridded3DSet class?
> 
> Here's the signature:
>     /**
>      * @param VX, VY, VZ -the x,y,z coordinates of the vertices
>      * @param NX, NY, NZ -the x,y,z components of each normal vector
>      * @param nvertex -the number of vertices
>      * @param npolygons -the number of polygons
>      * @param Pnx, Pny, Pnx - ?
>      * @param NxA, NxB, NyA - ?
>      * @param NxB, NzA, NzB - ?
>      * @param Pol_f_Vert - ?
>      * @param Vert_f_Pol - ?
>      */
>     public static void make_normals(float[] VX, float[] VY, float[] VZ,
>                                   float[] NX, float[] NY, float[] NZ, 
>                                   int nvertex, int npolygons, 
>                                   float[] Pnx, float[] Pny, float[] Pnz,
>                                   float[] NxA, float[] NxB, float[] NyA, 
>                                   float[] NyB, float[] NzA, float[] NzB,
>                                   int[] Pol_f_Vert, int[] Vert_f_Pol)
> 
> i've filled in what some of them are.  The ones with '?' i still don't
> know.  The Pnx..NzB look like temporary arrays to hold intermediate
> results of some sort.  What are the int[] Pol_f_Vert and the int[]
> Vert_f_Pol? Are they mappings of some sort from polygons to vertices?
> 
> Also what does poly_triangle_stripe() do?  It looks like it calculates the
> size of a triangle strip array.  However, conceptually speaking, what is
> the size of a triangle strip array?  Does it include an array that holds
> the x,y,z values of each vertex and each vertex normal?
> 
> -cheers, bob
> 
> Robert S Laramee      tel:    (603) 868-1361 (new as of 19 Jan '00)
> 9 Woodman Ave, #316   office: (603) 862-0350
> Durham, NH 03828      URL:   http://www.cs.unh.edu/~rlaramee
> 
>