• atFindTrans
  • atApplyTrans
  • atMatchChains
  • tclPMatch.c

    ABSTRACT:
     This file contains TCL-handling routines which call C 
     functions which, in turn, try to match up items
     in two different CHAINs, which might have very different
     coordinate systems. 
     </HTML>
    
    

    atFindTrans

     C ROUTINE CALLED: atFindTrans in atPMatch.c
     
    
    DESCRIPTION:
     given two CHAINs of items, and the names of the fields we use to
     perform the match,
     call the C-code routine that performs the match and yields
     a TRANS structure converting the coords of CHAIN A to the
     coords of CHAIN B.
    
     Only the affine elemnts of the TRANS are set.  The higer-order distortion
     and color terms are all set to 0.
    
    RETURN:
        TCL_OK             if all goes well
        TCL_ERROR          if an error occurs
    
    TCL SYNTAX:
      atFindTrans  "<chainA>" "<xnameA>" "<ynameA>" "<magnameA>" "<chainB>" "<xnameB>" "<ynameB>" "<magnameB>" "-radius" "-nobj" "-maxdist" "-scale" 
    
    TCL HELP STRING:
      Given two chains of items, and the names of the 
    fields in both that contain 'x', 'y' and 'mag' values, 
    find the coordinate transformation that converts items 
    in chain A to chain B's coordinate system. 
    
    TCL ARGUMENTS:
                     : 
      "<chainA>"   : first chain of items
      "<xnameA>"   : name of field in chain A which contains X coordinate
      "<ynameA>"   : name of field in chain A which contains Y coordinate
      "<magnameA>" : name of field in chain A which contains magnitude 
      "<chainB>"   : second chain of items
      "<xnameB>"   : name of field in chain B which contains X coordinate
      "<ynameB>"   : name of field in chain B which contains Y coordinate
      "<magnameB>" : name of field in chain B which contains magnitude 
      "-radius"      : max allowed radius in triangle space for match;
                    Default: 0.002
      "-nobj"        : number of objects from each set to use in matching process;
                    Default: 20
      "-maxdist"     : max dist in coord system B allowed for corresponding pairs;
                    Default: 500.0
      "-scale"       : ratio of coord size in list B to coord size in list A;
                    Default: -1.0
    
    

    atApplyTrans

     C ROUTINE CALLED: atApplyTrans in atPMatch.c
     
    
    DESCRIPTION:
     Transform the coordinates of items on the given CHAIN, according
     to the given TRANS structure.
     Only the affine terms of the TRANS structure are used.  The higher-order
     distortion and color terms are ignfored.  Thus:
    
           x' = a + bx + cx
           y' = d + ex + fy
    
    RETURN:
        TCL_OK             if all goes well
        TCL_ERROR          if an error occurs
    
    TCL SYNTAX:
      atApplyTrans  "<chain>" "<xname>" "<yname>" "<trans>" 
    
    TCL HELP STRING:
      Given a CHAIN of items, and the names of the 
    fields in that CHAIN which contain 'x' and 'y' values, 
    and a TRANS structure, apply the given TRANS coefficients 
    to every item in the CHAIN, calculating new 'x' and 'y' values.
    
    TCL ARGUMENTS:
                     : 
      "<chain>"    : chain of items
      "<xname>"    : name of field in chain which contains X coordinate
      "<yname>"    : name of field in chain which contains Y coordinate
      "<trans>"    : TRANS structure to be applied to items in CHAIN
    
    

    atMatchChains

     C ROUTINE CALLED: atMatchChains in atPMatch.c
     
    
    DESCRIPTION:
     given two CHAINs of items, the names of the fields we use to
     perform the match, and a matching radius,
     find all "matches", where a "match" is defined as follows:
     We calculate the Euclidean distance between pairs of items
     from each CHAIN.  For each item of CHAIN A, we find all
     possible matches (such that distance < radius) on CHAIN B.
     We then select the _single_ item that yields the minimum distance.
    
     Thus, matches are exclusive; no single item is allowed to belong
     to more than one match.
    
     place the elems of A that are matches into output chain J
                        B that are matches into output chain K
                        A that are not matches into output chain L
                        B that are not matches into output chain M
    
    RETURN:
        TCL_OK             if all goes well
        TCL_ERROR          if an error occurs
    
    TCL SYNTAX:
      atMatchChains  "<chainA>" "<xnameA>" "<ynameA>" "<chainB>" "<xnameB>" "<ynameB>" "<radius>" "<chainJ>" "<chainK>" "<chainL>" "<chainM>" 
    
    TCL HELP STRING:
      Given two chains of items (A and B), and the names of the 
    fields in both that contain 'x' and 'y' values, 
    and a matching radius, 
    find all exclusive matches of items in the two chains. 
    Create output chains as follows: 
    place the elems of A that are matches into output chain J 
    place the elems of B that are matches into output chain K 
    place the elems of A that are not matches into output chain L 
    place the elems of B that are not matches into output chain M 
    
    TCL ARGUMENTS:
                     : 
      "<chainA>"   : first input chain of items
      "<xnameA>"   : name of field in chain A which contains X coordinate
      "<ynameA>"   : name of field in chain A which contains Y coordinate
      "<chainB>"   : second input chain of items
      "<xnameB>"   : name of field in chain B which contains X coordinate
      "<ynameB>"   : name of field in chain B which contains Y coordinate
      "<radius>"   : max allowed radius for match
      "<chainJ>"   : output chain of items, those in A that matched
      "<chainK>"   : output chain of items, those in B that matched
      "<chainL>"   : output chain of items, those in A that didn't match
      "<chainM>"   : output chain of items, those in B that didn't match