finds distance from corners to nearest segments
start implementing cover algorithm