MATLAB Function Reference
shrinkfaces

Reduce the size of patch faces

Syntax

• ```shrinkfaces(p,sf)
nfv = shrinkfaces(p,sf)
nfv = shrinkfaces(fv,sf)
shrinkfaces(p), shrinkfaces(fv)
nfv = shrinkfaces(f,v,sf)
[nf,nv] = shrinkfaces(...)
```

Description

`shrinkfaces(p,sf)` shrinks the area of the faces in patch `p` to shrink factor `sf`. A shrink factor of 0.6 shrinks each face to 60% of its original area. If the patch contains shared vertices, MATLAB creates nonshared vertices before performing the face-area reduction.

`nfv = shrinkfaces(p,sf)` returns the face and vertex data in the struct `nfv`, but does not set the `Faces` and `Vertices` properties of patch `p`.

`nfv = shrinkfaces(fv,sf)` uses the face and vertex data from the struct `fv`.

`shrinkfaces(p)` and `shrinkfaces(fv)` (without specifying a shrink factor) assume a shrink factor of 0.3.

`nfv = shrinkfaces(f,v,sf)` uses the face and vertex data from the arrays `f` and `v`.

`[nf,nv] = shrinkfaces(...)` returns the face and vertex data in two separate arrays instead of a struct.

Examples

This example uses the flow data set, which represents the speed profile of a submerged jet within a infinite tank (type `help` `flow` for more information). Two isosurfaces provide a before and after view of the effects of shrinking the face size.

• First `reducevolume` samples the flow data at every other point and then `isosurface` generates the faces and vertices data.
• The `patch` command accepts the face/vertex struct and draws the first (`p1`) isosurface.
• Use the `daspect`, `view`, and `axis` commands to set up the view and then add a `title`.
• The `shrinkfaces` command modifies the face/vertex data and passes it directly to `patch`.
• ```[x,y,z,v] = flow;
[x,y,z,v] = reducevolume(x,y,z,v,2);
fv = isosurface(x,y,z,v,-3);
p1 = patch(fv);
set(p1,'FaceColor','red','EdgeColor',[.5,.5,.5]);
daspect([1 1 1]); view(3); axis tight
title('Original')

figure
p2 = patch(shrinkfaces(fv,.3));
set(p2,'FaceColor','red','EdgeColor',[.5,.5,.5]);
daspect([1 1 1]); view(3); axis tight
title('After Shrinking')
```

`isosurface`, `patch`, `reducevolume`, `daspect`, `view`, `axis`