grainBoundary.calcMeanDirection edit page

compute a smoothed direction that ignores staircasing

Description

This is very similar to direction with the only difference that it takes the direction across 2*n+1 segments instead of across a single one, which averages out the staircasing of a pixel grid. The window runs along the chain and is clamped at its ends, so it never smears across a junction.

Syntax

dir = calcMeanDirection(gB)
dir = calcMeanDirection(gB,2)

Input

gB grainBoundary
n number of neighboring segments considered on each side

Output

dir vector3d

See also

grainBoundary.direction grainBoundary.chainId