Removed some duplicated code in triangle intersection