working is how to calculate a triangle