forked from postgrespro/pgsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgs_euler.sql.in
222 lines (169 loc) · 5.54 KB
/
pgs_euler.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
-- spherical transformation functions
CREATE FUNCTION strans_zxz(strans)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans_zxz'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_zxz(strans) IS
'returns Euler transformation as ZXZ transformation';
CREATE FUNCTION strans(FLOAT8, FLOAT8, FLOAT8)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans_from_float8'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans(FLOAT8, FLOAT8, FLOAT8) IS
'returns an transformation object using Euler angles (ZXZ)';
CREATE FUNCTION strans(FLOAT8, FLOAT8, FLOAT8, CSTRING)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans_from_float8_and_type'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans(FLOAT8, FLOAT8, FLOAT8, CSTRING) IS
'returns an transformation object using Euler angles and axis';
CREATE FUNCTION phi(strans)
RETURNS FLOAT8
AS 'MODULE_PATHNAME', 'spheretrans_phi'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION phi(strans) IS
'returns the first angle of Euler angles of a transformation object';
CREATE FUNCTION theta(strans)
RETURNS FLOAT8
AS 'MODULE_PATHNAME', 'spheretrans_theta'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION theta(strans) IS
'returns the second angle of Euler angles of a transformation object';
CREATE FUNCTION psi(strans)
RETURNS FLOAT8
AS 'MODULE_PATHNAME', 'spheretrans_psi'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION psi(strans) IS
'returns the third angle of Euler angles of a transformation object';
CREATE FUNCTION axes(strans)
RETURNS CHARACTER(3)
AS 'MODULE_PATHNAME', 'spheretrans_type'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION axes (strans) IS
'returns the axis of Euler angles of a transformation object';
-- spherical transformation operators
CREATE FUNCTION strans_equal(strans, strans)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'spheretrans_equal'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_equal(strans, strans) IS
'returns true, if Euler transformations are equal';
CREATE OPERATOR = (
LEFTARG = strans,
RIGHTARG = strans,
COMMUTATOR = = ,
NEGATOR = <>,
PROCEDURE = strans_equal,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR = (strans, strans) IS
'true, if Euler transformations are equal';
CREATE FUNCTION strans_not_equal(strans, strans)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'spheretrans_not_equal'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_not_equal(strans, strans) IS
'returns true, if Euler transformations are not equal';
CREATE OPERATOR <> (
LEFTARG = strans,
RIGHTARG = strans,
COMMUTATOR = <>,
NEGATOR = = ,
PROCEDURE = strans_not_equal,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR <> (strans, strans) IS
'true, if spherical Euler transformations are not equal';
CREATE FUNCTION strans(strans)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans(strans) IS
'returns Euler transformation';
CREATE OPERATOR + (
RIGHTARG = strans,
PROCEDURE = strans
);
COMMENT ON OPERATOR + (NONE, strans) IS
'returns Euler transformation';
CREATE FUNCTION strans_invert(strans)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans_invert'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_invert(strans) IS
'returns inverse Euler transformation';
CREATE OPERATOR - (
RIGHTARG = strans,
PROCEDURE = strans_invert
);
COMMENT ON OPERATOR - (NONE, strans) IS
'inverts Euler transformation';
CREATE FUNCTION strans_point(spoint, strans)
RETURNS spoint
AS 'MODULE_PATHNAME', 'spheretrans_point'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_point (spoint, strans) IS
'returns a transformated spherical point';
CREATE OPERATOR + (
LEFTARG = spoint,
RIGHTARG = strans,
PROCEDURE = strans_point
);
COMMENT ON OPERATOR + (spoint, strans) IS
'transforms a spherical point';
CREATE FUNCTION strans_point_inverse(spoint, strans)
RETURNS spoint
AS 'MODULE_PATHNAME', 'spheretrans_point_inverse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_point_inverse (spoint, strans) IS
'returns a inverse transformated spherical point';
CREATE OPERATOR - (
LEFTARG = spoint,
RIGHTARG = strans,
PROCEDURE = strans_point_inverse
);
COMMENT ON OPERATOR - (spoint, strans) IS
'transforms inverse a spherical point';
CREATE FUNCTION strans_trans(strans, strans)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans_trans'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_trans (strans, strans) IS
'returns a transformated Euler transformation';
CREATE OPERATOR + (
LEFTARG = strans,
RIGHTARG = strans,
PROCEDURE = strans_trans
);
COMMENT ON OPERATOR + (strans, strans) IS
'transforms a Euler transformation';
CREATE FUNCTION strans_trans_inv(strans, strans)
RETURNS strans
AS 'MODULE_PATHNAME', 'spheretrans_trans_inv'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_trans_inv (strans, strans) IS
'returns a inverse transformated Euler transformation';
CREATE OPERATOR - (
LEFTARG = strans,
RIGHTARG = strans,
PROCEDURE = strans_trans_inv
);
COMMENT ON OPERATOR - (strans, strans) IS
'transforms inverse a Euler transformation';