added triangle intersection code