grainBoundary.simplify edit page

remove vertices that carry no shape information

Description

Douglas-Peucker simplification applied to each chain separately. A vertex is dropped if removing it moves the boundary by less than epsilon. The junctions are the ends of the chains and are always kept, so which grains touch, and where, is unchanged.

Unlike reduce, which keeps every n-th vertex regardless of shape, this removes many vertices along a straight run and none at a corner. On a pixel grid it is what turns a staircase into the straight line it approximates.

A grain smaller than epsilon would lose every one of its vertices and collapse onto a line. Those grains are left uncoarsened - epsilon says how far the boundary may move, not that a grain may be deleted.

Syntax

gB_s = simplify(gB)
gB_s = simplify(gB,epsilon)
gB_s = simplify(gB,epsilon,'protect',vertexIds)

Input

gB grainBoundary
epsilon tolerance in EBSD units (default: the median segment length over sqrt(2) - a staircase on a grid of spacing d is never further than d/sqrt(2) from the straight line it approximates, the worst case being a boundary at 45 degree, so that is the tolerance which removes the grid and nothing else. At d/2 a 45 degree staircase does not collapse)

Output

gB_s grainBoundary

Options

protect ids of vertices that must survive, on top of the junctions

See also

grainBoundary.reduce grainBoundary.refine grain2d.simplifyBoundary grain2d.smoothBoundary