To calculate the size of the setting triangles for the border you can go to this website
http://www.ctpubblog.com/2010/08/03/...ing-triangles/
They give a fairly simple explanation.
For those who wonder why they are using 1.414, it's because that is the approximate square root of 2. The length of the diagonal of a square is the length of one of its sides multiplied by the square root of two. This is all based on the Pythagorean Theorem.