shape_morph
Creates a vertex interpolation between a base solid and one or more variant shapes.
Signatures
- shape_morph( solid base, solid variant1, float fraction1, ... )
Details
The shape_morph function creates a geometric interpolation between each vertex of the base mesh and its counterparts in the variant meshes. The technique is also known as morph target animation. The base solid and all its variants need to be isomorphic meshes. The fraction specifiers must be in the range [0,1] and defines the amount each variant is blended into the result. The base variant will be selected if all variants fractions are set to 0 and a pure variant is selected if it has a fractional value of 1 while all others of have a fraction 0.
Example
float d = 4.0
float e = 8
float f = 1
solid a = sphere( d )
solid b = boxwarp( <[-d, -d, -d]>, <[+d, -d, -d]>, <[-d, +d, -d]>, <[-d, -d, +d]>,
<[-f, -f, -d]>, <[+f, -f, -d]>, <[+f, +f, -d]>, <[-f, +f, -d]>,
<[-e, -e, +d]>, <[+e, -e, +d]>, <[+e, +e, +d]>, <[-e, +e, +d]> ) >> a
solid c = scaling( 0.7, 1.0, 1.5 ) >> a
for( int i = 0; i <= 3; ++i )
for( int j = 0; j <= 3; ++j )
make translation( <[i * 12.0, 0.0, j * 12.0]> ) >>
shape_morph( a, b, (float) i/3, c, (float) j/3 )
Parameters
- base
-
A solid that is the base shape of the shape morphing.
- variantX
-
A solid that is a geometric variation of the base shape. It needs to be isomorphic to the base shape.
- fractionX
-
A fractional value in the range [0,1] that determines the amount the particular variant is blended into the final result. A value of 0 means that the variant is not taken into account at all. A value 1 means that it is fully taken into account.
Return value
A solid object that is the interpolation of the different input solids.