Solver for triangles.