improve rectangle/polygon collision check