/// <summary>
        ///  Calculates the row and column of a triangle with the specified vertices.
        /// </summary>
        /// <remarks>
        ///  This is done based on the diagram, that among the three distinct pairs of a triangle vertices,
        ///  the two pairs will either have the same x or y coordinate.
        /// </remarks>
        /// <param name="vertices">The vertices of the triangle.</param>
        /// <returns>
        ///  Returns a Triangle object with row and column.
        ///</returns>
        public Triangle CalculateRowAndColumn(int[,] vertices)
        {
            int i = 0;
            var triangle = new Triangle(vertices);

            // if the first two vertices have different x and y coordinates, swap the first
            // with the last coordinate. That will make the initial vertex the right angle vertex.
            if (!triangle.HaveSameXCoordinates(i, i + 1) &&
                !triangle.HaveSameYCoordinates(i, i + 1))
                triangle.Swap(i, i + 2);

            // check the x and y coordinates again, if it doesn't validate throw an exception
            // because based on the diagram, the row must be parallel to the y-axis and the column
            // must be parallel to the x-axis.
            if (!triangle.HaveSameXCoordinates(i, i + 1) &&
                !triangle.HaveSameYCoordinates(i, i + 1))
                throw new Exception ("Vertices are not in the right format.");

            for (int j = 1; j < triangle.Length; j++)
            {
                if (triangle.HaveSameXCoordinates(i, j))
                    triangle.Row = Math.Abs(
                        triangle.Vertices[j, 1] - triangle.Vertices[i, 1]);
                else
                    triangle.Column = Math.Abs(
                        triangle.Vertices[j, 0] - triangle.Vertices[i, 0]);
            }

            return triangle;
        }