performence improvment to triangle2d