示例#1
0
bool wxMatrix2D::IsEqual(const wxMatrix2D& matrix) const
{
    if (!Ok() || !matrix.Ok()) return false;
    if (GetSize() != matrix.GetSize()) return false;

    return memcmp(M_MATRIXDATA->m_data, matrix.GetData(),
                  M_MATRIXDATA->m_width*M_MATRIXDATA->m_height*sizeof(double)) == 0;
}
示例#2
0
wxMatrix2D wxMatrix2D::MultElement(const wxMatrix2D &B) const
{
    wxMatrix2D temp;
    wxCHECK_MSG(Ok() && B.Ok(), temp, wxT("Invalid matrix"));
    wxCHECK_MSG(GetSize() == B.GetSize(), temp, wxT("Invalid matrix dimensions"));

    int i, size = M_MATRIXDATA->m_width * M_MATRIXDATA->m_height;

    if (!temp.Create(M_MATRIXDATA->m_width, M_MATRIXDATA->m_height, false))
        return temp;

    double *data      = GetData();
    double *b_data    = B.GetData();
    double *temp_data = temp.GetData();

    for (i = 0; i < size; ++i)
        *temp_data++ = (*data++) * (*b_data++);

    return temp;
}