Accord.Tests.Math.SimpleShapeCheckerTest.CompareShape C# (CSharp) Method

CompareShape() private method

private CompareShape ( List shape1, List shape2 ) : bool
shape1 List
shape2 List
return bool
        private bool CompareShape( List<IntPoint> shape1, List<IntPoint> shape2 )
        {
            if ( shape1.Count != shape2.Count )
                return false;
            if ( shape1.Count == 0 )
                return true;

            int index = shape1.IndexOf( shape2[0] );

            if ( index == -1 )
                return false;

            index++;

            for ( int i = 1; i < shape2.Count; i++, index++ )
            {
                if ( index >= shape1.Count )
                    index = 0;

                if ( !shape1[index].Equals( shape2[i] ) )
                    return false;
            }

            return true;
        }