matrixbase::FlipVertical

Contents

Description

Vertically flips this matrixbase derived object.

Syntax

BOOL FlipVertical( )

Parameters

Return

Returns TRUE on success and FALSE on failure.

Examples

EX1

void matrixbase_FlipVertical_ex1()
{
   matrix<double> mat1 = {
        {1,  1,  1,  1},
        {2,  4,  6,  8},
        {3,  6,  9, 12}
    };
    MatrixPage MatPg1;
    MatPg1.Create("Origin");
    MatrixLayer MatLy1 = MatPg1.Layers(0);
    Matrix Mat1(MatLy1);
    Mat1 = mat1;
    printf("  The original matrix is %s.\n",Mat1.GetName());
    
    matrix mat2(mat1);  // Create mat2, and copy mat1 to mat2
    
    int rc=mat2.FlipVertical( ); // Demonstrate FlipVertical
    if(!rc) printf("Error: FlipVertical on a matrix failed.\n");
    else
    {
        MatrixPage MatPg2;
        MatPg2.Create("Origin");
        MatrixLayer MatLy2 = MatPg2.Layers(0);
        Matrix Mat2(MatLy2);
        Mat2 = mat2;
        printf("  Observe the vertically flipped matrix in %s.\n",
          Mat2.GetName());
    }
}

Remark

Vertically flips this matrixbase derived object about a horizontal axis through the center of the matrix.

See Also

matrixbase::FlipHorizontal, matrixbase::Rotate, matrixbase::Reorder, matrixbase::Transpose

header to Include

origin.h