Boundary Representation You need to generate an object using rotation of a 2D outline. The final representation of the object should be in this format : nvert /* number of vertices */ x0 y0 z0 x1 y1 z1 . /* list of nvert (x,y,z) float triples */ . . xnvert-1 ynvert-1 znvert-1 npoly /* number of polygons */ p0v1 p0v2 p0v3 p0v4 p1v1 p1v2 p1v3 p1v4 p2v1 p2v2 p2v3 p2v4 . /* list of npoly polygons, integer indices . into vertex list . */ pnpoly-1v1 pnpoly-1v2 pnpoly-1v3 pnpoly-1v4 I.e. a list of nvert vertices, followed by a list of npoly polygons. In this version of the program all polygons must have four vertices For an example, look at the file cube.dat in the data directory, which has the eight vertices and six faces of a cube. A much more complicated example is astronaut.dat, with 864 vertices and 801 polygons. This was typed in by hand by a student a few years ago! To generate a wineglass object, start with a 2D profile of the glass e.g. __ / / / / / / / / / / / / | | ^ | | | | | | | \_______ z |__________\ x----> (O.K. not a very elegant one). Label this as a set of x, z points. You can now rotate these points anticlockwise around the z-axis, and generate a number of angular samples; 12 is a good number. At each angle, the z axis is unchanged but x' = xCos(ang), y' = xSin(ang). Store these in a list. To generate the polygons, note that each pair of vertices in the 2D profile will generate one side of a polygon, so that at angle ang, the set of polygons will be : V(i)(ang) V(i)(ang+delta_ang) V(i+1)(ang + delta_ang) V(i+1)(ang) If the original profile had n2D points in it, and you make nang samples, you can predict the total number of vertices, and polygons. If the profile was in anticlockwise order, and you sweep anticlockwise around z, the final representation will have anticlockwise orientated polygons. For this coursework, write the program that takes the 2D profile, and generates the 3D vertices, and the polygons in the correct representation. You can list the points in the 2D profile in the program itself or if you are feeling slick, you could read them in from a file (or cin). Note, you should hand in the program, not the file you generated. Note : we accept any solution that produces a correct image. However, to get extra marks you should eliminate a) multiple copies of the same point b) polygons that are invalid (e.g. actually represent lines) You should also note that some polygons will in reality be triangles. To keep things simple each polygon is assumed to have four points, so for the triangles two points will inevitably be identical.