/* See {float_image_func.h}. */ /* Last edited on 2018-03-04 22:06:40 by stolfilocal */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include /* BASIC FUNCTIONAL IMAGES */ /* In the following procedures, if {RX} is nonzero, {x} will be reduced modulo {RX}. Ditto for {RY} and {y}. */ bool_t float_image_func_circle(double xctr, double yctr, double rad, double x, double y, int32_t RX, int32_t RY); /* Function that is true iff {(x,y)} is inside the disk with center {(xctr,yctr)} and radius {rad}. */ float float_image_func_bell(double xctr, double yctr, double xdev, double ydev, double x, double y, int32_t RX, int32_t RY); /* Function that is 1 at {(xctr,yctr)} and decays to 0 like a Gaussian bell with deviations {xdev} and {ydev} along the two axes. */ bool_t float_image_func_circle(double xctr, double yctr, double rad, double x, double y, int32_t RX, int32_t RY) { double dx = x - xctr; double dy = y - yctr; double dr2 = dx*dx + dy*dy; return (dr2 <= rad); } float float_image_func_bell(double xctr, double yctr, double xdev, double ydev, double x, double y, int32_t RX, int32_t RY) { double gx = gauss_table_folded_bell(x - xctr, xdev, RX); double gy = gauss_table_folded_bell(y - yctr, ydev, RY); return (float)(gx*gy); }