Ask Your Question

Revision history [back]

you could try squares.cpp.

you should be focused on

                // if cosines of all angles are small
                // (all angles are ~90 degree) then write quandrange
                // vertices to resultant sequence
                if( maxCosine < 0.3 )
                    squares.push_back(approx);

if you change it like below you will get your desired result.

                if( maxCosine < 1.2 )
                    squares.push_back(approx);