calculate edge crossing