Measuring Similarity of Geometrical Shapes I am looking for methods (numerical measures actually) to determine how similar rectangles are to squares. Given a set of different rectangles, I need to find a few numerical measures that will sort the rectangles by their similarity to squares. One trivial method is the ratio between the vertices of the rectangle. If the ratio is 1, it is a square, and the closer it is to 1, the closer it is to a square. The characteristic that makes it a good measure, is that for similar rectangles, I will get the same score. I want to ask you to advice me with other alternative measures, that will keep the similarity characteristic (it can involve diagonals, angles, etc,...). In addition, I wanted to ask if such a measure exist that will allow to sort a general parallelogram by how close it is to a square. Thank you in advance.
 A: Some measures for rectangles:


*

*(the one you have already mentioned) the ratio of sides lengths, $a/b$;

*(big) angle between diagonals, $\pi/2$ means perfect square, the bigger the measure, the less square the rectangle is (or any function of the angle);

*difference of lengths of sides divided by their sum (half perimeter), $\frac{|a-b|}{a+b}$, zero means perfect square, the bigger the number, the less square the rectangle is,

*area divided by area of the square with the same perimeter, $\frac{a\cdot b}{(a/2+b/2)^2}$, one means perfect square, the smaller this measure is, the less square rectangle you have (you can also invert it), observe that in fact this measure is the square of geometric mean divided by arithmetic mean;

*(just to show you can do the same with other means), $\frac{\sqrt{a^2/2+b^2/2}}{\frac{2}{a^{-1}+b^{-1}}} = \frac{a+b}{2ab}\cdot\sqrt{a^2/2+b^2/2}$.


Please note, that all these measures are invariant to scaling.
For example, given some measure you can construct a rectangle with the given measure (and, say, constant perimeter).
In particular, for any above measure, that measure is the same for some two rectangles if and only if they are similar.
Also, if you were given a one measure, you can calculate all others, so 
all above measure give the very same ordering of rectangles (modulo ascending/descending direction).
As for parallelograms, things are more complicated, because you have now two degrees of freedom (ratio of sides and the angle between sides). Which one is more important to you? Imagine two quadrilaterals: a rhombus and a rectangle, each only slightly off. Which one is more square? We can find a measure such that all similar parallelograms have same measure, but there will be two non-similar parallelograms with the same measures.
Thus, let $\lambda \in [0,1]$ be a parameter which says what is more important to you, the difference between sides, or how right-angled it is (let's assume that $\lambda = 0$ means the sides ratio is the most important and the angle is irrelevant). Thus, for any two similarity measures $\mu_\mathrm{sides}, \mu_\mathrm{angle}$ with same base (i.e., whether perfect square is at $0$ or $1$, etc.) and direction (i.e., whether bigger measure means more or less square) you can take $$\lambda\cdot\mu_\mathrm{sides} + (1-\lambda)\cdot\mu_\mathrm{angle}.$$ To give you some measures for the $\mu_\mathrm{angle}$, you can use angle between sides (or some function of it), or just any of the above with the lengths of diagonals instead of lengths of sides. Combining the two, here are some concrete examples:


*

*$\lambda\cdot\delta + (1-\lambda)\cdot\alpha$ where $\delta$ is the bigger angle between diagonals and $\alpha$ is the bigger angle between sides, $\pi/2$ for a perfect square;

*$\lambda\cdot\frac{(a/2 + b/2)^2}{a\cdot b} + (1-\lambda)\cdot\frac{\max(d_1,d_2)}{\min(d_1,d_2)}$ where $d_1$ and $d_2$ are the lengths of the diagonals.


Please remember that combining the two measures will work well only if the "perfect square" value is the same, and they have roughly the same scale. Unless you know exactly what are you doing, do not join ranges like $(0,1)$ and $(1,\infty)$ together in this way (you can always use some transformations like $\exp$, $\tanh$, $\arctan$, $\frac{1}{x}$, $\frac{1}{1+x}$, etc.).
I hope this helps $\ddot\smile$
Edit: Sorry for the late edit, got interrupted.
A: 
determine how similar rectangles are to squares

You'll need to quantify how you measure how similar in order to compare any "similarity scores".
For an example, let $S$ be the area of an arbitrary quadrilateral, $p$ be its perimeter, and $a=p/4$ be the average of side lengths. Then $q = S / a^2$ will be maximized for a square with a value of $q=1\,$. Also, the "score" $q$ will be the same between similar rectangles, and in fact between any similar quadrilaterals. However, this is but one way to quantify "closeness to square" between dissimilar rectangles, rhombi, parallelograms etc, so it is only one possible answer among many others.
