Version 0.55.1

enfold

Enfolds one solid with another.

Signatures

  •   enfold( solid bodyA, solid bodyB, vector dir )
  •   enfold( solid bodyA, solid bodyB, vector dir, float filterLen, bool strict, float offset )
  •   enfold( solid bodyA, solid bodyB[], vector dir )
  •   enfold( solid bodyA, solid bodyB[], vector dir, float filterLen, bool strict, float offset )
  •   enfold( solid bodyA, solid bodyB, curve cynosure )
  •   enfold( solid bodyA, solid bodyB, curve cynosure, float filterLen, bool strict, float offset )
  •   enfold( solid bodyA, solid bodyB[], curve cynosure[] )
  •   enfold( solid bodyA, solid bodyB[], curve cynosure[], float filterLen, bool strict, float offset )

Details

The enfold function enfolds or wraps one or more solids bodyB with another bodyA plastically.

The movement of bodyA is defined either by a vector dir or by a cynosure object that acts as a source of attraction onto bodyA. Object bodyB is placed in the way of the movement trajectory of bodyA. The movement of bodyA is blocked by bodyB in a way that bodyA adapts to the shape of bodyB.

Example

 make enfold( mesh( "grid.stl" ),
              mesh( "surface.stl" ),
              <[ 5.0, 4.0, 0.0 ]> -> <[ 5.0, 4.0, 7.0 ]> )
 

The left side shows a curved surface and a grid structure solid. On the right side, the grid is enfolded onto the surface.

The result of the enfold function can be tuned with the filterLen, strict and offset parameters.

Setting the filterLen parameter to a value larger than zero applies a filter to the operation that increases the stiffness of the plastic deformation. The filterLen value acts similar to the full width half maximum (FWHM) of a Gaussian smoothing.

The effect of filterLen can be seen in the following example images.

The image shows the directional enfolding of a yellow rectangular object A on top of a group of other objects B with varying filterLen parameters (from left to right) of 0, 15, 30, 60 and 120. The strict value is set to true in all of the five examples.

The strict parameter determines whether the resulting shape of bodyA is allowed to partially enter into the space of bodyB or not. In some cases the result may be improved if this condition is relaxed.

The four images show different ways of application of the enfold function. The cynosures are drawn as black dashed lines and the resulting solids are labeled as A'. The image to the left shows the result of an enfold function without further modifications. In the second image a filtering is applied in strict mode to avoid the penetration of solid B. The third image shows the application of a filter with the strict parameter set to false. On the most right image, the effect of a positive offset value is displayed.

See also the description in the advanced construction section for this function.

Note

The resolution of bodyA (i.e. the number and size of triangles of its mesh representation) determines, how smooth the solid can be enfolded onto bodyB. The resolution can be increased with the subdiv modifier.

Note

bodyB should be "watertight" in the area of the enfolding. This can be checked with the member function has_holes() of data type solid and ensure with modifier fill_holes.

Return value

A solid that is created by enfolding bodyA onto bodyB.

Parameters

bodyA

Solid that is moved into direction dir or towards the cynosure until its movement is blocked by bodyB.

bodyB

Solid or array of solids that act as blockade in the trajectory of bodyA.

dir

Direction bodyA is moved into.

cynosure

Center of attraction for bodyA. This is either a curve or an array of curves. Note that it is possible to use curves that contain only one single points what results in a spherical attraction geometry.

filterLen

If this parameter is set to a positive value greater than zero, a filtering is applied to the operation that simulates a stiffness of the plastic deformation. The value of filterLen approximately defines the FWHM of this filter. In some cases filtering can highly improve the result of the operation. Note that filtering over larger ranges may increase calculation times significantly. Default value is 0.

strict

This boolean parameter allows to switch between two modes of filtering: if its value is true, a strict mode is enabled that hinders the filter to intrude into solid B. If the value is set to false, the result might overlap with bodyB in some areas but the overall result might be more appealing. Default value is false.

offset

Defines an offset length that is applied in addition to the morphing movement of the solid. By using this parameter it is possible to introduce a gap between the two bodies of this length (if offset is positive) or to let bodyA sink into bodyB (if offset is negative). Default value is 0.

See also

🗙

Search results for