Assignment #3:

Mesh Deformation

# Submission date: Friday 3/23/12, 23:59

Objective:

Develop and implement a mesh deformation tool. Select a linear deformation method among those taught  in class and implement a variation of it. Experiment with using a linear solver library.

1.      Develop a linear mesh deformation tool based on local coordinates.

2.      Use an off-the-shelf linear solver (TAUCS) to efficiently solve the resulting linear system(s).

3.      Develop a user friendly API/visualization mechanism for your algorithm.

Instructions:

1.      Develop an anchor based mesh deformation tool for closed manifold meshes. You can use either a Laplacian (vertex based) approach or a transformation gradient (triangle based) one.   Start by implementing a method which does not support rotations. Then introduce a mechanism for rotation propagation throughout the region of influence (ROI).

2.      For solving the linear system you obtain use the TAUCS solver.  Pay attention to efficiency.

3.      You can limit your method to changing one anchor at a time (this way you can have a fixed rotation axis for you ROI).

4.      Bonus:

If you make the method handle general rotations (not fixed axis) you can get up to 10 extra points.

Note: please make sure your basic algorithm works before implementing the  bonuses. There will be no bonus points given if the basic method has problems.

5.      Your API should support the following mesh operations, performed repeatedly and in any order (pay attention to API ease of use):

1.      Specify an anchor vertex or triangle.

2.      Specify a region of influence.

3.      Perform a deformation by moving the anchor around (the simplest way is just to enter the coordinates of the displacement in textboxes manually, or if you find some useful tool in meshlab - go for it). Think of a mechanism to prescribe/change anchor normal. You can also provide a mechanism where the user specifies anchor rotations only (no translation).

6.      To visualize the deformation process and ensure correctness you should provide the following visualization tools. You should provide an interface option (e.g. checkbox) allowing the user to switch the visualization on and off.

1.      Highlight the ROI and anchor. Highlight the normal of the anchor and ROI boundary.

2.      Show the normal for the vertices/triangles in the ROI after propagation.

7.      Provide a README explaining clearly how to run your method & activate all the different features it has.

8.      The assignment should be done separately by each student.

9.      While you should work independently, it is a good idea to compare your results with other students, to verify code correctness.

Solver:

Here you will be using TAUCS solver ( http://www.tau.ac.il/~stoledo/taucs/). If you're already familiar with this solver, please skip this chapter.

As calling TAUCS solve may be not the easiest thing to do, we have prepared a wrapper for you. Here's a brief list of things you need to do in order to solve your first linear system via TAUCS.

2. Download the wrapper (http://www.cs.ubc.ca/~sheffa/dgp/hw/a3_2012/wrapper.zip) or UPDATE its cross-platform version (http://www.cs.ubc.ca/~sheffa/dgp/hw/a3_2012/wrapperCP.zip). Please be aware that the cross-platform version has not been fully tested and might contain bugs.

3. Unpack the wrapper directly into your plugin folder. I.e. the structure of your folders will look like:

```./samplefilter.vcxproj
./samplefilter.cpp
./samplefilter.h [those are your usual plugin files]
./CML [folder]
./CMLTaucs [folder]
./taucs [folder]
```

4. Unpack the contents of taucs archive into ./taucs folder above. (i.e. path ./taucs/src/ should contain all the taucs sources, etc.)

5. If you're on Windows, add taucs.vcxproj, CML.vcxproj, CMLtaucs.vcxproj to your solution. For Visual studio 2010, add reference to CML in your project properties (right click on your project in the Solution Explorer -> Common Properties -> Framework and References -> Add new Reference -> CML).

6. Your project will depend of CMLTaucs that depends on CML and taucs. And finally, taucs depend on clapack, blas and libf2c (all these libraries come precompiled along with TAUCS package, no need to build them again!). So make sure you add all the linker information to the corresponding projects (Project Property pages -> Linker -> Input -> Additional Dependencies). If you see any linking errors while building - probably something is off with this step.

If you're stuck with compiling the project, feel free to post the question in the google group.

7. In your plugin, now you can use the solver. This is an approximate example how to do it:

```
#include "CMLTaucs/CMLTaucs.h"
...

SparseMatrix A(3); //3 rows
Vector b(3);
for (int i=0; i < 3; i++)
b[i] = i+1;

A.add_plus(2,2,3.0);  //now our matrix is diag(1,2,3)

//SOLVE!
Vector X(3); //the solution
int res = CMLTaucs::linsolve_symmetric(A,b,X);

if (res != TAUCS_SUCCESS)
{
auto error = CMLTaucs::getErrorString(res);
//output error;
}

//and that's how you can do transposed matrices or multiply them
SparseMatrix Atranspose (A.nCols()), normalMatrix (A.nCols());
Atranspose.putTranspose(A);
normalMatrix.putMult(Atranspose,A);
```

Submission:

Send an email to Mikhail (bmpix@cs.ubc.ca) with the subject “DGP assign3” containing a zip file with your code. Submit your sources only – you must include the entire source-tree for your module.

Don't forget to include a README file explaining how to run your code.