checks validity of a triangle
checks validity of triangle