Digital Geometry Processing
Exercise Introduction
Heng Liu, heng.liu@inf.unibe.ch
Computer Graphics Group

Exercises

  • 3 people group
  • Download exercises and upload solutions on ILIAS
  • Handouts are available latest after the lecture
  • Submit solutions latest at 23:59 before the lecture day

Prerequisite: C++

Eigen

  • Eigen is a C++ template library for linear algebra
    • matrices, vectors, numerical solvers and related algorithms
  • More on http://eigen.tuxfamily.org/

Eigen Tutorial: Vectors (1/2)

  • Initialize a vector
  • Eigen::Vector3f u, v;
    u(0) = 1.0;
    u(1) = 0.0;
    u(2) = 0.0;
    // Another way of initializing a vector/matrix
    v << 0.0, 1.0, 0.0;
  • Output vectors
  • cout << "u: " << u.transpose() << endl;
    cout << "v: " << v.transpose() << endl;

Eigen Tutorial : Vectors (2/2)

  • Vector operations
  • Eigen::Vector3f w = u.cross(v);
    cout << u.transpose() << " cross " << v.transpose() << " = " << w.transpose() << endl;
    double dot = u.dot(v);
    cout << u.transpose() << " dot " << v.transpose() << " = " << dot << endl;
  • More vector operations
  • Eigen::Vector3f uHat = u.normalized();              // Notice that these two now have the
    u.normalize();                          // same value. Eigen normalizes in place.
    double normU = u.norm();                    // Note: be careful in performing
    double normUHat = uHat.norm();          // A=A.something()! [See "ALIASING" topic in Eigen]
    cout << "normU: " << normU << endl;
    cout << "normUHat: " << normUHat << endl;

Eigen Tutorial : Matrix

  • Matrix setup
  • Eigen::Matrix2f m;
    m(0, 0) = 3;
    m(1, 0) = 2.5;
    m(0, 1) = -1;
    m(1, 1) = m(1, 0) + m(0, 1);
    cout << "\nMatrix m:\n" << m << endl;
  • // Again, initialize with comma initializer
    Eigen::Matrix3f n;
    n << 1, 2, 3,
    4, 5, 6,
    7, 8, 9;
    cout << "\nMatrix n:\n" << n << endl;
  • Matrix operations
  • Eigen::Matrix3f m1 = m + n; // This will fail.
    Eigen::Matrix2f m2 = Eigen::Matrix2f::Identity();
    Eigen::Matrix2f m3 = m + m2; // This will not.
    cout << "\nMatrix m3:\n" << m3 << endl;

Eigen Tutorial : Final Words

OpenFlipper

Building OpenFlipper

  • Refer to Developer Documentation
  • Better compile using Cmake
  • Download OpenFlipper: git clone --recursive https://graphics.rwth-aachen.de:9000/OpenFlipper-Free/OpenFlipper-Free.git

Building OpenFlipper

  • Set source directory and build directory
  • Click Configure

Building OpenFlipper

  • Choose proper compiler

Building OpenFlipper

  • Set directory if there is any configure error
  • Click Generate

Building OpenFlipper

  • Open a terminal:
  •   ~$ cd /path/to/OpenFlipper-Build/
      ~$ make
  • Launch OpenFlipper
  • ~$ ./Build/OpenFlipper.app/Contents/MacOS/OpenFlipper

Assignment

  • Build OpenFlipper by following the documentation
  • Download dgp-exercise1.zip and extract into OpenFlipper folder
  • Compile OpenFlipper together with the downloaded plugin Plugin-DGPExercise
  • Solve a small sparse linear system with Eigen. See more details in the handout.