implemented self intersection