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 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.
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.