The Implicitly Connected Quadrilateral Format ============================================= The global topography models (GTM) are presented here in an implicitly connected quadrilateral (ICQ) format. The vertices are labeled as though they were grid points on the faces of a cube 0 --------- I --------- Q 0 . . . . . . . . . | . . . . . . . . . | . . . . . . . . . | . . . . . . . . . J . . . . F. . . . . | . . . . . . . . . | . . . . . . . . . | . . . . . . . . . Q . . . . . . . . . so that each of the six faces (F) contains (Q+1)^2 vertices v(I,J,F) (I=0,Q; J=0,Q) and Q^2 facets f(I,J,F) (I=0,Q-1; J=0,Q-1). The facet f(I,J,F) implicitly has the vertices v(I,J,F), v(I,J+1,F), v(I+1,J+1,F), v(I+1,J,F). If the cube is unfolded, the six faces are arranged as ----------- | | | 1 | | | ----------------------------------------- | | | | | | 5 | 4 | 3 | 2 | | | | | | ----------------------------------------- | | | 6 | | | ----------- At each of the 12 edges of the cube, faces share common vertices so that, for example, the last row of face 1 has the same vertices as the first row of face 2. The common edge vertices are, with I=(0,Q), v(I,Q,6)=v(Q-I,Q,4) v(I,0,6)=v(I,Q,2) v(I,0,5)=v(Q,Q-I,1) v(I,0,4)=v(Q-i,0,1) v(I,0,3)=v(0,I,1) v(I,0,2)=v(I,Q,1) v(q,I,6)=v(I,Q,5) v(q,I,5)=v(0,I,4) v(q,I,4)=v(0,I,3) v(q,I,3)=v(0,I,2) v(0,I,6)=v(Q-I,Q,3) v(0,I,5)=v(Q,I,2) and the eight corners share vertices from three faces: v(0,0,1) = v(0,0,3) = v(Q,0,4) v(0,Q,1) = v(0,0,2) = v(Q,0,3) v(Q,0,1) = v(0,0,4) = v(Q,0,5) v(Q,Q,1) = v(0,0,5) = v(Q,0,2) v(0,0,6) = v(0,Q,2) = v(Q,Q,3) v(0,Q,6) = v(0,Q,3) = v(Q,Q,4) v(Q,0,6) = v(0,Q,5) = v(Q,Q,2) v(Q,Q,6) = v(0,Q,4) = v(Q,Q,5) Thus of the 6(Q+1)^2 labeled vertices, only 6Q^2+2 are independent. The file structure is quite simple. The first line contains the value of Q, and is followed by 6(Q+1)^2 lines containing the vertices. A piece of Fortran code for reading the file would look like: READ(10,*) Q DO F=1,6 DO J=0,Q DO I=0,Q READ(10,*) (V(K,I,J,F), K=1,3) ENDDO ENDDO ENDDO Here the vertices are represented by three-vectors. In some cases extra components are added representing albedo, color, surface gravity, or other surface characteristics. The quadrilateral facets in the model are not necessarily flat, since there is no guarantee that the four vertices are coplanar. The facet normals are defined by the cross product of their diagonals. This approximation presents no real difficulty because the spacings of the vertices are very small compared to the size of the body. The standard form (Q=512) has 1.57 million vertices. Although it is not necessary, it is convenient to take Q to be a power of 2. Because of this choice, it is easy to "dumb down" a model by increasing the spacing by factors of 2. Vertices of the form v(2I,2J,F) are retained and the others discarded. Because of the quadrilateral facet structure, the models can also be "densified" through bilinear interpolation. Finally, the models can be recast in the more common triangular plate form. A simple piece of Fortran code that does this is: read(10,*) q write(20,*) 6*(q+1)**2, 12*q**2 ! number of vertices and facets n0=0 do f=1,6 do j = 0,q do i = 0,q read(10,*) (v(k,i,j,f), k=1,3) n0=n0+1 write(20,fmt='(I10,3f15.5)') n0, (v(k,i,j,f), k=1,3) n(i,j,f)=n0 enddo enddo enddo do i=1,q-1 n(i,q,6)=n(q-i,q,4) n(i,0,6)=n(i,q,2) n(i,0,5)=n(q,q-i,1) n(i,0,4)=n(q-i,0,1) n(i,0,3)=n(0,i,1) n(i,0,2)=n(i,q,1) enddo do j=1,q-1 n(q,j,6)=n(j,q,5) n(q,j,5)=n(0,j,4) n(q,j,4)=n(0,j,3) n(q,j,3)=n(0,j,2) n(0,j,6)=n(q-j,q,3) n(0,j,5)=n(q,j,2) enddo n(0,0,3)=n(0,0,1) n(q,0,4)=n(0,0,1) n(0,0,2)=n(0,q,1) n(q,0,3)=n(0,q,1) n(0,0,4)=n(q,0,1) n(q,0,5)=n(q,0,1) n(0,0,5)=n(q,q,1) n(q,0,2)=n(q,q,1) n(0,0,6)=n(0,q,2) n(q,q,3)=n(0,q,2) n(0,q,5)=n(q,q,2) n(q,0,6)=n(q,q,2) n(q,q,4)=n(0,q,3) n(0,q,6)=n(0,q,3) n(q,q,5)=n(0,q,4) n(q,q,6)=n(0,q,4) n0=0 do f=1,6 do i=0,q-1 do j=0,q-1 w1(1)=v(2,i,j,f)*v(3,i+1,j+1,f) . -v(3,i,j,f)*v(2,i+1,j+1,f) w1(2)=v(3,i,j,f)*v(1,i+1,j+1,f) . -v(1,i,j,f)*v(3,i+1,j+1,f) w1(3)=v(1,i,j,f)*v(2,i+1,j+1,f) . -v(2,i,j,f)*v(1,i+1,j+1,f) w2(1)=v(2,i+1,j,f)*v(3,i,j+1,f) . -v(3,i+1,j,f)*v(2,i,j+1,f) w2(2)=v(3,i+1,j,f)*v(1,i,j+1,f) . -v(1,i+1,j,f)*v(3,i,j+1,f) w2(3)=v(1,i+1,j,f)*v(2,i,j+1,f) . -v(2,i+1,j,f)*v(1,i,j+1,f) z1=w1(1)**2+w1(2)**2+w1(3)**2 z2=w2(1)**2+w2(2)**2+w2(3)**2 if(z1.le.z2) then n0=n0+1 write(20,fmt='(4I10)') n0, n(i,j,f), . n(i+1,j+1,f), n(i+1,j,f) n0=n0+1 write(20,fmt='(4I10)') n0, n(i,j,f), . n(i,j+1,f), n(i+1,j+1,f) else n0=n0+1 write(20,fmt='(4I10)') n0, n(i,j,f), . n(i,j+1,f), n(i+1,j,f) n0=n0+1 write(20,fmt='(4I10)') n0, n(i+1,j,f), . n(i,j+1,f), n(i+1,j+1,f) endif enddo enddo enddo Roughly, the quadrilateral faces are bisected along their shorter diagonals to form triangular faces. Redundant vertices are not included in the facet table although they do appear in the vertex list. This has not seemed to cause problems in applications. - Robert Gaskell ----------------------------------------------