forked from postgrespro/pgsphere
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgs_ellipse.sql.in
798 lines (586 loc) · 18.9 KB
/
pgs_ellipse.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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
-- ****************************
--
-- spherical ellipse functions
--
-- ****************************
CREATE FUNCTION sellipse(spoint, float8, float8, float8)
RETURNS sellipse
AS 'MODULE_PATHNAME', 'sphereellipse_infunc'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse(spoint, float8, float8, float8) IS
'returns spherical ellipse from center, radius1, radius2 and inclination';
CREATE FUNCTION inc(sellipse)
RETURNS float8
AS 'MODULE_PATHNAME', 'sphereellipse_incl'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION inc(sellipse) IS
'inclination of spherical ellipse';
CREATE FUNCTION lrad(sellipse)
RETURNS float8
AS 'MODULE_PATHNAME', 'sphereellipse_rad1'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION lrad(sellipse) IS
'large radius of spherical ellipse';
CREATE FUNCTION srad(sellipse)
RETURNS float8
AS 'MODULE_PATHNAME', 'sphereellipse_rad2'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION srad(sellipse) IS
'small radius of spherical ellipse';
--
-- Casting point as ellipse
--
CREATE FUNCTION sellipse(spoint)
RETURNS sellipse
AS 'MODULE_PATHNAME', 'spherepoint_ellipse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse(spoint) IS
'returns spherical point as spherical ellipse';
CREATE CAST (spoint AS sellipse)
WITH FUNCTION sellipse(spoint)
AS IMPLICIT;
--
-- Casting ellipse as circle
--
CREATE FUNCTION scircle(sellipse)
RETURNS scircle
AS 'MODULE_PATHNAME', 'sphereellipse_circle'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION scircle(sellipse) IS
'spherical bounding circle of spherical ellipse';
CREATE CAST (sellipse AS scircle)
WITH FUNCTION scircle(sellipse)
AS IMPLICIT;
--
-- Casting circle as ellipse
--
CREATE FUNCTION sellipse(scircle)
RETURNS sellipse
AS 'MODULE_PATHNAME', 'spherecircle_ellipse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse(scircle) IS
'returns spherical circle as spherical ellipse';
CREATE CAST (scircle AS sellipse)
WITH FUNCTION sellipse(scircle)
AS IMPLICIT;
--
-- Casting ellipse as Euler transformation
--
CREATE FUNCTION strans(sellipse)
RETURNS strans
AS 'MODULE_PATHNAME', 'sphereellipse_trans'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans(sellipse) IS
'returns Euler transformation of spherical ellipse';
CREATE CAST (sellipse AS strans)
WITH FUNCTION strans(sellipse)
AS IMPLICIT;
-- ****************************
--
-- spherical ellipse operators
--
-- ****************************
CREATE FUNCTION center(sellipse)
RETURNS spoint
AS 'MODULE_PATHNAME', 'sphereellipse_center'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION center(sellipse) IS
'center of spherical ellipse';
CREATE OPERATOR @@ (
RIGHTARG = sellipse,
PROCEDURE = center
);
COMMENT ON OPERATOR @@ (NONE, sellipse) IS
'center of spherical ellipse';
--
-- equal
--
CREATE FUNCTION sellipse_equal(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_equal'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_equal(sellipse, sellipse) IS
'returns true, if spherical ellipses are equal';
CREATE OPERATOR = (
LEFTARG = sellipse,
RIGHTARG = sellipse,
COMMUTATOR = = ,
NEGATOR = <>,
PROCEDURE = sellipse_equal,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR = (sellipse, sellipse) IS
'true, if spherical ellipses are equal';
--
-- not equal
--
CREATE FUNCTION sellipse_equal_neg(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_equal_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_equal_neg(sellipse, sellipse) IS
'returns true, if spherical ellipses are not equal';
CREATE OPERATOR <> (
LEFTARG = sellipse,
RIGHTARG = sellipse,
COMMUTATOR = <>,
NEGATOR = = ,
PROCEDURE = sellipse_equal_neg,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR <> (sellipse, sellipse) IS
'true, if spherical ellipses are not equal';
--
-- ellipse contains ellipse
--
CREATE FUNCTION sellipse_contains_ellipse(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_ellipse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_ellipse(sellipse, sellipse) IS
'true if spherical ellipse contains spherical ellipse';
--
-- ellipse is contained by ellipse
--
CREATE FUNCTION sellipse_contains_ellipse_com(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_ellipse_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_ellipse_com(sellipse, sellipse) IS
'true if spherical ellipse is contained by spherical ellipse';
--
-- ellipse does not contain ellipse
--
CREATE FUNCTION sellipse_contains_ellipse_neg(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_ellipse_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_ellipse_neg(sellipse, sellipse) IS
'true if spherical ellipse does not contain spherical ellipse';
--
-- ellipse is not contained by ellipse
--
CREATE FUNCTION sellipse_contains_ellipse_com_neg(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_ellipse_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_ellipse_com_neg(sellipse, sellipse) IS
'true if spherical ellipse is not contained by spherical ellipse';
--
-- ellipses overlap
--
CREATE FUNCTION sellipse_overlap_ellipse(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_ellipse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_ellipse(sellipse, sellipse) IS
'true if spherical ellipse overlaps spherical ellipse';
CREATE OPERATOR && (
LEFTARG = sellipse,
RIGHTARG = sellipse,
PROCEDURE = sellipse_overlap_ellipse,
COMMUTATOR = '&&',
NEGATOR = '!&&',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR && (sellipse, sellipse) IS
'true if spherical ellipses overlap';
--
-- ellipses do not overlap
--
CREATE FUNCTION sellipse_overlap_ellipse_neg(sellipse, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_ellipse_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_ellipse_neg(sellipse, sellipse) IS
'true if spherical ellipse does not overlap spherical ellipse';
CREATE OPERATOR !&& (
LEFTARG = sellipse,
RIGHTARG = sellipse,
PROCEDURE = sellipse_overlap_ellipse_neg,
COMMUTATOR = '!&&',
NEGATOR = '&&',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR !&& (sellipse, sellipse) IS
'true if spherical ellipse does not overlap spherical ellipse';
--
-- ellipse contains point
--
CREATE FUNCTION sellipse_contains_point(sellipse, spoint)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_point'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_point(sellipse, spoint) IS
'true if spherical ellipse contains spherical point';
--
-- point is contained by ellipse
--
CREATE FUNCTION sellipse_contains_point_com(spoint, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_point_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_point_com(spoint, sellipse) IS
'true if spherical ellipse contains spherical point';
--
-- ellipse does not contain point
--
CREATE FUNCTION sellipse_contains_point_neg(sellipse, spoint)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_point_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_point_neg(sellipse, spoint) IS
'true if spherical ellipse contains spherical point';
--
-- point is not contained by ellipse
--
CREATE FUNCTION sellipse_contains_point_com_neg(spoint, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_point_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_point_com_neg(spoint, sellipse) IS
'true if spherical ellipse contains spherical point';
--
-- Transformation of ellipse
--
CREATE FUNCTION strans_ellipse(sellipse, strans)
RETURNS sellipse
AS 'MODULE_PATHNAME', 'spheretrans_ellipse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_ellipse (sellipse, strans) IS
'returns a transformated spherical ellipse';
CREATE OPERATOR + (
LEFTARG = sellipse,
RIGHTARG = strans,
PROCEDURE = strans_ellipse
);
COMMENT ON OPERATOR + (sellipse, strans) IS
'transforms a spherical ellipse';
CREATE FUNCTION strans_ellipse_inverse (sellipse, strans)
RETURNS sellipse
AS 'MODULE_PATHNAME', 'spheretrans_ellipse_inv'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION strans_ellipse_inverse (sellipse, strans) IS
'returns a inverse transformated spherical ellipse';
CREATE OPERATOR - (
LEFTARG = sellipse,
RIGHTARG = strans,
PROCEDURE = strans_ellipse_inverse
);
COMMENT ON OPERATOR - (sellipse, strans) IS
'transforms inverse a spherical ellipse';
--
-- ellipse contains circle
--
CREATE FUNCTION sellipse_contains_circle(sellipse, scircle)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_circle'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_circle(sellipse, scircle) IS
'true if spherical ellipse contains spherical circle';
--
-- circle is contained by ellipse
--
CREATE FUNCTION sellipse_contains_circle_com(scircle, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_circle_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_circle_com(scircle, sellipse) IS
'true if spherical ellipse contains spherical circle';
--
-- ellipse does not contain circle
--
CREATE FUNCTION sellipse_contains_circle_neg(sellipse, scircle)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_circle_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_circle_neg(sellipse, scircle) IS
'true if spherical ellipse does not contain spherical circle';
--
-- circle is not contained by ellipse
--
CREATE FUNCTION sellipse_contains_circle_com_neg(scircle, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_circle_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_circle_com_neg(scircle, sellipse) IS
'true if spherical ellipse does not contain spherical circle';
--
-- circle contains ellipse
--
CREATE FUNCTION scircle_contains_ellipse(scircle, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'spherecircle_cont_ellipse'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION scircle_contains_ellipse(scircle, sellipse) IS
'true if spherical circle contains spherical ellipse';
--
-- ellipse is contained by circle
--
CREATE FUNCTION scircle_contains_ellipse_com(sellipse, scircle)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'spherecircle_cont_ellipse_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION scircle_contains_ellipse_com(sellipse, scircle) IS
'true if spherical circle contains spherical ellipse';
--
-- circle does not contain ellipse
--
CREATE FUNCTION scircle_contains_ellipse_neg(scircle, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'spherecircle_cont_ellipse_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION scircle_contains_ellipse_neg(scircle, sellipse) IS
'true if spherical circle does not contain spherical ellipse';
--
-- ellipse is not contained by circle
--
CREATE FUNCTION scircle_contains_ellipse_com_neg(sellipse, scircle)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'spherecircle_cont_ellipse_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION scircle_contains_ellipse_com_neg(sellipse, scircle) IS
'true if spherical circle does not contain spherical ellipse';
--
-- circle overlaps ellipse
--
CREATE FUNCTION sellipse_overlap_circle(sellipse, scircle)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_circle'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_circle(sellipse, scircle) IS
'true if spherical circle overlap spherical ellipse';
CREATE OPERATOR && (
LEFTARG = sellipse,
RIGHTARG = scircle,
PROCEDURE = sellipse_overlap_circle,
COMMUTATOR = '&&',
NEGATOR = '!&&',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR && (sellipse, scircle) IS
'true if spherical circle overlap spherical ellipse';
--
-- ellipse overlaps circle
--
CREATE FUNCTION sellipse_overlap_circle_com(scircle, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_circle_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_circle_com(scircle, sellipse) IS
'true if spherical circle overlap spherical ellipse';
CREATE OPERATOR && (
LEFTARG = scircle,
RIGHTARG = sellipse,
PROCEDURE = sellipse_overlap_circle_com,
COMMUTATOR = '&&',
NEGATOR = '!&&',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR && (scircle, sellipse) IS
'true if spherical circle overlap spherical ellipse';
--
-- circle does not overlap ellipse
--
CREATE FUNCTION sellipse_overlap_circle_neg(sellipse, scircle)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_circle_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_circle_neg(sellipse, scircle) IS
'true if spherical circle does not overlap spherical ellipse';
CREATE OPERATOR !&& (
LEFTARG = sellipse,
RIGHTARG = scircle,
PROCEDURE = sellipse_overlap_circle_neg,
COMMUTATOR = '!&&',
NEGATOR = '&&',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR !&& (sellipse, scircle) IS
'true if spherical circle does not overlap spherical ellipse';
--
-- ellipse does not overlap circle
--
CREATE FUNCTION sellipse_overlap_circle_com_neg(scircle, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_circle_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_circle_com_neg(scircle, sellipse) IS
'true if spherical circle does not overlap spherical ellipse';
CREATE OPERATOR !&& (
LEFTARG = scircle,
RIGHTARG = sellipse,
PROCEDURE = sellipse_overlap_circle_com_neg,
COMMUTATOR = '!&&',
NEGATOR = '&&',
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR !&& (scircle, sellipse) IS
'true if spherical circle does not overlap spherical ellipse';
--
-- ellipse overlaps line
--
CREATE FUNCTION sellipse_overlap_line (sellipse, sline)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_line'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_line (sellipse, sline) IS
'returns true if spherical line overlaps spherical ellipse';
CREATE OPERATOR && (
LEFTARG = sellipse,
RIGHTARG = sline,
PROCEDURE = sellipse_overlap_line,
COMMUTATOR = '&&',
NEGATOR = '!&&' ,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR && (sellipse, sline) IS
'true if spherical line overlaps spherical ellipse';
--
-- line overlaps ellipse
--
CREATE FUNCTION sellipse_overlap_line_com(sline, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_line_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_line_com(sline, sellipse) IS
'returns true if spherical line overlaps spherical ellipse';
CREATE OPERATOR && (
LEFTARG = sline,
RIGHTARG = sellipse,
PROCEDURE = sellipse_overlap_line_com,
COMMUTATOR = '&&',
NEGATOR = '!&&' ,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR && (sline, sellipse) IS
'true if spherical line overlaps spherical ellipse';
--
-- ellipse does not overlap line
--
CREATE FUNCTION sellipse_overlap_line_neg (sellipse, sline)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_line_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_line_neg (sellipse, sline) IS
'returns true if spherical line overlaps spherical ellipse';
CREATE OPERATOR !&& (
LEFTARG = sellipse,
RIGHTARG = sline,
PROCEDURE = sellipse_overlap_line_neg,
COMMUTATOR = '!&&',
NEGATOR = '&&' ,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR !&& (sellipse, sline) IS
'true if spherical line does not overlap spherical ellipse';
--
-- line does not overlap ellipse
--
CREATE FUNCTION sellipse_overlap_line_com_neg(sline, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_overlap_line_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_overlap_line_com_neg(sline, sellipse) IS
'returns true if spherical line does not overlap spherical ellipse';
CREATE OPERATOR !&& (
LEFTARG = sline,
RIGHTARG = sellipse,
PROCEDURE = sellipse_overlap_line_com_neg,
COMMUTATOR = '!&&',
NEGATOR = '&&' ,
RESTRICT = contsel,
JOIN = contjoinsel
);
COMMENT ON OPERATOR !&& (sline, sellipse) IS
'true if spherical line does not overlap spherical ellipse';
--
-- ellipse contains line
--
CREATE FUNCTION sellipse_contains_line(sellipse, sline)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_line'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_line(sellipse, sline) IS
'returns true if spherical ellipse contains spherical line';
--
-- line is contained by ellipse
--
CREATE FUNCTION sellipse_contains_line_com(sline, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_line_com'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_line_com(sline, sellipse) IS
'returns true if spherical ellipse contains spherical line';
--
-- ellipse does not contain line
--
CREATE FUNCTION sellipse_contains_line_neg(sellipse, sline)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_line_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_line_neg(sellipse, sline) IS
'returns true if spherical ellipse does not contain spherical line';
--
-- line is not contained by ellipse
--
CREATE FUNCTION sellipse_contains_line_com_neg(sline, sellipse)
RETURNS BOOL
AS 'MODULE_PATHNAME', 'sphereellipse_cont_line_com_neg'
LANGUAGE 'c'
IMMUTABLE STRICT PARALLEL SAFE;
COMMENT ON FUNCTION sellipse_contains_line_com_neg(sline, sellipse) IS
'returns true if spherical ellipse does not contain spherical line';