forked from postgrespro/pgsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgs_epochprop.sql.in
41 lines (38 loc) · 1017 Bytes
/
pgs_epochprop.sql.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- ***********************************
--
-- functions for propagating positions
--
-- ***********************************
CREATE FUNCTION epoch_prop(
pos spoint,
parallax DOUBLE PRECISION,
pmlng DOUBLE PRECISION,
pmlat DOUBLE PRECISION,
rv DOUBLE PRECISION,
delta_t DOUBLE PRECISION)
RETURNS double precision[6]
AS 'MODULE_PATHNAME', 'epoch_prop'
LANGUAGE 'c'
IMMUTABLE PARALLEL SAFE;
CREATE FUNCTION epoch_prop_pos(
pos spoint,
parallax DOUBLE PRECISION,
pmlng DOUBLE PRECISION,
pmlat DOUBLE PRECISION,
rv DOUBLE PRECISION,
delta_t DOUBLE PRECISION)
RETURNS spoint
AS $body$
SELECT spoint(pv[1], pv[2])
FROM epoch_prop(pos, parallax, pmlng, pmlat, rv, delta_t) as pv
$body$ LANGUAGE SQL STABLE PARALLEL SAFE;
CREATE FUNCTION epoch_prop_pos(
pos spoint,
pmlng DOUBLE PRECISION,
pmlat DOUBLE PRECISION,
delta_t DOUBLE PRECISION)
RETURNS spoint
AS $body$
SELECT spoint(pv[1], pv[2])
FROM epoch_prop(pos, 0, pmlng, pmlat, 0, delta_t) as pv
$body$ LANGUAGE SQL STABLE PARALLEL SAFE;