Feature/num segments

New algorithm `num_segments`: calculates the number of segments in a geometry.

It is similar to the `num_points` algorithm and has, naturally, similar interface.