added triangle clipping