fix, do not handle 0 length
added Seg2d