fixed and added segmentByTwoPoints