Enfolding and Infolding
For some applications it is useful to adapt a predefined solid to another one by "pressing" it onto the second solid's surface. In the medical area, for example, this could be an orthosis that is adapted to the scan of a limb of a patient to get a high-quality fit. Such an operation can be achieved with the help of the enfold function and its inverse counterpart, the infold function.
The basic concept of the enfold function is this: wrap or press one object A onto the surface of another object B (or a group of objects B) while preserving the thickness and small details of A. This has some similarities to pressing a clay model onto a rigid one or to a physical vacuum forming process.
Movement Modes
Several options exist for controlling the movement of A on the enfold operation. The first one is to define a fixed direction by providing a vector as function argument. All parts of solid A are then translated into this direction until they get blocked by object B. Note that a movement into the opposite direction is applied by the infold function.
A second option is to use a cynosure object (or object group). This is a set of space points or curves that act as center of attraction for A in case of the enfold function and as center of repulsion in case of the infold operation.
The cynosure object or object group is handed over to the enfold/infold function in form of a curve object. This can either be a point or a general curve in space:
Example
curve c1 = <[0,6,2]>
curve c2 = <[-1,2,0]> -> line_to( <[0,3,-2]> )
If a set of cynosure curve is used, the curves are handed over as an array to the enfold or infold functions:
Example
make enfold( a, b, [c1, c2] )
Solid A
Solid A is the object that is moved and deformed in order to create the result of the enfold or infold operations. There are no specific requirements for A other than that its size and position must be adequate to allow the requested movement. The operation only modifies the positions of vertices of the fundamental mesh of A and is thus isomorphic.
Note that the enfold and infold operations are designed to exhibit a certain robustness agains the positioning of solid A with respect to solid B in the sense that A may intersect with B slightly.
Filtering
In addition to the bare operations, some tuning parameters can be set to the enfold and infold function. The first one activates the filter feature that effectively implements a low-pass filter that simulates a certain "stiffness" of the material of A. The governing parameter is the filter length. In terms of stiffness, this parameter corresponds to the effective bending radius of the surface of A. Note that this correspondence matches best if edges of the triangle mesh representing A have more or less equal lengths.
Note
Large filter length values may lead to longer execution times.
"Strict" Mode and Offset
One side effect of applying a low-pass filter might be that the result intersects with B due to the stiffness applied. This can be countered by activating strict mode. This ensures that all vertices of the mesh of A are effectively driven out of B (see figure).
In addition, an offset can be applied that shifts all vertices of the mesh of A by the respective factor. This offset value may be positive (moving vertices of A away from B) or negative (moving them into B).
Tips and Tricks
Despite its apparently simple nature, the enfold and infold functions obtain sufficient subtleties that might make it hard to reach a desired shape on the first try. However there are a number of practices that may help to handle the operations better and obtain optimal results.
Subdivision of A
The enfold and infold functions are isomorphic operations acting on the mesh representation of solid A by moving its vertices only. No additional triangles or vertices are added. Starting with a mesh A of low resolution might end up in poor results. This accounts for other morphing operations like bending or helix as well. The solution is in such a case to increase the mesh resolution of A sufficiently high, e.g. by applying the subdiv modifier.
Centering Cynosure
In a configuration where A is meant to wrap around an inner object B, the cynosure should be well centered inside B. Otherwise some streching effects might occur on the result (see figure). If B exhibits a less trivial shape, it may be useful to add more than one cynosure and form a central structure that guides all surface areas of A harmonically towards the surface of B.
Approaching Surface of B
The option to use multiple cynosures in an enfold or infold operation suggests to pay some attention to the movement of a single surface points of A under such circumstances. The following sketch depicts the movement of different points of A in the proximity of two cynosure elements. As one can see, point A3 does not propagate towards any of the cynosures since it is situated on the central line of C1 and C2. This configuration can be compared to a slingshot setup. This effect can lead to unwanted behavior, if A is located at such a position.
Adding a Protection Sheet
As stated earlier, one problem that may occur is the collaps of steep edges of A towards B due to a slightly tilted movement direction. This may result in notched borders of the resulting solid as shown in the example below for a hole pattern structure.
There are several options when this problem occurs. One option is to apply a low-pass filter. Another solution might be to reshape the model A in way that the respective edges exhibit tilted slopes instead of straight ones.
Apply Smoothing
Sometimes none of the approaches presented before leads to an optimal result. In such cases there is the option to use a smoothing operation (i.e. smoothing(0.0, 50)) and see whether is improves the shape any further.