Solving a triangle with the law of cosines