32 namespace siscone_spherical{
34 #define PHI_RANGE_MASK 0xFFFFFFFF
68 double xmin = max(c_theta-R,theta_min+0.00001);
69 double xmax = min(c_theta+R,theta_max-0.00001);
71 unsigned int cell_min = get_theta_cell(xmin);
72 unsigned int cell_max = get_theta_cell(xmax);
77 theta_range = (cell_max-cell_min)+cell_max;
84 double extra = asin(R/M_PI);
85 if (xmin<=theta_min+extra){
88 }
else if (xmax>=theta_max-extra){
92 extra = max(1.0/sin(xmin), 1.0/sin(xmax));
93 ymin = (c_phi-R)*extra;
94 while (ymin<-M_PI) ymin+=
twopi;
95 while (ymin> M_PI) ymin-=
twopi;
96 ymax = (c_phi-R)*extra;
97 while (ymax<-M_PI) ymax+=
twopi;
98 while (ymax> M_PI) ymax-=
twopi;
100 cell_min = get_phi_cell(ymin);
101 cell_max = get_phi_cell(ymax);
105 phi_range = (cell_max-cell_min)+cell_max;
107 phi_range = (cell_min==cell_max)
109 : ((PHI_RANGE_MASK^(cell_min-cell_max)) + cell_max);
130 theta_range |= get_theta_cell(theta);
133 phi_range |= get_phi_cell(phi);
155 const CSphtheta_phi_range range_union (
const CSphtheta_phi_range &r1,
const CSphtheta_phi_range &r2){
156 CSphtheta_phi_range tmp;
159 tmp.theta_range = r1.theta_range | r2.theta_range;
162 tmp.
phi_range = r1.phi_range | r2.phi_range;