IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 13, 2010, 11:00:08 AM (16 years ago)
Author:
eugene
Message:

add pmPhotObj->SN, sort by SN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/psModules.20100506/src/objects/pmPhotObj.c

    r27657 r27948  
    5858    if (!object->sources) {
    5959        object->sources = psArrayAllocEmpty(1);
    60         object->x = source->peak->xf;
    61         object->y = source->peak->yf;
     60        object->x  = source->peak->xf;
     61        object->y  = source->peak->yf;
     62        object->SN = source->peak->SN;
     63    } else {
     64        object->SN = PS_MAX(object->SN, source->peak->SN);
    6265    }
    6366    psArrayAdd (object->sources, 1, source);
    6467    return true;
    6568}
     69
     70// sort by SN (descending)
     71int pmPhotObjSortBySN (const void **a, const void **b)
     72{
     73    pmPhotObj *objA = *(pmPhotObj **)a;
     74    pmPhotObj *objB = *(pmPhotObj **)b;
     75
     76    psF32 fA = objA->SN;
     77    psF32 fB = objB->SN;
     78
     79    psF32 diff = fA - fB;
     80    if (diff > FLT_EPSILON) return (-1);
     81    if (diff < FLT_EPSILON) return (+1);
     82    return (0);
     83}
Note: See TracChangeset for help on using the changeset viewer.