EulerCharacteristic.jl
computes Euler characteristic of objects defined on
two- or three dimensional regular grid (FIXME: elaborate on this).
According to this and
this
articles, the Euler characteristic for a closed surface is defined as χ = 2 - 2g
where g
is genus of that surface. For a surface with boundary this
formula becomes χ = 2 - 2g - b
where b
is a number of connected components
of the boundary. For a surface embedded in three-dimensional space plus its
interior the Euler characteristic is equal to half of the Euler characteristic
of that surface.
Here are some examples of Euler characteristic:
There is euler_characteristic
function in the package which takes a binary
array and returns Euler characteristic. The value true
counts as a vertex.
There is also EulerTracker
type which is a subtype of AbstractArray
and
allows for fast recalculation of Euler characteristic when an element of
EulerTracker
is changed.