CS195H — Homework 5 Due:March 12th, 2015 As usual, please work in pairs. Math Stuff For us, a “surface” is a finite collection of triangles (or other polygons, but let’s stick with triangles for now) with certain properties: 1. Every edge is shared by exactly two triangles. 2. Under the shared-edge relation, the set of triangles is connected. 3. The triangles sharing any vertex v can be ordered t0 , t1 , . . . , tk−1 so that ti and ti+1 mod k share an edge for i = 0, 1, . . . k − 1. We haven’t said yet what a triangle actually is, however. For now, I’m going to say that it’s a triple of integers, so something like (1, 2, 8) is a triangle. The idea is that there are vertices (actual locations in some euclidean space) v1 , v2 , . . ., and (1, 2, 8) is meant to represent the triangle whose vertices are v1 , v2 , and v8 . We’ll assume that no three of these vertices are collinear, so that this notion of “the triangle with those vertices” makese sense. But since our triangles don’t really need the vertices – just the three integers – this isn’t really critical. Since a triangle is a set of three distinct numbers, an edge is any one of the size-two subsets. In our example, the edges are 12, 28, 18. Order doesn’t matter, but it can be helpful to make a habit of writing them in increasing order. When we have more than 10 vertices, using some commas can help, too, so we might write 1, 2; 2, 8; 1, 8 instead, or even (1, 2), (2, 8), (1, 8). There’s another rule that I did not mention in class, which is that each triangle may appear at most once: if we have the triangle (1, 2, 8), we cannot have another triangle (1, 2, 8) or even (2, 1, 8). One way to construct such a surface is to take a regular polygon in the plane (“regular” in the sense of “all angles equal”) with an even number of edges, and triangulate it. The resulting set of triangles satisfies the “no duplicates” rule, and the connectedness rule, but the edges of the original polygon have only one triangle touching them, and the vertices don’t satisfy the third rule. On the other hand, if we “identify the edges in pairs”, i.e., we label each edge of the polygon with a letter and an arrow, with each letter appearing exactly twice, we find that each polygon edge now has two faces meeting it, and that many vertices are “identified” with each other. The first and second rules for a polygon are now satisfied, but the third might not be. Alas, there’s a problem: when we identify edges, we also identify vertices, and a triangle like (1, 2, 8) might become (1, 2, 1) because vertex 8 gets associated to vertex 1. But (1, 2, 1) isn’t a valid triangle. On the other hand, we have a notion of “equivalence” for surfaces: F and G are equivalent if there’s a subdivision F 0 of F and a subdivision G0 of G and mapping f from the vertices of F 0 1 CS195H - Homework 5 Due:March 12th, 2015 to the vertices of G0 such that each triangle of F 0 corresponds, under f , to a triangle of G0 , and vice-versa. (A “basic subdivision” of a triangle consists of either inserting a vertex on one edge (and an edge from there to the opposite vertex), or the insertion of a vertex in the center of the triangle, with edges from there to all three vertices. A subdivision of a triangle is the result of any sequence of basic subdivisions. And a subdivision of a mesh consists of a sequence of basic subdivisions on various triangles, with the rule that if you insert a vertex on the edge AB, then you must do the basic subdivision to the triangles on both sides of that edge! With this notion in hand, we can take our 2n-gon and subdivide it as shown in this figure: the blue vertices on the boundary are the original 2n-gon; in each edge, we’ve inserted a red midpoint, and we’ve drawn a concentric 2n-gon in green, with carefully chosen connections. Now when we identify edges in the original mesh, it never happens that two vertices of the same triangle end up identified. Problem 1 Let P be a polygon of 2n sides, with edge-pairs in P identified in any way at all. Show that if we subdivide P as above, and perform the obvious identifications on the subdivided shape, the resulting object is in fact a surface according to our definition. For the interior vertices, edges, and triangles, there is nothing to show. But for triangles that have one edge on the boundary (why can’t they have two edges on the boundary?), you must show something. And for boundary vertices, you have to show something, too. It may help to distinguishe between red and blue boundary vertices. Problem 2 Show that if F is a surface, and F 0 is a subdivision of F , then F is equivalent to F 0 . (This is almost trivial.) 2 CS195H - Homework 5 Due:March 12th, 2015 Problem 3 Show that if F is a surface and we apply a basic subdivision, the number of vertices, edges, and triangular faces in F change according to v -> v+1 e -> e + 3 f -> f + 2 for the “insert in mid face” operation. Then describe the change in these numbers for the other kind of subdivision. Problem 4 Show that if F and G are equivalent surfaces, and we compute, for each one, the number v − e + f (where v, e, f are the number of vertices, edges, and faces as above), the results are the same. The number χ = v−e+f is called the Euler characteristic of the surface. (“Euler” is pronounced “oiler”. Don’t say “ewe-ler.”) Problem 5 Compute the Euler characteristic of S 2 , T 2 and P 2 . Then compute χ(F #G) in term of χ(F ) and χ(G) for any two surfaces F and G. Finally, write down the Euler characteristic of each surface in our classification of surfaces. Problem 6 Show that if P is any n-sided polygon (n ≥ 3), and we triangulate it, the Euler characteristic of the resulting mesh is exactly 1. It also turns out that the Euler characteristic of the polygon itself is v − e + f = 2n − 2n + 1 = 1 if we count the n-gon “face” as one “face”. This shows that we can compute the Euler characteristic of a surface by dividing it into squares, triangles, a mix of hexagons and pentagons like a soccer ball, etc., and we can still just count v − e + f and get the right answer (i.e. the one we’d get if we triangulated all the non-triangle polygons). Problem 7 For millenia, it’s been known that there are only five regular polyhedra, namely, the tetrahedron, cube, octahedron, dodecahedron, and icosahedron. Prove this by considering sudivisions of the sphere into n-gons (n fixed) which meet k at a vertex, and recalling that χ(S 2 ) = 2. Problem 8 For any triangulated surface, show that 3f = 2e, that e = 3(v − χ), and that p 1 v ≥ (7 + 49 − 24χ). 2 For the sphere, torus, and projective plane, what are the smallest possible numbers of vertices in a triangulation according to this formula? In each case, can you exhibit a triangulation with that many vertices? 3 CS195H - Homework 5 Due:March 12th, 2015 CS Stuff In class, we described an algorithm for taking an arbitrary polygon with edges identified in pairs and converting it (or an “edge descriptiont” of it, like abcb−1 c−1 a1 , which I’ll call a matching) into a standard form. In a matching, each symbol (like a, b, c, etc.) appears exactly twice; it may appear with no primes, a prime on one symbol, or a prime on both symbols. We’ll call the second case (both a and a0 appear) a pair of the first kind and the other cases pairs of the second kind. When we talk about symbols in a pair being adjacent, we mean things like the a-symbols in cbaa0 bdcd, but also things like the a-symbols in a0 bdcdcba, i.e, “adjacency wraps around.” You’ll recall that the steps in the reduction were these: 1. Remove from the matching all sequences of the form aa0 or a0 a (where 0 denotes “other direction”, because it’s easier to type than the −1 superscript), until either they’re all gone, or the matching has only two symbols in it. In short: remove adjacent type-one pairs, as long as there are at least four symbols. 2. Transform to a polygon in which all vertices are identified to a single vertex. The trick here was to find two inequivalent vertices that were adjacent, say Q and P , with the next vertex after P being, say, R, and then cutting along the edge QR (and similarly at the “other” copy of the edge P Q in the polygon), and gluing up along the RP edge. The result is one fewer nodes in the class of P , and one more in the class of Q. Repeating inductively, we get all nodes to be in the same class. 3. Make any nonadjacent pair of edges of the second kind adjacent. If we have edges b and b at two different locations in the polygon, we can draw a cut from the end of one b to the end of the other, and label the cut edge q. When we glue up the b edges of the two resulting polygons, we end up with qq in the resulting matching. We continue this process until all pairs of the second kind are adjacent. 4. If there are no pairs of the first kind, we are done, for we have a connected sum of projective planes. If, however, there are pairs of the first kind, we showed that there must be two interleaved pairs, i.e., the matching must be of the form . . . a . . . b . . . a0 . . . b0 where the ellipses denote the possible occurrence of other letters, and where either a and a0 or b and b0 might be swapped, depending on which way the arrows are drawn. To fix this, draw a cut that joins the “pointy” ends of the two a arrows, and call it c. Glue up along edge b, and we now have aca0 . . . c0 , where c and c0 might be swapped depending on the direction you chose for the arrow. Now draw a second cut between the pointy ends of the two c arrows, and call it d. Glue up along a, and you’ll have dcd0 c0 (where you may need to swap arrow direction to get this). At this point, the matching is either aa, and represents a sphere, or has the form like 122121121, where each 1 denotes a type-one pair of adjacent edges (i.e., pp0 ) and each 2 denotes a sequence like cdc0 d0 of four edges. In short, it’s a sequence of projective planes and tori, connect-summed together in some random order. 4 CS195H - Homework 5 Due:March 12th, 2015 5. If there are no tori, we have a sum of projective planes and we’ve shown our surface matches an element of our list of standard surfaces. If there are no P 2 s, the same is true. If there is a mix of P 2 and T 2 elements, then the method you developed for showing that P 2 #T 2 is equivalent to P 2 #P 2 #P 2 can be used to convert any adjacent 1s and 2s into a string of three 1s, so that eventually we get a sequence of 1s, i.e., a connect-sum of projective planes, which is another standard surface. Problem 9 Implement the preceding ideas in any language you choose. The input should be a pair of sequences like this: 1 3 4 3 2 1 2 4 0 0 1 0 0 1 0 0 which you will interpret as acd0 cba0 bd, which is an octagon with sides identified in pairs. I recommend that you put these in a text file, which you read and interpret, so that you can build up many test cases. Your code should perform the sequence of transformations and produce something that tells which of the standard surfaces this particular matching represents (i.e., you should print out something like “S” or “P#P#P” or “T#T”; you can leave off the superscripts). The input sequences will have to have at least two items, and you might want to check that each sequence is valid (i.e., that each “label” in the first row appears exactly twice, and that each number in the bottom row is either 0 or 1, that the two rows have the same length, etc.) If you want to generate random test cases, you’ll find something odd: if any label appears with the same numbers (e.g., if there’s an a0 and another a0 , then your surface will be a sum of P 2 s). That means that if you choose the 0/1 numbers randomly, you’re very likely to never hit on a sum-of-tori case. I recommend the following approach: build label sequence if (coin flip is heads) for each label, put in one 0 and one 1, in random order else choose the number-sequence as a random list of 0s and 1s Finally, you may want to check your answer by computing v − e + f for the original polygon. You know that f = 1 and e = n, where the polygon has 2n edges. The only question is how many vertex-classes are there. Computing this may be error prone as well, of course. But once you get it working, you can see if the surface-type you computed has the same Euler characteristic as the value you computed from the starting polygon. If not, something’s wrong. Personally, I’d write this code in Matlab. Maybe you’d prefer Python. If you use Python, be sure to tell us whether it’s 2.9 or 3.x or whatever. And if you want to use some other language, check with me first, please. 5
© Copyright 2026 Paperzz