What motivates my question is how can I turn a triangle into a square (or vice versa) using operations like folding/unfolding and stretching/shrinking. As shown in this figure it is not an unique solution problem. Now I am looking for a way to solve it mathematically (and ultimately computationally).
The question could actually be expanded as: "How to mathematically express the difference between two skeleton shapes"
Thanks in advance.
As said in the comments, it is not at all clear what you are after.
A closed piece-wise linear curve (a term-of-art for your "skeletal shape") can be identified by the lengths of the segments and the angles between them. So a square has four segments of equal length, with 90 degree angles, while a triangle has 3 segments (regardless of lengths or angles - though not all lengths and angles that can be specified will result in a triangle). So a square has signature $(s,90,s,90,s,90,s)$ (last angle is deducible geometrictly from the requirement that the figure be closed). A triangle has signature $(x,\alpha, y,\beta,z)$ while satisfying $x + y <z, x+z <y, y+z <x, \alpha+ \beta <180$.
More generally, any two figures could be compared by these signatures. However, I don't see how such a description - which answers the question asked - would be helpful for the goal you indicate.