reducepatch
Reduces the number of faces of a patch while trying to keep its shape.
Category: Graphics > 2-D and 3-D Plots
Syntax
fv = reducepatch(fv0, r)
Returns a patch structure with about the fraction r of the faces of fv0.
reducepatch(p, r)
Reduces the patch with handle p in place.
[f, v] = reducepatch(F, V, r)
Works on separate face and vertex arrays.
Description
Large isosurfaces can have hundreds of thousands of triangles and be slow to draw. reducepatch merges them, mostly in flat regions, so the picture looks much the same with far fewer faces. The result is an approximation: the number of faces obtained can be somewhat different from the requested one.
Input arguments
fv0- Structure with
facesandvertices, such as the output ofisosurface. r- Target fraction of faces if between 0 and 1, or a target number of faces if greater than 1.
Output arguments
fv- Structure with the reduced
facesandvertices.
Example
Halve an isosurface
[x, y, z] = meshgrid(-1:0.25:1);
v = x.^2 + y.^2 + z.^2;
fv = isosurface(x, y, z, v, 0.5);
r = reducepatch(fv, 0.5);
size(r.faces, 1) < size(fv.faces, 1)
Output
ans = logical
1