# Spring Model

This is an example of mesh generation using AngioTK.

## 1. How does it work

Using very simple geometric description of the shape of the mesh we want to produce, AngioTK can produce a tubular structure mesh.

### 1.1. Geometry file

We start with a geometry file: `spring.geo`. This file is a Gmsh script that defines the spring skeleton as a chain of line segments:

### 1.2. Center line computing

AngioTK uses this chain of line segments to generate a center line, which is equipped with a radius. This means each point of the center line has an associated scalar value which describes the radius of the final tubular structure at this point. This radius is defined in a configuration file named `centerlinesmanager.cfg`

### 1.3. 3D Image generation

Using the center line, AngioTK now builds a 3D image. This 3D image corresponds to a discretized volume in which the exterior and the interior of the final mesh are marked:

### 1.4. Surface extraction

Now, AngioTK applies image segmentation algorithms to the 3D image to extract the surface of the final mesh.

### 1.5. Surface remeshing

AngioTK calls Gmsh to remesh the surface, cut and open its ends.

### 1.6. Volume meshing

AngioTK meshes the volume using the remeshed surface.

 The color of the faces is here to indicate distinct surfaces. This will be used to impose boundary conditions to perform numerical simulations.

## 2. Generating the full mesh

``sh runpipeline.sh --angiotk <location of {angiotk} executables> --cfg <location of {angiotk} config files>``
 Both arguments are optional. By default, AngioTK executables are supposed to be in `/usr/local/bin`, and the configuration files are looked for in your current directory.

### 2.1. In Docker

In Docker, AngioTK executables are all in `usr/local/bin` - so you don’t need the `--angiotk` argument - and the results of the pipeline are stored in `/feel/angiotk/spring`.

This means generating the mesh is very easy:

``````$git clone https://github.com/feelpp/angiotk #$ cd angiotk/docs/modules/centerlines/examples/spring
\$ ./``````