示例#1
0
/*************
 * DESCRIPTION:   Push a matrix
 * INPUT:         m     matrix
 * OUTPUT:        TRUE if ok else FALSE
 *************/
BOOL INVMATRIX_STACK::Push(MATRIX *m)
{
    STACK_ITEM *si;
    MATRIX mat;

    si = new STACK_ITEM;
    if(!si)
        return FALSE;
    si->m = *m;
    si->Insert((DLIST**)&root);

    mat.MultMat(&matrix,m);
    matrix = mat;

    return TRUE;
}
示例#2
0
/*************
 * DESCRIPTION:   Push a matrix at the end of the stack
 * INPUT:         m     matrix
 * OUTPUT:        TRUE if ok else FALSE
 *************/
BOOL MATRIX_STACK::PushEnd(MATRIX *m)
{
    STACK_ITEM *si;
    MATRIX tmp;

    si = new STACK_ITEM;
    if(!si)
        return FALSE;
    si->m = *m;

    si->Append((DLIST**)&root);

    si->matrix = *m;
    tmp.MultMat(&matrix, m);
    matrix = tmp;

    return TRUE;
}
示例#3
0
/*************
 * DESCRIPTION:   Pop a matrix
 * INPUT:         -
 * OUTPUT:        -
 *************/
void INVMATRIX_STACK::Pop()
{
    STACK_ITEM *si;
    MATRIX mat;

    if(!root)
        return;

    root->Remove((DLIST**)&root);

    matrix.IdentityMatrix();
    si = root;
    while(si)
    {
        mat.MultMat(&si->m,&matrix);
        matrix = mat;
        si = (STACK_ITEM*)si->GetNext();
    }
}