2.2.3.9.21 matrixbase::FlipHorizontal

Description

Horizontally flips this matrixbase derived object.

Syntax

BOOL FlipHorizontal( )

Parameters

Return

Returns TRUE on success and FALSE on failure.

Examples

EX1

void matrixbase_FlipHorizontal_ex1()
{
    BOOL rc;

    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
    rc=mat2.FlipHorizontal( ); 
    //Get mat2={ { 1, 1, 1, 1},
    //           { 8, 6, 4, 2},
    //           {12, 9, 6, 3} }
    if(!rc) printf("Error: FlipHorizontal on a matrix failed.\n");
    else
    {
        MatrixPage MatPg2;
        MatPg2.Create("Origin");
        MatrixLayer MatLy2 = MatPg2.Layers(0);
        Matrix Mat2(MatLy2);
        Mat2 = mat2;
        printf("  Observe the horizonally flipped matrix in %s.\n",
          Mat2.GetName());
    }
}

Remark

Horizontally flips this matrixbase derived object about a vertical axis through the center of the matrix.

See Also

matrixbase::FlipVertical, matrixbase::Rotate, matrixbase::Reorder, matrixbase::Transpose

Header to Include

origin.h