segment_in_rectangle add with tests