src/ptafunc1.c
l_int32
ptaTestIntersection(PTA  *pta1,
                    PTA  *pta2)
{
l_int32  i, j, n1, n2, x1, y1, x2, y2;

    PROCNAME("ptaTestIntersection");

    if (!pta1)
        return ERROR_INT("pta1 not defined", procName, 0);
    if (!pta2)
        return ERROR_INT("pta2 not defined", procName, 0);

    n1 = ptaGetCount(pta1);
    n2 = ptaGetCount(pta2);
    for (i = 0; i < n1; i++) {
        ptaGetIPt(pta1, i, &x1, &y1);
        for (j = 0; j < n2; j++) {
            ptaGetIPt(pta2, i, &x2, &y2);
            if (x1 == x2 && y1 == y2)
                return 1;
        }
    }

    return 0;
}
/*!
 *  ptaTestIntersection()
 *
 *      Input:  pta1, pta2
 *      Return: bval which is 1 if they have any elements in common;
 *              0 otherwise or on error.
 */
ptaTestIntersection()
Input:  pta1, pta2
Return: bval which is 1 if they have any elements in common;
0 otherwise or on error.
ptaTestIntersection () Input : pta1 pta2 Return : bval which is 1 if they have any elements in common ; 0 otherwise or on error .
l_int32
ptaTestIntersection(PTA  *pta1,
                    PTA  *pta2)
{
l_int32  i, j, n1, n2, x1, y1, x2, y2;
    PROCNAME("ptaTestIntersection");
    if (!pta1)
        return ERROR_INT("pta1 not defined", procName, 0);
    if (!pta2)
        return ERROR_INT("pta2 not defined", procName, 0);
    n1 = ptaGetCount(pta1);
    n2 = ptaGetCount(pta2);
    for (i = 0; i < n1; i++) {
        ptaGetIPt(pta1, i, &x1, &y1);
        for (j = 0; j < n2; j++) {
            ptaGetIPt(pta2, i, &x2, &y2);
            if (x1 == x2 && y1 == y2)
                return 1;
        }
    }
    return 0;
}
l_int32 ptaTestIntersection ( PTA * pta1 , PTA * pta2 ) { l_int32 i , j , n1 , n2 , x1 , y1 , x2 , y2 ; PROCNAME ( " " ) ; if ( ! pta1 ) return ERROR_INT ( " " , procName , 0 ) ; if ( ! pta2 ) return ERROR_INT ( " " , procName , 0 ) ; n1 = ptaGetCount ( pta1 ) ; n2 = ptaGetCount ( pta2 ) ; for ( i = 0 ; i < n1 ; i ++ ) { ptaGetIPt ( pta1 , i , & x1 , & y1 ) ; for ( j = 0 ; j < n2 ; j ++ ) { ptaGetIPt ( pta2 , i , & x2 , & y2 ) ; if ( x1 == x2 && y1 == y2 ) return 1 ; } } return 0 ; }
ptaTestIntersection()
      Input:  pta1, pta2
      Return: bval which is 1 if they have any elements in common;
              0 otherwise or on error.
ptaTestIntersection () Input : pta1 pta2 Return : bval which is 1 if they have any elements in common ; 0 otherwise or on error .