mpii Minerva of the Max Planck Society
max planck institut
informatik

Handin

Please submit your programming assignments electronically via ftp. As we will handle a fairly large number of assignments we ask you to comply with some (simple) rules. In the following we guide you through the submission for assignment N (replace the N by the number of the assignment sheet) of student Firstname Lastname:

  1. Collect all source and data files in a single directory named AN (e.g. A2 for assignment sheet 2).

    Notes

    • Do not include any binary files, e.g. remove all compiler generated files (e.g. "*.o") or any other output files using make clean before.
    • Windows users please do us a favor and save your source files in "unix format", i.e. an end-of-line is encoded as a single '\n'.

  2. Pack this directory AN into a gzip compressed tar archive named LASTNAME.FIRSTNAME.VERSION.AN.tgz, using e.g.
    > gtar czf LASTNAME.FIRSTNAME.VERSION.AN.tgz AN/

    Notes

    • Replace LASTNAME and FIRSTNAME with your name using capital letters.
    • Replace VERSION as described below.
    • See also the tar and gzip man pages.
    • You may use any other program for packing that produces the same tar/gzip file format as output! (E.g. WinZip should be able to do this.)
    • Please don't send .zip files!

  3. Send your file to ftp://ftp.mpi-sb.mpg.de/pub/incoming/ag4-gm (user: anonymous, password: your-email), e.g.

    ftp ftp.mpi-sb.mpg.de
    Name: anonymous
    Password: myemail@somewhere.net
    > binary
    > cd /pub/incoming/ag4-gm
    > put LASTNAME.FIRSTNAME.VERSION.AN.tgz
    > quit

    Notes:

  4. You have now submitted your program code.

    Finally we give an example for student Hans Meier and assignment sheet 1:

    src> ls A1
    Makefile a1.cc data.txt

    src> gtar czf MEIER.HANS.01.A1.tgz A1
    src> ftp ftp.mpi-sb.mpg.de
    > Name: anonymous
    > Password: hans.meier@web.de
    > binary
    > cd /pub/incoming/ag4-gm
    > put MEIER.HANS.01.A1.tgz
    > quit

    In case Hans wants to submit another version because he edited a1.cc and/or added a file a2.cc, he would just repeat the procedure choosing the file name MEIER.HANS.02.A1.tgz instead, etc.

    Some counter examples including common mistakes: the following file names are not acceptable for Hans Meier: MEIER_HANS_02_A2.tgz, MEIER.HANS.02.A2.tar.gz, MEIER.HANS.02.AN.tgz, MEIER.HANS.02.ASSIGNMENT2.tgz,... Please follow the above conventions strictly.

[top]

Coding

Please do the programming assignments in C/C++. We will use GNU g++ (3.3.5) as reference compiler, your code must compile with g++. Additionally we expect a simple (gmake) Makefile (example) that will (a) compile your source files and (b) execute the resulting binary file with the provided data as input and so create the desired output (e.g. a PostScript file). The last step includes the use of an additional tool like gnuplot. Most programs will read some ASCII input file and write some output file. The output may then be processed by a visualization tool such as gnuplot. We use a simple ASCII file format for input and provide you some code for reading.

Requirements:

  • Due to the number of submissions, we have to rely on some convetions for processing all submitted programs the same way:
  • Most important, Your Makefile must compile your source files and run the programs (see above). Either use the standard target or "all" for producing the desired output, i.e. executing make or make all will compile and run your programs with all input data.
  • The above requires your submission to include the files with input data. (We cannot manually type in all data like "Enter control point 1: "!)
  • Remember to run make clean before your submission to not include binary files. We are not able to run your binaries on our machines!
  • Please compile your program including debug information, i.e. with gcc-option "-g", do not enable optimization "-O". (We do not want to edit the Makefile for being able to use the debugger.)
  • Use README files only if absolutely necessary, i.e. you didn't manage to solve part of the problem. The use of your program should be obvious and provided by the Makefile.

Notes:

  • Write clear code. ;-)
  • Focus on the problem and keep your program simple.
  • Please do not use any additional libraries other than the Standard C/C++ libraries (like e.g. MFC or Qt)!
  • Please do not submit "fancy" (and large) Kdevelop (or similar style) projects!
  • Please do not "hard-code" input data but read it from standard input (preferred) or from an arbitrary file, i.e. if multiple data sets are provided one single program should handle each of them separately. (Use the Makefile to execute your program for different input.)
  • Ideally, your programm reads input data from cin/stdin and writes to cout/stdout (e.g. run it as "algorithm < input > output"). This will save you some work opening files or processing command line arguments.
  • All necessary tools (tar,gzip,g++,gmake,gnuplot) are freely available also for Windows, e.g. from www.cygwin.com and www.gnuplot.info!
  • gnuplot comes with an online help. Try the "help" command in an interactive session.
  • In the [Some tools] section you find some example code as well as some useful functions and classes. You may use this code but you do not have to!

[top]

Some tools

  • Some simple tools for geometric modeling.

    We provide a small library of C++ functions and classes that you may use if you like. Download the library and examples or browse the documentation.

    Note

    • You do not have to use this library.
    • We may extend the library throughout the course.
  • gnuplot

    is a visualization tool that we will use for displaying curves/polygons.

    • gnuplot is used interactively via the command line, alternatively you can pipe in a command file (as done in the example Makefile.
    • gnuplot can draw arbitrary planar polygons. Just provide a list of vertex coordinates in a plain ASCII file and refer to the plot command (see below). Multiple polygons can be specified in a single file using a blank line as delimiter.
    • gnuplot provides a good online help, just type ? or help at the command line prompt. You will find the following commands very helpful: plot, replot, with, set (especially set terminal and set output).
    • We recommend that you first try the interactive mode and then use a gnuplot command file together with your Makefile for generating output for your assignments.
    • Example: Use the gm.txt file provided with the library and examples. Start gnuplot and type

      shell> gnuplot
      gnuplot> plot 'gm.txt' with lines
      gnuplot> set terminal postscript
      gnuplot> set output 'gm.ps'
      gnuplot> replot
      gnuplot> quit

    • The provided Makefile does a similar thing.
    • The result from gmake looks like this, it shows two curves defined in the files gm.txt and gm-rot.txt produced by the example program.

[top]

OFF file format

We use a very simple ASCII format for representing polygonal meshes. It consists of a short header, a table of vertex coordinates, and a table of polygons (all triangles) stored as indices into the vertex table.

  • header
    The header includes the number of vertices Nv, the number of faces (triangles) Nf, and the number of edges which is assumed to be always 0, i.e., there is only a vertex and a face table.

    OFF
    Nv Nf 0

  • vertex table
    The vertex table stored the geometry information. It contains Nv lines with x y z coordinates for every vertex, i.e.

    x[0] y[0] z[0]
    ...
    x[Nv-1] y[Nv-1] z[Nv-1]

  • table of faces/triangles
    This table contains the connectivity information stored in Nf lines. Every line describes a face/polygon, the first number denotes the number of vertices, it is assumed to be always 3, i.e. the the meshes consist of triangles only! Then the following 3 numbers are indices into the vertex table (starting with index 0), i.e.

    3 i0[0] i1[0] i2[0]
    ...
    3 i0[Nf-1] i1[Nf-1] i2[Nf-1]

Models for assignment 7 :

[top]