PyGeM

Tutorial 3: Radial Basis Functions interpolation technique on a cube

In this tutorial we will show how to use the Radial Basis Functions interpolation technique to deform a cube.

First of all we import the required PyGeM class, we import numpy and we set matplotlib for the notebook.

Using RBF, we can control the deformation by arranging some control points around the object to deform, then moving these latter to induce the morphing. Within PyGeM, the setting of such parameters can be done by parsing an input text file or manually touching the RBF attributes.

Let's try togheter by using an input file: the first step is the creation of the new object. After this, we can use the read_parameters to set the parameters.

The following is the parameters file for this particular case. The Radial Basis Functions section describes the basis functions to use. Here we use Gaussian splines with the distance parameter equal to 0.5 (see the documentation of the RBF class for more details). As control points we consider the 8 vertices of the cube (the first one is not exactly the vertex), and we move 3 of them. In the Control points section there are all the coordinates of the control points.

Here we create a $10 \times10 \times 10$ lattice to mimic a cube.

Now we plot the points to see what we are doing.

We can also plot the original control points and the deformed ones.

Finally we perform the RBF interpolation using the RBF class.

We can plot the new points in order to see the deformation. Try different basis functions and radius to better fit your specific problem.