add algorithm for detecting crossing