hawki_match_cats.c
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include <config.h>
00030 #endif
00031
00032
00033
00034
00035
00036 #include <float.h>
00037 #include <string.h>
00038 #include <math.h>
00039 #include <cpl.h>
00040
00041 #include "hawki_dfs.h"
00042 #include "hawki_utils.h"
00043 #include "hawki_pfits.h"
00044 #include "hawki_match_cats.h"
00045
00046
00050
00051
00054
00075 int hawki_match_condition_5_pix
00076 (cpl_table * catalogue1,
00077 cpl_table * catalogue2,
00078 int iobj1,
00079 int iobj2)
00080 {
00081 static const double max_dist2 = 25;
00082
00083 int null;
00084 double posx1;
00085 double posy1;
00086 double posx2;
00087 double posy2;
00088 double dist2;
00089
00090 posx1 =
00091 cpl_table_get_double(catalogue1, HAWKI_COL_OBJ_POSX, iobj1, &null);
00092 posy1 =
00093 cpl_table_get_double(catalogue1, HAWKI_COL_OBJ_POSY, iobj1, &null);
00094 posx2 =
00095 cpl_table_get_double(catalogue2, HAWKI_COL_OBJ_POSX, iobj2, &null);
00096 posy2 =
00097 cpl_table_get_double(catalogue2, HAWKI_COL_OBJ_POSY, iobj2, &null);
00098
00099 dist2 = (posx1 - posx2) * (posx1 - posx2) + (posy1 - posy2) * (posy1 - posy2);
00100 if(dist2 <= max_dist2)
00101 return 1;
00102
00103 return 0;
00104 }
00105