/* See {VStar.h} */ #include [!!! JUNK??? May have been superseded by Squared.c !!! ??? ] /* This module contain procedures to build several structures such as: n-gons, triangles and squares, and solid polyhedra: cube, ball, bigcube (3D array of cube) with procedures for the gluing two such bigcubes. */ #include #include #include FROM Octf IMPORT Enext_1, Clock, Fnext, Enext, SetFnext, SetEdgeAll, Fnext_1, Spin, SetFaceAll; FROM Triangulation IMPORT Pair, Org, MakeVertex, SetAllOrgs, OrgV, SetAllPneg, MakePolyhedron, Node, Vertex, Glue, Ppos, MakeTetraTopo; FROM Squared IMPORT MakeTetrahedron, MakeTriangle; /* Procedures to build V-stars */ PROCEDURE MakeTetrahedronTriang() : ARRAY [0..3] OF Pair { ??? t = MakeTetrahedron(); { SubdivideTetrahedron(t[0]); return t; ; } } /* END MakeTetrahedronTriang */ void SubdivideTetrahedron(Pair a) == /* Subdivide the tetrahedron Pneg(a) into four new tetrahedra through the insertion of a new medial vertex of type "VP", six new faces, and four edges. */ Node *y; { /* Create the medial vertex "VP" */ y = MakeVertex(); ??? v = NARROW(y, Vertex); { ){ v.exists= TRUE; v.label = "VP"; v.num = 0; ; } ??? b = Fnext_1(a); ??? c = Enext_1(b); ??? d = Fnext(c); ??? e = Enext_1(a); ??? f_ = Fnext_1(e); ??? g = Enext_1(f_); ??? h = Fnext(g); ??? fa = a.facetedge.face; ??? fb = b.facetedge.face; ??? fg = g.facetedge.face; ??? fh = h.facetedge.face; ??? ea = a.facetedge.edge; ??? ec = c.facetedge.edge; ??? ee = e.facetedge.edge; ??? eh = h.facetedge.edge; ??? eeb = Enext(b).facetedge.edge; ??? eea = Enext(a).facetedge.edge; ??? i = Enext(a); ??? j = Fnext_1(i); ??? k = Enext(b); ??? l = Fnext(k); ??? u = Org(a); ??? v = Org(Clock(a)); ??? w = Org(c); ??? x = Org(e); ??? f1 = MakeTriangle(); ??? f2 = MakeTriangle(); ??? f3 = MakeTriangle(); ??? f4 = MakeTriangle(); ??? f5 = MakeTriangle(); ??? f6 = MakeTriangle(); ??? q1 = MakePolyhedron(); ??? q2 = MakePolyhedron(); ??? q3 = MakePolyhedron(); ??? q4 = MakePolyhedron(); { /* save attributes for the original faces: "fa", "fb", "fg", "fh". */ fa.exists = TRUE; fa.color = frgb_t{1.00, 1.00, 0.20}; fa.transp = frgb_t{0.70, 0.70, 0.70}; fb.exists = TRUE; fb.color = frgb_t{1.00, 1.00, 0.20}; fb.transp = frgb_t{0.70, 0.70, 0.70}; fg.exists = TRUE; fg.color = frgb_t{1.00, 1.00, 0.20}; fg.transp = frgb_t{0.70, 0.70, 0.70}; fh.exists = TRUE; fh.color = frgb_t{1.00, 1.00, 0.20}; fh.transp = frgb_t{0.70, 0.70, 0.70}; ea.exists = TRUE; ea.color = frgb_t{0.0, 0.0, 0.0}; ea.transp = frgb_t{0.0, 0.0, 0.0}; ea.radius = 0.004; ec.exists = TRUE; ec.color = frgb_t{0.0, 0.0, 0.0}; ec.transp = frgb_t{0.0, 0.0, 0.0}; ec.radius = 0.004; ee.exists = TRUE; ee.color = frgb_t{0.0, 0.0, 0.0}; ee.transp = frgb_t{0.0, 0.0, 0.0}; ee.radius = 0.004; eh.exists = TRUE; eh.color = frgb_t{0.0, 0.0, 0.0}; eh.transp = frgb_t{0.0, 0.0, 0.0}; eh.radius = 0.004; eea.exists = TRUE; eea.color = frgb_t{0.0, 0.0, 0.0}; eea.transp = frgb_t{0.0, 0.0, 0.0}; eea.radius = 0.004; eeb.exists = TRUE; eeb.color = frgb_t{0.0, 0.0, 0.0}; eeb.transp = frgb_t{0.0, 0.0, 0.0}; eeb.radius = 0.004; /* insert f1 */ SetFnext(b,f1); SetFnext(f1,a); /* insert f2 */ SetFnext(c,f2); SetFnext(f2,d); /* insert f3 */ SetFnext(f_,f3); SetFnext(f3,e); /* set the relations among f1,f2 and f3 */ SetFnext(Clock(Enext(f2)),Enext_1(f1)); SetFnext(Enext_1(f1),Clock(Enext(f3))); SetFnext(Clock(Enext(f3)),Clock(Enext(f2))); SetEdgeAll(Enext_1(f1), Enext_1(f1).facetedge.edge); /* insert f4 */ SetFnext(j,f4); SetFnext(f4,i); /* insert f5 */ SetFnext(k,f5); SetFnext(f5,l); /* insert f6 */ SetFnext(g,f6); SetFnext(f6,h); /* set the internal relations along edge "yv" */ SetFnext(Enext_1(f5),Enext_1(f4)); SetFnext(Enext_1(f4),Clock(Enext(f1))); SetFnext(Clock(Enext(f1)), Enext_1(f5)); SetEdgeAll(Clock(Enext(f1)),Clock(Enext(f1)).facetedge.edge); /* set the internal relations along edge "wy" */ SetFnext(Enext(f5),Clock(Enext_1(f6))); SetFnext(Clock(Enext_1(f6)),Clock(Enext_1(f2))); SetFnext(Clock(Enext_1(f2)),Enext(f5)); SetEdgeAll(Enext(f5),Enext(f5).facetedge.edge); /* set the internal relations along edge "xy" */ SetFnext(Enext(f6), Enext(f4)); SetFnext(Enext(f4), Clock(Enext_1(f3))); SetFnext(Clock(Enext_1(f3)), Enext(f6)); SetEdgeAll(Enext(f4), Enext(f4).facetedge.edge); /* set the overall edge component */ SetEdgeAll(a, ea); SetEdgeAll(c, ec); SetEdgeAll(e, ee); SetEdgeAll(i, eea); SetEdgeAll(k, eeb); SetEdgeAll(h, eh); SetFaceAll(a, fa); SetFaceAll(b, fb); SetFaceAll(g, fg); SetFaceAll(h, fh); /* set the origins */ SetAllOrgs(a,u); SetAllOrgs(Clock(a),v); SetAllOrgs(c,w); SetAllOrgs(e,x); SetAllOrgs(Enext_1(f1),y); /* set the polyhedrons */ SetAllPneg(a,q1); SetAllPneg(Spin(b),q2); SetAllPneg(Spin(g),q3); SetAllPneg(Spin(f6),q4); ; } } /* END SubdivideTetrahedron */ PROCEDURE MakeOctahedronTriang() : ARRAY[0..7] OF Pair == /* Builds a triangulated octahedron, with eight tetrahedra, and return one facet-edge pair by original face. */ VAR a : ARRAY[0..7] OF ARRAY[0..7] OF Pair; b : ARRAY[0..7] OF Pair; { for (i = 0; i <= (7); i++){ a[i] = Triangulation.MakeTetraTopo(1,1); ; } /* first level gluing tetrahedra */ EVAL Glue(Spin(a[1][1]),a[0][0],1); EVAL Glue(Spin(a[2][1]),a[1][0],1); EVAL Glue(Spin(a[3][1]),a[2][0],1); EVAL Glue(Spin(a[0][1]),a[3][0],1); /* second level gluing tetrahedra */ EVAL Glue(Spin(a[0][3]),a[4][2],1); EVAL Glue(Spin(a[1][3]),a[5][2],1); EVAL Glue(Spin(a[2][3]),a[6][2],1); EVAL Glue(Spin(a[3][3]),a[7][2],1); /* gluing between levels */ EVAL Glue(Spin(a[5][1]),a[4][0],1); EVAL Glue(Spin(a[6][1]),a[5][0],1); EVAL Glue(Spin(a[7][1]),a[6][0],1); EVAL Glue(Spin(a[4][1]),a[7][0],1); b[0] = a[0][2]; b[1] = a[1][2]; b[2] = a[2][2]; b[3] = a[3][2]; b[4] = a[4][3]; b[5] = a[5][3]; b[6] = a[6][3]; b[7] = a[7][3]; return b; } /* END MakeOctahedronTriang */ PROCEDURE MakeIcosahedronTriang() : ARRAY[0..19] OF Pair == /* Builds a triangualted icosahedron, with twenty tetrahedra, and return one facet-edge pair by original face (i.e. 20). */ VAR a : ARRAY[0..19] OF ARRAY[0..7] OF Pair; b : ARRAY[0..19] OF Pair; /* this variable will be retuned */ { for (i = 0; i <= (19); i++){ a[i] = MakeTetraTopo(1,1); ; } /* inside the first level */ EVAL Glue(Spin(a[1][1]),a[0][0],1); EVAL Glue(Spin(a[2][1]),a[1][0],1); EVAL Glue(Spin(a[3][1]),a[2][0],1); EVAL Glue(Spin(a[4][1]),a[3][0],1); EVAL Glue(Spin(a[0][1]),a[4][0],1); /* between the first and second level */ EVAL Glue(Spin(a[0][3]),a[5][2],1); EVAL Glue(Spin(a[1][3]),a[6][2],1); EVAL Glue(Spin(a[2][3]),a[7][2],1); EVAL Glue(Spin(a[3][3]),a[8][2],1); EVAL Glue(Spin(a[4][3]),a[9][2],1); /* inside the second level */ EVAL Glue(Spin(Enext(a[10][1])), a[5][0], 1); EVAL Glue(Spin(a[6][1]), Enext(a[10][0]),1); EVAL Glue(Spin(Enext(a[11][1])), a[6][0], 1); EVAL Glue(Spin(a[7][1]), Enext(a[11][0]),1); EVAL Glue(Spin(Enext(a[12][1])), a[7][0], 1); EVAL Glue(Spin(a[8][1]), Enext(a[12][0]),1); EVAL Glue(Spin(Enext(a[13][1])), a[8][0], 1); EVAL Glue(Spin(a[9][1]), Enext(a[13][0]),1); EVAL Glue(Spin(Enext(a[14][1])), a[9][0], 1); EVAL Glue(Spin(a[5][1]), Enext(a[14][0]),1); /* between the second and third level */ EVAL Glue (Spin(a[10][3]), a[15][2],1); EVAL Glue (Spin(a[11][3]), a[16][2],1); EVAL Glue (Spin(a[12][3]), a[17][2],1); EVAL Glue (Spin(a[13][3]), a[18][2],1); EVAL Glue (Spin(a[14][3]), a[19][2],1); /* inside the third level */ EVAL Glue(Spin(a[16][1]),a[15][0],1); EVAL Glue(Spin(a[17][1]),a[16][0],1); EVAL Glue(Spin(a[18][1]),a[17][0],1); EVAL Glue(Spin(a[19][1]),a[18][0],1); EVAL Glue(Spin(a[15][1]),a[19][0],1); /* Rescue the pairs to be returned */ for (i = 0; i <= (4); i++){ b[i] = a[i,2]; } for (i = 5; i <= (9); i++){ b[i] = a[i,3]; } for (i = 10; i <= (14); i++){ b[i] = a[i,2]; } for (i = 15; i <= (19); i++){ b[i] = a[i,3]; } /* some assertions */ for (i = 0; i <= (4); i++){ assert(Fnext(b[i+5]) == Spin(b[i])); ; } for (i = 10; i <= (14); i++){ assert(Fnext(b[i+5]) == Spin(b[i])); ; } return b; } /* END MakeIcosahedronTriang */ PROCEDURE MakeDodecahedronTriang() : ARRAY[0..11] OF ARRAY [0..4] OF Pair == /* Builds a triangulated Dodecahedron, with 60 tetrahedra, trough the automatic gluing of tetrahedra. */ TYPE double Row4I = ARRAY[0..3] OF uint ; VAR cell4 : REF ARRAY OF Row4I; tetra : REF ARRAY OF ARRAY [0..3] OF Pair; uint cellnum; dode : ARRAY[0..11] OF ARRAY [0..4] OF Pair; PROCEDURE Gluing(Ti,Tj,Ci,Cj: uint) : Pair == /* Gluing the tetrahedra Ti with Tj through the free faces Ci and Cj respectively. */ { IF /* 1 */ double Ci = 0) AND AND (Cj == 0)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; double Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1] DO if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ;}; ELSIF /* 2 */ double Ci = 0) AND AND (Cj == 1)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; double Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1] DO if (((Oi == Oj)) AND AND ((Di == Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ;}; ELSIF /* 3 */ double Ci = 0) AND AND (Cj == 2)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi == Oj)) AND AND ((Di == Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ;} ELSIF /* 4 */ double Ci = 0) AND AND (Cj == 3)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi == Dj)) AND AND ((Di == Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ; } ELSIF /* 5 */ double Ci = 1) AND AND (Cj == 0)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; ??? Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1]; { if (((Oi == Oj)) AND AND ((Di == Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ; } ELSIF /* 6 */ double Ci = 1) AND AND (Cj == 1)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; ??? Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1]; { if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ; } ELSIF /* 7 */ double Ci = 1) AND AND (Cj == 2)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ; } ELSIF /* 8 */ double Ci = 1) AND AND (Cj == 3)){ ??? Oi = cell4[Ti,0]; with ( ??? Di = cell4[Ti,1]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi == Oj)) AND AND ((Di == Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ; } ELSIF /* 9 */ double Ci = 2) AND AND (Cj == 0)){ ??? Oi = cell4[Ti,2]; with ( ??? Di = cell4[Ti,3]; ??? Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1]; { if (((Oi==Oj)) AND AND ((Di==Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ; } ELSIF /* 10 */ double Ci = 2) AND AND (Cj == 1)){ ??? Oi = cell4[Ti,2]; with ( ??? Di = cell4[Ti,3]; ??? Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1]; { if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ; } ELSIF /* 11 */ double Ci = 2) AND AND (Cj == 2)){ ??? Oi = cell4[Ti,2]; ??? Di = cell4[Ti,3]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ;}; ELSIF /* 12 */ double Ci = 2) AND AND (Cj == 3)){ ??? Oi = cell4[Ti,2]; ??? Di == cell4[Ti,3]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi==Oj)) AND AND ((Di==Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ;}; ELSIF /* 13 */ double Ci = 3) AND AND (Cj == 0)){ ??? Oi = cell4[Ti,2]; with ( ??? Di = cell4[Ti,3]; ??? Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1]; { if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ; } ELSIF /* 14 */ double Ci = 3) AND AND (Cj == 1)){ ??? Oi = cell4[Ti,2]; with ( ??? Di = cell4[Ti,3]; ??? Oj = cell4[Tj,0]; ??? Dj = cell4[Tj,1]; { if (((Oi==Oj)) AND AND ((Di==Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ; } ELSIF /* 15 */ double Ci = 3) AND AND (Cj == 2)){ ??? Oi = cell4[Ti,2]; ??? Di == cell4[Ti,3]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi==Oj)) AND AND ((Di==Dj))){ EVAL Glue(Spin(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Spin(tetra[Tj,Cj]); ;} ;} ELSIF /* 16 */ double Ci = 3) AND AND (Cj == 3)){ ??? Oi = cell4[Ti,2]; ??? Di == cell4[Ti,3]; ??? Oj = cell4[Tj,2]; ??? Dj = cell4[Tj,3]; { if (((Oi==Dj)) AND AND ((Di==Oj))){ EVAL Glue(Clock(tetra[Tj,Cj]), tetra[Ti,Ci], 1); return Clock(tetra[Tj,Cj]); ;} ;} ; } return tetra[Ti,0]; } /* END Gluing */ PROCEDURE SetCornersTetra(Ti: uint ; row: Row4I) == /* Set the labels "row" in the tetrahedron Ti. */ { ??? a = OrgV(tetra[Ti,0]); with ( double b = OrgV(Clock(tetra[Ti,0])); double c = OrgV(Enext_1(tetra[Ti,1])); double d = OrgV(Enext_1(tetra[Ti,0])) ){ a.num = row[0]; b.num = row[1]; c.num = row[2]; d.num = row[3]; ; } ;} SetCornersTetra; PROCEDURE SaveFreeCorners() == /* Save the free corners on the triangulated dodecahedron, such allow us to use this polyhedron as the unglued scheme for the 3D maps obtained by the gluing of opposite faces on the dode- cahedron. */ PROCEDURE AssignmentOnFace(b: Pair; i: uint) == { if ((Octf.SpinBit(b) == 0)){ dode[i,0] = b; for (j = 1; j <= (4); j++){ dode[i,j] = Clock(Enext(Fnext(Enext_1(dode[i,j-1])))); ; } }else if ((Octf.SpinBit(b) == 1)){ dode[i,0] = b; for (j = 1; j <= (4); j++){ dode[i,j] = Clock(Enext_1(Fnext(Enext(dode[i,j-1])))); ;} ;} ;} AssignmentOnFace; VAR m,n: uint = 0; { for (i = 0; i <= (59); i++){ for (j = 0; j <= (3); j++){ ??? a = tetra[i,j]; with ( double d = Octf.DegreeFaceRing(a) ){ if ((d!=1) AND AND (Ppos(a) == NULL)){ dode[m,n] = tetra[i,j]; INC(n); if ((n == 5)){ INC(m); n = 0;; } ;} ;} ;} ; } ??? a = dode[0,0]; { AssignmentOnFace(a,0);}; dode[1,0] = Spin(Fnext(dode[0,0])); AssignmentOnFace(dode[1,0],1); dode[2,0] = Spin(Fnext(dode[0,4])); AssignmentOnFace(dode[2,0],2); dode[3,0] = Spin(Fnext(dode[0,3])); AssignmentOnFace(dode[3,0],3); dode[4,0] = Spin(Fnext(dode[0,2])); AssignmentOnFace(dode[4,0],4); dode[5,0] = Spin(Fnext(dode[0,1])); AssignmentOnFace(dode[5,0],5); dode[8, 0] = Spin(Fnext(dode[4,2])); AssignmentOnFace(dode[8,0],8); dode[6, 0] = Spin(Fnext(dode[8,3])); AssignmentOnFace(dode[6,0],6); dode[7, 0] = Spin(Fnext(dode[6,1])); AssignmentOnFace(dode[7,0], 7); dode[9, 0] = Spin(Fnext(dode[6,4])); AssignmentOnFace(dode[9,0], 9); dode[10,0] = Spin(Fnext(dode[6,3])); AssignmentOnFace(dode[10,0],10); dode[11,0] = Spin(Fnext(dode[6,2])); AssignmentOnFace(dode[11,0],11); /* the free corners are computed follows the scheme bellow: /|\ /|\ / | \ / | \ / | \ / | \ / 3 | 2 \ / 3 | 2 \ / | \ / | \ /-----|-----\ /-----|-----\ \ 4 / \ 1 / \ 4 / \ 1 / \ / 0 \ / \ / 0 \ / \/_____\/ \/_____\/ <--- ---> double SpinBit = 0 SpinBit == 1 */ ;} SaveFreeCorners; PROCEDURE MustBeGlue(Ti,Tj: Pair) : bool_t == /* Return TRUE if the faces "Ti.facetedge.face" and "Tj.facetedge.face" have coherent orientations and must be glued. */ { ??? a = OrgV(Ti).num; ??? ae = OrgV(Enext(Ti)).num; ??? ae_1 = OrgV(Enext_1(Ti)).num; ??? b = OrgV(Tj).num; ??? be = OrgV(Enext(Tj)).num; ??? be_1 = OrgV(Enext_1(Tj)).num; { if (((a == b) AND AND (ae == be) AND AND (ae_1 == be_1) OR (a == b) AND AND (ae == be_1) AND AND (ae_1 == be))){ return TRUE; } return FALSE ; } ;} MustBeGlue; PROCEDURE EnextK(Ti: Pair; k : uint) : Pair == /* Given a pair "Ti", this procedure return Enext^{k}(Ti). */ { if ((k == 0)){ return Ti }else if ((k == 1)){ return Enext(Ti) }else if ((k == 2)){ return Enext(Enext(Ti)) ; } return Ti; ;} EnextK; VAR poly : REF ARRAY OF ARRAY [0..7] OF Pair; count : uint = 1; faces : REF Pair_vec_t; glues : REF ARRAY OF Row4I; { cellnum = 60; cell4 = NEW(REF ARRAY OF Row4I, cellnum); poly = NEW(REF ARRAY OF ARRAY [0..7] OF Pair,cellnum); tetra = NEW(REF ARRAY OF ARRAY [0..3] OF Pair,cellnum); faces = Pair_vec_new( 4*cellnum); glues = NEW(REF ARRAY OF Row4I, 2*cellnum); /* creating topological tetrahedra */ for (i = 0; i < cellnum; i++){ poly[i] = MakeTetraTopo(1,1); ; } /* creating the tetrahedra */ for (i = 0; i < cellnum; i++){ for (j = 0; j <= (3); j++){ tetra[i,j] = poly[i,j]; assert(Ppos(tetra[i,j]) == NULL); ;} ; } /* cells with corners perfectly assigments */ cell4[ 0]=Row4I{100,500, 0, 1}; cell4[ 1]=Row4I{100,500, 1, 4}; cell4[ 2]=Row4I{100,500, 4, 7}; cell4[ 3]=Row4I{100,500, 7, 2}; cell4[ 4]=Row4I{100,500, 2, 0}; cell4[ 5]=Row4I{500,101, 0, 1}; cell4[ 6]=Row4I{500,101, 1, 5}; cell4[ 7]=Row4I{500,101, 5, 8}; cell4[ 8]=Row4I{500,101, 8, 3}; cell4[ 9]=Row4I{500,101, 3, 0}; cell4[ 10]=Row4I{500,102, 2, 0}; cell4[ 11]=Row4I{500,102, 0, 3}; cell4[ 12]=Row4I{500,102, 3, 9}; cell4[ 13]=Row4I{500,102, 9, 6}; cell4[ 14]=Row4I{500,102, 6, 2}; cell4[ 15]=Row4I{103,500, 6, 2}; cell4[ 16]=Row4I{500,103, 7, 2}; cell4[ 17]=Row4I{103,500, 7, 13}; cell4[ 18]=Row4I{103,500, 13, 12}; cell4[ 19]=Row4I{500,103, 6, 12}; cell4[ 20]=Row4I{500,104, 1, 4}; cell4[ 21]=Row4I{500,104, 4, 10}; cell4[ 22]=Row4I{500,104, 10, 11}; cell4[ 23]=Row4I{500,104, 11, 5}; cell4[ 24]=Row4I{500,104, 5, 1}; cell4[ 25]=Row4I{500,105, 9, 3}; cell4[ 26]=Row4I{500,105, 3, 8}; cell4[ 27]=Row4I{500,105, 8, 14}; cell4[ 28]=Row4I{500,105, 14, 15}; cell4[ 29]=Row4I{500,105, 15, 9}; cell4[ 30]=Row4I{500,106, 12, 6}; cell4[ 31]=Row4I{500,106, 6, 9}; cell4[ 32]=Row4I{500,106, 9, 15}; cell4[ 33]=Row4I{500,106, 15, 18}; cell4[ 34]=Row4I{500,106, 18, 12}; cell4[ 35]=Row4I{500,107, 4, 7}; cell4[ 36]=Row4I{500,107, 7, 13}; cell4[ 37]=Row4I{500,107, 13, 16}; cell4[ 38]=Row4I{500,107, 16, 10}; cell4[ 39]=Row4I{500,107, 10, 4}; cell4[ 40]=Row4I{108,500, 5, 8}; cell4[ 41]=Row4I{108,500, 8, 14}; cell4[ 42]=Row4I{108,500, 14, 17}; cell4[ 43]=Row4I{108,500, 17, 11}; cell4[ 44]=Row4I{108,500, 11, 5}; cell4[ 45]=Row4I{109,500, 18, 12}; cell4[ 46]=Row4I{109,500, 12, 13}; cell4[ 47]=Row4I{109,500, 13, 16}; cell4[ 48]=Row4I{109,500, 16, 19}; cell4[ 49]=Row4I{109,500, 19, 18}; cell4[ 50]=Row4I{500,110, 18, 15}; cell4[ 51]=Row4I{500,110, 15, 14}; cell4[ 52]=Row4I{500,110, 14, 17}; cell4[ 53]=Row4I{500,110, 17, 19}; cell4[ 54]=Row4I{500,110, 19, 18}; cell4[ 55]=Row4I{111,500, 10, 11}; cell4[ 56]=Row4I{111,500, 11, 17}; cell4[ 57]=Row4I{111,500, 17, 19}; cell4[ 58]=Row4I{111,500, 19, 16}; cell4[ 59]=Row4I{111,500, 16, 10}; /* set the labels for each tetrahedra */ for (i = 0; i < cellnum; i++){ SetCornersTetra(i,cell4[i]); ; } /* builds the table of faces for choose which tetrahedra must be gluing. */ for (i = 0; i < cellnum; i++){ for (k = 0; k <= (3); k++){ faces[(4*i)+k] = tetra[i,k]; ;} ; } /* computing which cells must be gluing. */ for (k = 0 TO LAST(faces^)){ for (l = k+1 TO LAST(faces^)){ for (m = 0; m <= (2); m++){ ??? e = EnextK(faces[l],m); with ( ){ if ((MustBeGlue(faces[k],e))){ ??? kc = k MOD 4; ??? kt = k DIV 4; ??? lc = l MOD 4; ??? lt = l DIV 4; { glues[count-1] = Row4I{kt,lt,kc,lc}; INC(count); ;} ;} ;} ;} ;} ; } /* Do the automatic gluing of tetrahedra */ for (i = 0 TO LAST(glues^)){ ??? c = glues[i]; { if ((c!=Row4I{0,0,0,0})){ EVAL Gluing(c[0],c[1],c[2],c[3]); ;} ;} ; } /* setting the origins. */ for (i = 0; i < cellnum; i++){ for (j = 0; j <= (3); j++){ ??? a = tetra[i,j]; with ( double b = Enext(a); double c = Enext_1(a) ){ Triangulation.SetAllOrgs(a,OrgV(a)); Triangulation.SetAllOrgs(b,OrgV(b)); Triangulation.SetAllOrgs(c,OrgV(c)); ;} ;} ; } SaveFreeCorners(); return dode; ;} MakeDodecahedronTriang; { ;} VStar. /**************************************************************************/ /* */ /* Copyright © 2000 Universidade Estadual de Campinas (UNICAMP) */ /* */ /* Authors: */ /* L. Lozada & J. Stolfi - UNICAMP */ /* */ /* This file can be freely used, distributed, and modified, provided that */ /* this copyright and authorship notice is included in every copy or */ /* derived version. */ /* */ /* DISCLAIMER: This software is offered ``as is'', without any guarantee */ /* as to fitness for any particular purpose. Neither the copyright */ /* holder nor the authors or their employers can be held responsible */ /* for any damages that may result from its use. */ /* */ /**************************************************************************/