interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / om / allen-scene / native / sky_real.h

76 lines · 3996 bytes Raw Blame History
1/* sky_real.h -- the real sky behind Allen: the catalogue's stars at their
2 * true places, brightness and colour; the Milky Way from Gaia DR3 source
3 * counts and integrated G-band flux (ESA/Gaia/DPAC, CC BY-NC 3.0 IGO),
4 * reddened by extinction from gaiadr3.astrophysical_parameters; the
5 * galaxies the eye can see. The data are in sky_data.c (generated, see
6 * sky_data.h); this is the drawing, integer only.
7 *
8 * The view: a gnomonic projection (what a pinhole camera sees) of any piece
9 * of sky, the view centre at (cx, cy) on the screen, a set width of sky
10 * across the screen's width.
11 *
12 * The Milky Way is stored as a full-sphere equirectangular grid; rendering
13 * inverse-projects each screen point to (RA, Dec) and bilinear-samples the
14 * grid, so any view can be shown.
15 *
16 * Also here: the sidereal-time maths for "the sky above you now". */
17#ifndef AIENOS_SKY_REAL_H
18#define AIENOS_SKY_REAL_H
19#include <stdint.h>
20
21#include "night.h"
22#include "sky_data.h"
23
24/* Where the direction d (Q15) lands on a screen w px wide whose view
25 * centre is at (cx, cy) px: (x16, y16) in 16ths of a pixel, the pixel i
26 * spanning 16 i to 16 i + 16. 0 if it is more than 88 degrees from the
27 * centre (behind the camera), else 1. */
28int ck_sky_project(const ck_sky_view *v, const int16_t d[3], int32_t w, int32_t cx, int32_t cy, int32_t *x16,
29 int32_t *y16);
30
31/* The Milky Way's light at a quarter of the resolution: q holds qw x qh
32 * cells of three channels in 16ths of a level, cell (i, j) for the pixel
33 * (4 i, 4 j) of a w-wide screen with its view centre at (cx, cy).
34 * v: the current sky view (inverse-projects each screen point to RA/Dec). */
35void ck_sky_milkyway_q(uint16_t *q, int32_t qw, int32_t qh, int32_t w, int32_t cx, int32_t cy,
36 const ck_sky_view *v);
37
38/* Draws every catalogue star in the view into cv (a w x h sky whose view
39 * centre is at (cx, cy); k: 1/256 px per design px of a 1920-wide design),
40 * using view v, adding its light to what is there. The brightest few (V 2.0
41 * and brighter) are also listed in tw, up to max, to twinkle; *ntw: count. */
42void ck_sky_draw_stars(ck_canvas *cv, uint32_t k, int32_t cx, int32_t cy, const ck_sky_view *v,
43 ck_night_star *tw, unsigned max, unsigned *ntw);
44
45/* The largest box galaxy i can need on a w-wide screen (for memory). */
46ck_rect ck_sky_galaxy_bound(uint32_t w, unsigned i);
47/* Galaxy i's box on a w x h screen, view v, centre (cx, cy) (clipped; empty
48 * if not in the view or no galaxy i). */
49ck_rect ck_sky_galaxy_box(uint32_t w, uint32_t h, int32_t cx, int32_t cy, const ck_sky_view *v, unsigned i);
50/* Fills g->light and g->phase over g->box. */
51void ck_sky_galaxy_maps(ck_night_galaxy *g, unsigned i, uint32_t w, int32_t cx, int32_t cy,
52 const ck_sky_view *v);
53
54/* ---- the sky above you now ---- */
55
56/* Greenwich mean sidereal time at unix time t (seconds, UTC taken as UT1:
57 * within a second), in turns / 2^32. IAU 1982 (Aoki et al. 1982; USNO). */
58uint32_t ck_sky_gmst(int64_t unix_s);
59/* The direction straight up (the zenith) at unix time t from latitude lat
60 * and east longitude lon (millionths of a degree), in J2000 axes (the
61 * local sidereal time, then the 1976 IAU precession back to J2000), Q15.
62 * As RA and Dec in millionths of a degree too, if ra or dec are given. */
63void ck_sky_zenith(int64_t unix_s, int32_t lat_udeg, int32_t lon_udeg, int16_t d[3], int32_t *ra_udeg,
64 int32_t *dec_udeg);
65/* A view centred on (ra, dec) (millionths of a degree), fov degrees wide
66 * (thousandths), north up turned by roll (thousandths), built with integer
67 * trigonometry. */
68void ck_sky_view_at(ck_sky_view *v, int32_t ra_udeg, int32_t dec_udeg, int32_t fov_mdeg, int32_t roll_mdeg);
69
70/* the location setting: unset unless the build sets both (millionths of a degree) */
71#if defined(CK_SKY_LAT_UDEG) && defined(CK_SKY_LON_UDEG)
72#define CK_SKY_HAVE_LOCATION 1
73#else
74#define CK_SKY_HAVE_LOCATION 0
75#endif
76#endif