|
1 | 1 | """ |
2 | 2 | Utilities for performing Free Form Deformation (FFD) |
| 3 | +
|
| 4 | +:Theoretical Insight: |
| 5 | +
|
| 6 | + Free Form Deformation is a technique for the efficient, smooth and accurate geometrical |
| 7 | + parametrization. It has been proposed the first time in *Sederberg, Thomas W., and Scott |
| 8 | + R. Parry. "Free-form deformation of solid geometric models." ACM SIGGRAPH computer |
| 9 | + graphics 20.4 (1986): 151-160*. It consists in three different step: |
| 10 | + |
| 11 | + - Mapping the physical domain to the reference one with map :math:`\\boldsymbol{\psi}`. |
| 12 | + In the code it is named *transformation*. |
| 13 | + |
| 14 | + - Moving some control points to deform the lattice with :math:`\\hat{T}`. |
| 15 | + The movement of the control points is basically the weight (or displacement) |
| 16 | + :math:`\\boldsymbol{\mu}` we set in the *parameters file*. |
| 17 | + |
| 18 | + - Mapping back to the physical domain with map :math:`\\boldsymbol{\psi}^-1`. |
| 19 | + In the code it is named *inverse_transformation*. |
| 20 | + |
| 21 | + FFD map (:math:`T`) is the composition of the three maps, that is |
| 22 | + |
| 23 | + .. math:: |
| 24 | + T(\\cdot, \\boldsymbol{\\mu}) = (\\Psi^{-1} \\circ \\hat{T} \\circ \\Psi) |
| 25 | + (\\cdot, \\boldsymbol{\\mu}) |
| 26 | + |
| 27 | + In this way, every point inside the FFD box changes it position according to |
| 28 | + |
| 29 | + .. math:: |
| 30 | + \\boldsymbol{P} = \\boldsymbol{\psi}^-1 \\left( \\sum_{l=0} ^L \\sum_{m=0} ^M |
| 31 | + \\sum_{n=0} ^N \\mathsf{b}_{lmn}(\\boldsymbol{\\psi}(\\boldsymbol{P}_0)) |
| 32 | + \\boldsymbol{\\mu}_{lmn} \\right) |
| 33 | + |
| 34 | + where :math:`\\mathsf{b}_{lmn}` are Bernstein polynomials. |
| 35 | + We improve the traditional version by allowing a rotation of the FFD lattice in order |
| 36 | + to give more flexibility to the tool. |
| 37 | + |
| 38 | + You can try to add more shapes to the lattice to allow more and more involved transformations. |
| 39 | +
|
3 | 40 | """ |
4 | 41 | import numpy as np |
5 | 42 | from scipy import special |
@@ -31,6 +68,7 @@ class FFD(object): |
31 | 68 | >>> free_form = ffd.FFD(ffd_parameters, original_mesh_points) |
32 | 69 | >>> free_form.perform() |
33 | 70 | >>> new_mesh_points = free_form.modified_mesh_points |
| 71 | + |
34 | 72 | """ |
35 | 73 | def __init__(self, ffd_parameters, original_mesh_points): |
36 | 74 | self.parameters = ffd_parameters |
|
0 commit comments