Thanks to Jon Leech (UNC-CH) for the vertice-generating skeleton that was incorporated into this module. The AVS port and widgets were done by Marc R. Curry (NCSC). The module was ported to run on DEC AVS V4.0, although *should* be fairly portable to other platforms with proper changes made to the Makefile. Geometry Sphere Module ---------------------- This geometry sphere module demonstrates how to convert a set of vertices into a geomtry format for viewing within AVS. Also, some simple widgets are provided to take care of (what were) program parameters (see below for a more detailed explanation). The sphere is actually a triangle mesh approximating a sphere by recursive subdivision into more and more triangles. The first approximation is an octahedron, with each level of refinement increasing the number of triangles by a factor of 4. The subdivisions are done as follows: Subdivide each triangle in the old approximation and normalize the new points thus generated to lie on the surface of the unit sphere. Each input triangle with vertices labelled [0,1,2] as shown below will be turned into four new triangles: Make new points a = (0+2)/2 b = (0+1)/2 c = (1+2)/2 1 /\ Normalize a, b, c / \ b/____\ c Construct new triangles /\ /\ [0,b,a] / \ / \ [b,1,c] /____\/____\ [a,b,c] 0 a 2 [a,c,2] There is also a routine in the code for creating a PPHIGS ASCII archive output, but it is not enabled for this module. Hackers are welcome to play with it on their own. THE WIDGETS: ------------ There is a "Level" integer dial (range 1-6) that determines the level of subdivisions. Levels 1-4 are almost immediate in terms of updating on a DEC 5000/125, whereas level 5 takes a bit longer and level 6 takes a good piece of time. The choice buttons "facet" and "smooth" determine the connectivity of the lines and how they will affect the resultant surface appearance of the sphere. Choosing "facet" will pass the GEOM_NOT_SHARED parameter to GEOMadd_disjoint_polygon, resulting in no checking for shared vertices. This is a fast process but yields faceted objects. Using "smooth" makes it compare each vertex in the object. If a shared vertex is found, a reference is used rather than duplicating the vertex. It's slow, but it makes a smooth object. The color dials pass floating point values to an array in the form of Red, Green, and Blue values.