GNU Astronomy Utilities


Next: , Previous: , Up: Gnuastro library   [Contents][Index]


10.3.14 Bounding box (box.h)

Functions related to reporting a the bounding box of certain inputs are declared in gnuastro/box.h. All coordinates in this header are in the FITS format (first axis is the horizontal and the second axis is vertical).

Function:
void
gal_box_bound_ellipse (double a, double b, double theta_deg, long *width)

Any ellipse can be enclosed into a rectangular box. The purpose of this function is to give the height and width of that box assuming the center of the ellipse is in the box center. a is the ellipse major axis, b is the minor axis, theta_deg is the position angle in degrees. The width array will contain the output size in long integer type. width[0], and width[1] are the number of pixels along the first and second FITS axis. Since the ellipse center is assumed to be in the center of the box, all the values in width will be an odd integer.

Function:
void
gal_box_border_from_center (double center, size_t ndim, long *width, long *fpixel, long *lpixel)

Given the center coordinates in center and the width (along each dimension) of a box, return the coordinates of the first (fpixel) and last (lpixel) pixels. All arrays must have ndim elements (one for each dimension).

Function:
int
gal_box_overlap (long *naxes, long *fpixel_i, long *lpixel_i, long *fpixel_o, long *lpixel_o, size_t ndim)

An ndim-dimensional dataset of size naxes (along each dimension, in FITS order) and a box with first and last (inclusive) coordinate of fpixel_i and lpixel_i is given. This box doesn’t necessarily have to lie within the dataset, it can be outside of it, or only patially overlap. This function will change the values of fpixel_i and lpixel_i to exactly cover the overlap in the input dataset’s coordinates.

This function will return 1 if there is an overlap and 0 if there isn’t. When there is an overlap, the coordinates of the first and last pixels of the overlap will be put in fpixel_o and lpixel_o.


Next: , Previous: , Up: Gnuastro library   [Contents][Index]