00001 /* $Id: hawki_match_cats.c,v 1.1 2009/11/26 09:52:32 cgarcia Exp $ 00002 * 00003 * This file is part of the HAWKI Pipeline 00004 * Copyright (C) 2002,2003 European Southern Observatory 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00021 /* 00022 * $Author: cgarcia $ 00023 * $Date: 2009/11/26 09:52:32 $ 00024 * $Revision: 1.1 $ 00025 * $Name: hawki-1_8_0 $ 00026 */ 00027 00028 #ifdef HAVE_CONFIG_H 00029 #include <config.h> 00030 #endif 00031 00032 /*----------------------------------------------------------------------------- 00033 Includes 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