implemented line clipping