Homework 01 Marking scheme and feedback

triangulated OBJ output [3]
generalised map CSV output [4]
code clarity [2]
code runs [1]

Overall feedback

Most teams got a good OBJ output. The generalised map output was more mixed, although most teams also did a decent job here.

To my surprise no one actually used the gmap data structure (ie. the involutions and cell-dart references) to generate the barycenters for the triangulation. Everyone used a ‘hack’ to store an explicit vertex list on the faces and edges, which kind of defeats the point of having the gmap. Some groups also hardcoded how many vertices each face has (in the example inputs this was always 4, so it worked), it is much better to write your code in a general way so that it can handle any number of vertices in a face. No points were subtracted for that however.

Example of how to use the gmap references to traverse a Face to visit all its vertices to compute the barycenter:

struct Face {
  Point* barycenter = nullptr;
  Dart* dart = nullptr;

	...
  
  void compute_barycenter() {
    auto start = this->dart;
    Dart* cur = start;
    Point sum;
    int count = 0;
    // collect the vertices around this face
    do {
      sum += *cur->vertex->barycenter;
      ++count;
      cur = cur->a0->a1;
    } while (cur!=start);
    this->barycenter = new Point();
    *(this->barycenter) = sum / count;
  }
};

To test the validity of your gmap CSV output I performed a number of tests:

  1. I counted the number of darts and cells
  2. I checked for all darts if dart->a0->a0 == dart, dart->a1->a1 == dart, dart->a2->a2 == dart (involutions test)
  3. I performed cell traversal (somewhat similar to the snippet above) to visit all the incident darts:
    • traverse all the darts around each vertex (and visiting the incident edges around the vertex)
    • traverse all the darts around each edge (and visiting the incident vertices of the edge)
    • traverse all the darts around each face (and visiting the incident vertices/edges of the face)