5 -- Back off displayed precision a little bit to reduce platform-to-platform
6 -- variation in results.
7 SET extra_float_digits TO -3;
13 SELECT '' AS four, center(f1) AS center
16 SELECT '' AS four, (@@ f1) AS center
19 SELECT '' AS six, point(f1) AS center
22 SELECT '' AS six, (@@ f1) AS center
25 SELECT '' AS two, (@@ f1) AS center
29 -- "is horizontal" function
30 SELECT '' AS two, p1.f1
32 WHERE ishorizontal(p1.f1, point '(0,0)');
34 -- "is horizontal" operator
35 SELECT '' AS two, p1.f1
37 WHERE p1.f1 ?- point '(0,0)';
39 -- "is vertical" function
40 SELECT '' AS one, p1.f1
42 WHERE isvertical(p1.f1, point '(5.1,34.5)');
44 -- "is vertical" operator
45 SELECT '' AS one, p1.f1
47 WHERE p1.f1 ?| point '(5.1,34.5)';
54 SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
55 FROM LSEG_TBL l, POINT_TBL p;
58 SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
59 FROM LSEG_TBL l, POINT_TBL p;
69 SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
72 SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
73 FROM BOX_TBL b, POINT_TBL p;
75 SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
76 FROM BOX_TBL b, POINT_TBL p;
78 -- scaling and rotation
79 SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation
80 FROM BOX_TBL b, POINT_TBL p;
82 SELECT '' AS twenty, b.f1 / p.f1 AS rotation
83 FROM BOX_TBL b, POINT_TBL p
84 WHERE (p.f1 <-> point '(0,0)') >= 1;
90 SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
92 SELECT '' AS four, path(f1) FROM POLYGON_TBL;
95 SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
98 -- scaling and rotation
99 SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
107 SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains
108 FROM POLYGON_TBL poly, POINT_TBL p;
110 SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
111 FROM POLYGON_TBL poly, POINT_TBL p;
113 SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
116 SELECT '' AS four, polygon(f1)
119 SELECT '' AS four, polygon(f1)
120 FROM PATH_TBL WHERE isclosed(f1);
122 SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
126 -- convert circles to polygons using the default number of points
127 SELECT '' AS six, polygon(f1)
130 -- convert the circle to an 8-point polygon
131 SELECT '' AS six, polygon(8, f1)
138 SELECT '' AS six, circle(f1, 50.0)
141 SELECT '' AS four, circle(f1)
144 SELECT '' AS two, circle(f1)
148 SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
149 FROM CIRCLE_TBL c1, POINT_TBL p1
150 WHERE (p1.f1 <-> c1.f1) > 0
151 ORDER BY distance, area(c1.f1), p1.f1[0];