Ejemplo n.º 1
0
void AffineTransformTestCase::Concat()
{
    wxAffineMatrix2D m1;
    m1.Set(wxMatrix2D(0.9, 0.4, -0.4, 0.9), wxPoint2DDouble(0.0, 0.0));
    wxAffineMatrix2D m2;
    m2.Set(wxMatrix2D(1.0, 0.0, 0.0, 1.0), wxPoint2DDouble(3.0, 5.0));
    m1.Concat(m2);

    wxMatrix2D m;
    wxPoint2DDouble p;
    m1.Get(&m, &p);

    const double delta = 0.01;
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.9, m.m_11, delta );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.4, m.m_12, delta );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( -0.4, m.m_21, delta );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.9, m.m_22, delta );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.7, p.m_x, delta );
    CPPUNIT_ASSERT_DOUBLES_EQUAL( 5.7, p.m_y, delta );
}
Ejemplo n.º 2
0
void AffineTransformTestCase::InvertMatrix()
{
    wxAffineMatrix2D matrix1;
    matrix1.Set(wxMatrix2D(2, 1, 1, 1), wxPoint2DDouble(1, 1));

    wxAffineMatrix2D matrix2(matrix1);

    matrix2.Invert();

    wxMatrix2D m;
    wxPoint2DDouble p;
    matrix2.Get(&m, &p);
    CPPUNIT_ASSERT_EQUAL( 1, (int)m.m_11 );
    CPPUNIT_ASSERT_EQUAL( -1, (int)m.m_12 );
    CPPUNIT_ASSERT_EQUAL( -1, (int)m.m_21 );
    CPPUNIT_ASSERT_EQUAL( 2, (int)m.m_22 );
    CPPUNIT_ASSERT_EQUAL( 0, (int)p.m_x );
    CPPUNIT_ASSERT_EQUAL( -1, (int)p.m_y );

    matrix2.Concat(matrix1);
    CPPUNIT_ASSERT( matrix2.IsIdentity() );
}
Ejemplo n.º 3
0
wxMatrix2D wxMatrix2D::SubCols(int start_col, int end_col) const
{
    wxCHECK_MSG(Ok(), wxMatrix2D(), wxT("Invalid wxMatrix2D"));
    return SubMatrix(wxRect(start_col, 0, end_col-start_col+1, M_MATRIXDATA->m_height));
}
Ejemplo n.º 4
0
wxMatrix2D wxMatrix2D::SubRows(int start_row, int end_row) const
{
    wxCHECK_MSG(Ok(), wxMatrix2D(), wxT("Invalid wxMatrix2D"));
    return SubMatrix(wxRect(0, start_row, M_MATRIXDATA->m_width, end_row-start_row+1));
}