Skip to content
Asger edited this page Sep 10, 2013 · 14 revisions

To use the DSC method, simply follow these few steps:

Step 1: Setup

It is recommended to use the setup provided in the DEMO folder (the demo.cpp, user_interface.h, user_interface.cpp and draw.h source files). However, if you want another setup, you can use the default setup as starting point.

Step 2: Create your own velocity function class

Create a your own velocity function class which extends the VelocityFunc class. This class should as minimum override the get_name() and deform() functions. The get_name() function should return a string with the name of the velocity function and the deform() function should have the following signature:

  • For each interface node **n** in the dsc
    
    •   Calculate a new position **p** according to the velocity function
      
    •   Call _set_destination_( **n**, **p** )
      
  • Call _deform_()
    

Three examples of velocity functions can be found in the repository in the DEMO folder: A rotation function (rotate_function.h), a function which smooths the model (average_function.h) and a function which moves the interface in the normal direction (normal_function.h).

Step 3: Create a new initialisation function

Three default initialisation functions are provided with the DEMO application (rotate_cube(), smooth_armadillo() and expand_armadillo()). Use these as your starting point when creating a new initialisation function. An initialisation function should contain the following:

  • Call the stop() function.
  • Construct (using the Tetralizer class) or import (using the import_tet_mesh() function) a model.
  • Construct a new instance of the DeformableSimplicialComplex class.
  • Construct a new instance of a velocity function class (for example the one created in step 2).
  • Construct a new instance of the Log class.
  • Call update_title() and reshape() functions.

Note: You have to add the initialisation function to the switch in the keyboard() function to be able to call it.

Step 4 (optional): Change the DSC parameters

When the DeformableSimplicialComplex object is constructed, several parameters are set to control the min/max edge length, min/max angle etc. of the simplicial complex. You can change these parameters by extending the DeformableSimplicialComplex class and override the constructor.

Clone this wiki locally