# iteration to cover the whole sky with right ascension, declination, angle

I am sure I get parts of the terminology wrong but if anyone can shed some light in the following:

I understand that for a given right ascension (RA) and declination (DEC), one has defined a ray (half-line) in the sky starting from the center of the earth towards infinity.

Now, if I also provide a angle, say d degrees around that ray, I have essentially defined a cone in the sky. My question is the following:

Which steps (RA_step and DEC_step) should I use in the following loop, as a function of d to ensure that I cover the entire sky and don't leave any patches anywhere?.

for (RA = 0 ; RA <= 360 ; RA += RA_step)
for (DEC = -90 ; DEC <= 90 ; DEC += DEC_step)
examine-cone(RA, DEC, d)

-
Wouldn't it be easier if you use square sky patchs? –  Envite Dec 5 '13 at 13:33
@Envite I don't have a choice, the API I am given uses cones so I need to cover the sky with cones, not "pyramids". –  Marcus Junius Brutus Dec 5 '13 at 13:53

Imagine you are patching a plane with circles, instead of patching the sky sphere with circles (which is the same as filling the space with cones). Now, for every circle of diameter D define a square of diagonal D (D=2d). It is easier to patch the plane with squares, isn't it? So you have squares of side D/2*sqrt(2), and that is exactly your DEC_step, for each vertical sweep, and your RA_step, from sweep to sweep.

This will lead to a lot of duplicated examination (in fact you will examinate exactly the same place at the Poles once for each sweep) but you can be sure you'll not leave anything out of your squares.

-
Yeah, I thought I could use that approach I was just looking for the actual formula for DEC_step and RA_step based on the cone angle - I thought maybe it's some well-known formula in astronomy otherwise I guess I have to do some trigonometric calculations myself. –  Marcus Junius Brutus Dec 5 '13 at 22:27
I actually gave you the formula: if the side of the square is sqrt(2)*D/2 that is exactly both RA_step and DEC_step –  Envite Dec 5 '13 at 22:30
@Envite Do you happen to know the percentage of overlap you get with this configuration? In other words, how much of the analysis would be redundant/wasted if you were forced to analyze the entire field with each step? –  Robert Cartaino Dec 6 '13 at 0:43
@RobertCartaino Calculate the difference between the surface of a slice of sphere from pole to pole between two meridians and that of a rectangle which is D*sqrt(2) longer than needed. This is inside the squares only, you need to multiply for the relation among that of a circle of radius d and that of a square of side sqrt(2)*D/2. –  Envite Dec 6 '13 at 19:55