1 /*********************************************************************
2 Box -- Define bounding and overlapping boxes.
3 This is part of GNU Astronomy Utilities (Gnuastro) package.
4 
5 Original author:
6      Mohammad Akhlaghi <mohammad@akhlaghi.org>
7 Contributing author(s):
8 Copyright (C) 2015-2021, Free Software Foundation, Inc.
9 
10 Gnuastro is free software: you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by the
12 Free Software Foundation, either version 3 of the License, or (at your
13 option) any later version.
14 
15 Gnuastro is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
22 **********************************************************************/
23 #ifndef __GAL_BOX_H__
24 #define __GAL_BOX_H__
25 
26 /* Include other headers if necessary here. Note that other header files
27    must be included before the C++ preparations below */
28 
29 
30 
31 /* C++ Preparations */
32 #undef __BEGIN_C_DECLS
33 #undef __END_C_DECLS
34 #ifdef __cplusplus
35 # define __BEGIN_C_DECLS extern "C" {
36 # define __END_C_DECLS }
37 #else
38 # define __BEGIN_C_DECLS                /* empty */
39 # define __END_C_DECLS                  /* empty */
40 #endif
41 /* End of C++ preparations */
42 
43 
44 
45 /* Actual header contants (the above were for the Pre-processor). */
46 __BEGIN_C_DECLS  /* From C++ preparations */
47 
48 
49 
50 /*                        IMPORTANT NOTE:
51          All the axises are based on the FITS standard, NOT C.
52 */
53 
54 void
55 gal_box_bound_ellipse_extent(double a, double b, double theta_deg,
56                              double *extent);
57 
58 void
59 gal_box_bound_ellipse(double a, double b, double theta_deg, long *width);
60 
61 void
62 gal_box_bound_ellipsoid_extent(double *semiaxes, double *euler_deg,
63                               double *extent);
64 
65 void
66 gal_box_bound_ellipsoid(double *semiaxes, double *euler_deg, long *width);
67 
68 void
69 gal_box_border_from_center(double *center, size_t ndim, long *width,
70                            long *fpixel, long *lpixel);
71 
72 int
73 gal_box_overlap(long *naxes, long *fpixel_i, long *lpixel_i,
74                 long *fpixel_o, long *lpixel_o, size_t ndim);
75 
76 
77 
78 __END_C_DECLS    /* From C++ preparations */
79 
80 #endif           /* __GAL_BOX_H__ */
81