📄 geometry_1.out
字号:
| (0.0651176557644,0),(0,-0.0483449262493) | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374) | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117) | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374) | (0,0.0828402366864),(-0.201183431953,0) | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432) | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414) | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503) | (0.2,0),(0,0) | (0.3,0),(0.1,0) | (0.3,0.05),(0.25,0) | (0.3,0),(0.3,0)(20 rows)---- Paths--SET geqo TO 'off';SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL; eight | npoints | path -------+---------+--------------------------- | 2 | [(1,2),(3,4)] | 2 | ((1,2),(3,4)) | 4 | [(0,0),(3,0),(4,5),(1,6)] | 2 | ((1,2),(3,4)) | 2 | ((1,2),(3,4)) | 2 | [(1,2),(3,4)] | 2 | [(11,12),(13,14)] | 2 | ((11,12),(13,14))(8 rows)SELECT '' AS four, path(f1) FROM POLYGON_TBL; four | path ------+--------------------- | ((2,0),(2,4),(0,0)) | ((3,1),(3,3),(1,0)) | ((0,0)) | ((0,1),(0,1))(4 rows)-- translationSELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add FROM PATH_TBL p1; eight | dist_add -------+----------------------------------- | [(11,12),(13,14)] | ((11,12),(13,14)) | [(10,10),(13,10),(14,15),(11,16)] | ((11,12),(13,14)) | ((11,12),(13,14)) | [(11,12),(13,14)] | [(21,22),(23,24)] | ((21,22),(23,24))(8 rows)-- scaling and rotationSELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul FROM PATH_TBL p1; eight | dist_mul -------+------------------------------ | [(4,3),(10,5)] | ((4,3),(10,5)) | [(0,0),(6,-3),(13,6),(8,11)] | ((4,3),(10,5)) | ((4,3),(10,5)) | [(4,3),(10,5)] | [(34,13),(40,15)] | ((34,13),(40,15))(8 rows)RESET geqo;---- Polygons---- containmentSELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 ~ p.f1 AS contains FROM POLYGON_TBL poly, POINT_TBL p; twentyfour | f1 | f1 | contains ------------+------------+---------------------+---------- | (0,0) | ((2,0),(2,4),(0,0)) | t | (0,0) | ((3,1),(3,3),(1,0)) | f | (0,0) | ((0,0)) | t | (0,0) | ((0,1),(0,1)) | f | (-10,0) | ((2,0),(2,4),(0,0)) | f | (-10,0) | ((3,1),(3,3),(1,0)) | f | (-10,0) | ((0,0)) | f | (-10,0) | ((0,1),(0,1)) | f | (-3,4) | ((2,0),(2,4),(0,0)) | f | (-3,4) | ((3,1),(3,3),(1,0)) | f | (-3,4) | ((0,0)) | f | (-3,4) | ((0,1),(0,1)) | f | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f | (5.1,34.5) | ((0,0)) | f | (5.1,34.5) | ((0,1),(0,1)) | f | (-5,-12) | ((2,0),(2,4),(0,0)) | f | (-5,-12) | ((3,1),(3,3),(1,0)) | f | (-5,-12) | ((0,0)) | f | (-5,-12) | ((0,1),(0,1)) | f | (10,10) | ((2,0),(2,4),(0,0)) | f | (10,10) | ((3,1),(3,3),(1,0)) | f | (10,10) | ((0,0)) | f | (10,10) | ((0,1),(0,1)) | f(24 rows)SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 @ poly.f1 AS contained FROM POLYGON_TBL poly, POINT_TBL p; twentyfour | f1 | f1 | contained ------------+------------+---------------------+----------- | (0,0) | ((2,0),(2,4),(0,0)) | t | (0,0) | ((3,1),(3,3),(1,0)) | f | (0,0) | ((0,0)) | t | (0,0) | ((0,1),(0,1)) | f | (-10,0) | ((2,0),(2,4),(0,0)) | f | (-10,0) | ((3,1),(3,3),(1,0)) | f | (-10,0) | ((0,0)) | f | (-10,0) | ((0,1),(0,1)) | f | (-3,4) | ((2,0),(2,4),(0,0)) | f | (-3,4) | ((3,1),(3,3),(1,0)) | f | (-3,4) | ((0,0)) | f | (-3,4) | ((0,1),(0,1)) | f | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f | (5.1,34.5) | ((0,0)) | f | (5.1,34.5) | ((0,1),(0,1)) | f | (-5,-12) | ((2,0),(2,4),(0,0)) | f | (-5,-12) | ((3,1),(3,3),(1,0)) | f | (-5,-12) | ((0,0)) | f | (-5,-12) | ((0,1),(0,1)) | f | (10,10) | ((2,0),(2,4),(0,0)) | f | (10,10) | ((3,1),(3,3),(1,0)) | f | (10,10) | ((0,0)) | f | (10,10) | ((0,1),(0,1)) | f(24 rows)SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon FROM POLYGON_TBL; four | npoints | polygon ------+---------+--------------------- | 3 | ((2,0),(2,4),(0,0)) | 3 | ((3,1),(3,3),(1,0)) | 1 | ((0,0)) | 2 | ((0,1),(0,1))(4 rows)SELECT '' AS four, polygon(f1) FROM BOX_TBL; four | polygon ------+------------------------------------------- | ((0,0),(0,2),(2,2),(2,0)) | ((1,1),(1,3),(3,3),(3,1)) | ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5)) | ((3,3),(3,3),(3,3),(3,3))(4 rows)SELECT '' AS four, polygon(f1) FROM PATH_TBL WHERE isclosed(f1); four | polygon ------+------------------- | ((1,2),(3,4)) | ((1,2),(3,4)) | ((1,2),(3,4)) | ((11,12),(13,14))(4 rows)SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon FROM PATH_TBL WHERE isopen(f1); four | open_path | polygon ------+---------------------------+--------------------------- | [(1,2),(3,4)] | ((1,2),(3,4)) | [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6)) | [(1,2),(3,4)] | ((1,2),(3,4)) | [(11,12),(13,14)] | ((11,12),(13,14))(4 rows)-- convert circles to polygons using the default number of pointsSELECT '' AS six, polygon(f1) FROM CIRCLE_TBL; six | polygon -----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ((2,1),(2.40192378865,2.5),(3.5,3.59807621135),(5,4),(6.5,3.59807621135),(7.59807621135,2.5),(8,1),(7.59807621135,-0.5),(6.5,-1.59807621135),(5,-2),(3.5,-1.59807621135),(2.40192378865,-0.5)) | ((-99,2),(-85.6025403784,52),(-49,88.6025403784),(1,102),(51,88.6025403784),(87.6025403784,52),(101,2),(87.6025403784,-48),(51,-84.6025403784),(1,-98),(-49,-84.6025403784),(-85.6025403784,-48)) | ((-4,3),(-3.33012701892,5.5),(-1.5,7.33012701892),(1,8),(3.5,7.33012701892),(5.33012701892,5.5),(6,3),(5.33012701892,0.5),(3.5,-1.33012701892),(1,-2),(-1.5,-1.33012701892),(-3.33012701892,0.5)) | ((-2,2),(-1.59807621135,3.5),(-0.5,4.59807621135),(1,5),(2.5,4.59807621135),(3.59807621135,3.5),(4,2),(3.59807621135,0.5),(2.5,-0.598076211353),(1,-1),(-0.5,-0.598076211353),(-1.59807621135,0.5)) | ((90,200),(91.3397459622,205),(95,208.660254038),(100,210),(105,208.660254038),(108.660254038,205),(110,200),(108.660254038,195),(105,191.339745962),(100,190),(95,191.339745962),(91.3397459622,195)) | ((-15,1),(0.40707856479,58.5),(42.5,100.592921435),(100,116),(157.5,100.592921435),(199.592921435,58.5),(215,1),(199.592921435,-56.5),(157.5,-98.5929214352),(100,-114),(42.5,-98.5929214352),(0.40707856479,-56.5))(6 rows)-- convert the circle to an 8-point polygonSELECT '' AS six, polygon(8, f1) FROM CIRCLE_TBL; six | polygon -----+------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356)) | ((-99,2),(-69.7106781187,72.7106781187),(1,102),(71.7106781187,72.7106781187),(101,2),(71.7106781187,-68.7106781187),(1,-98),(-69.7106781187,-68.7106781187)) | ((-4,3),(-2.53553390593,6.53553390593),(1,8),(4.53553390593,6.53553390593),(6,3),(4.53553390593,-0.535533905933),(1,-2),(-2.53553390593,-0.535533905933)) | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356)) | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188)) | ((-15,1),(18.6827201635,82.3172798365),(100,116),(181.317279836,82.3172798365),(215,1),(181.317279836,-80.3172798365),(100,-114),(18.6827201635,-80.3172798365))(6 rows)---- Circles--SELECT '' AS six, circle(f1, 50.0) FROM POINT_TBL; six | circle -----+----------------- | <(0,0),50> | <(-10,0),50> | <(-3,4),50> | <(5.1,34.5),50> | <(-5,-12),50> | <(10,10),50>(6 rows)SELECT '' AS four, circle(f1) FROM BOX_TBL; four | circle ------+----------------------- | <(1,1),1.41421356237> | <(2,2),1.41421356237> | <(2.5,3),0.5> | <(3,3),0>(4 rows)SELECT '' AS two, circle(f1) FROM POLYGON_TBL WHERE (# f1) >= 3; two | circle -----+----------------------------------------------- | <(1.33333333333,1.33333333333),2.04168905064> | <(2.33333333333,1.33333333333),1.47534300379>(2 rows)SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance FROM CIRCLE_TBL c1, POINT_TBL p1 WHERE (p1.f1 <-> c1.f1) > 0 ORDER BY distance, circle using <, point using <<; twentyfour | circle | point | distance ------------+----------------+------------+--------------- | <(1,2),3> | (-3,4) | 1.472135955 | <(5,1),3> | (0,0) | 2.09901951359 | <(5,1),3> | (-3,4) | 5.54400374532 | <(1,3),5> | (-10,0) | 6.40175425099 | <(1,3),5> | (10,10) | 6.40175425099 | <(5,1),3> | (10,10) | 7.29563014099 | <(1,2),3> | (-10,0) | 8.1803398875 | <(1,2),3> | (10,10) | 9.04159457879 | <(1,3),5> | (-5,-12) | 11.1554944214 | <(5,1),3> | (-10,0) | 12.0332963784 | <(1,2),3> | (-5,-12) | 12.2315462117 | <(5,1),3> | (-5,-12) | 13.4012194669 | <(1,3),5> | (5.1,34.5) | 26.7657047773 | <(1,2),3> | (5.1,34.5) | 29.7575945393 | <(5,1),3> | (5.1,34.5) | 30.5001492534 | <(100,200),10> | (5.1,34.5) | 180.778038568 | <(100,200),10> | (10,10) | 200.237960416 | <(100,200),10> | (-3,4) | 211.415898255 | <(100,200),10> | (0,0) | 213.60679775 | <(100,200),10> | (-10,0) | 218.25424421 | <(100,200),10> | (-5,-12) | 226.577682802(21 rows)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -