enhanced and cleaned segment intersection tests and operations