better triangle computation