azah@quads.uchicago.edu (ahmed zahid) (06/13/91)
I am generating the coordinates of spherical surface by the following tansformation : x = cos(theta)*sin(phi), y = sin(theta)*sin(phi), and z = cos(phi), where 0 <= theta <= 360 degrees, and -180 <= phi <= 180 degrees. Now I am using the IBM R6000 graPHIGS utility GPPGD3 to form the structure primitive; this function requires that the set of vertices in the given polygon/sub-area be "coplanar". Consequently I am faced with the problem of identifying and reorganizing the above set of coordinates in terms of coplanar sets of vertices. Is there any particular approach that I could adopt which would be computationally efficent ? Any ideas, comments, hints would be appreciated. _______________________________________________________________________ Zahid Ahmed. Scientific Visualization Lab, Center for Clouds, Climate, and Chemistry University of Chicago. (312)-702-1808. ahmed@cassatt.uchicago.edu
levine@well.sf.ca.us (Ron Levine) (06/14/91)
In article <1991Jun12.232026.10855@midway.uchicago.edu>, azah@quads.uchicago.edu (ahmed zahid) writes: > > I am generating the coordinates of spherical surface by the following > tansformation : > > x = cos(theta)*sin(phi), > y = sin(theta)*sin(phi), and > z = cos(phi), > > where 0 <= theta <= 360 degrees, and -180 <= phi <= 180 degrees. > > Now I am using the IBM R6000 graPHIGS utility GPPGD3 to form the > structure primitive; this function requires that the set of vertices > in the given polygon/sub-area be "coplanar". Consequently I am faced > with the problem of identifying and reorganizing the above set of > coordinates in terms of coplanar sets of vertices. Is there any > particular approach that I could adopt which would be computationally > efficent ? Any ideas, comments, hints would be appreciated. > > _______________________________________________________________________ > > Zahid Ahmed. > > Scientific Visualization Lab, > Center for Clouds, Climate, and Chemistry > University of Chicago. > > (312)-702-1808. > ahmed@cassatt.uchicago.edu I don't have a graPHIGS manual handy so I'm not sure exactly what the primitive GPPGD3 is, but let's assume that it means "polygon grid" or something like that, effectively an indexed polygon mesh, or what is called in the PHIGS PLUS DIS spec "set of fill area sets" (Ugh.) More specifically, I'm assuming you have to pass the function an array of vertices and a list of lists of indices into the vertex array that define the polygons, and each polygon must be coplanar. In your case all the vertices lie on the sphere. If you use triangles, then they are automatically coplanar, because any three points are. But it is a little easier (in terms of the indexing) to determine the (theta, phi) coordinates of vertices of coplanar quadrilaterals. Namely, just take the intersections of meridians (constant theta) and parallels (constant phi). It is easiest to use equally spaced meridians and parallels. That is, first choose integers N and M for the number of tesselation facets you wish to use in each coordinate direction. Then let theta(i) = i*(360/N), i=0,...,N and phi(j) = j*(180/M), j=0,...,M Then, for any i between 0 and N-1, and any j between 0 and M-1, the four vertices i,j i+1,j i+1,j+1 i,j+1 define a quadrilateral which is coplanar in the 3D space. You can prove it with a little elementary solid geometry. Moreover, the set of all these quadrilaterals gives a complete tesselation of the sphere. Notice that the north and south poles are each represented N+1 times. Ron Levine Dorian Research, Inc. (415)-535-1350