/*******************************************************
 *
 * Author: Hirokazu Kato
 *
 *         kato@sys.im.hiroshima-cu.ac.jp
 *
 * Revision: 3.1
 * Date: 01/12/07
 *
*******************************************************/

#include <AR/ar.h>

static ARMarkerInfo    marker_info[AR_SQUARE_MAX];

ARMarkerInfo *arGetMarkerInfo( ARUint8 *image,
                               ARMarkerInfo2 *marker_info2, int *marker_num )
{
    int            id, dir;
    double         cf;
    int            i, j;


    for( i = j = 0; i < *marker_num; i++ ) {
        marker_info[j].area   = marker_info2[i].area;
        marker_info[j].pos[0] = marker_info2[i].pos[0];
        marker_info[j].pos[1] = marker_info2[i].pos[1];

        if( arGetLine(marker_info2[i].x_coord, marker_info2[i].y_coord,
                      marker_info2[i].coord_num, marker_info2[i].vertex,
                      marker_info[j].line, marker_info[j].vertex) < 0 ) continue;

        arGetCode( image,
                   marker_info2[i].x_coord, marker_info2[i].y_coord,
                   marker_info2[i].vertex, &id, &dir, &cf );

        marker_info[j].id  = id;
        marker_info[j].dir = dir;
        marker_info[j].cf  = cf;

        j++;
    }
    *marker_num = j;

    return( marker_info );
}
