PostgreSQL polygon(circle) 函数

PostgreSQL polygon(circle) 函数将一个圆形转成一个由十二个点表示的多边形并返回。

polygon(circle) 语法

这是 PostgreSQL polygon(circle) 函数的语法:

polygon(circle) -> polygon

参数

circle
必需的。 一个圆形。例如: circle '<(0,0),2>'

返回值

PostgreSQL polygon(circle) 函数返回一个由参数指定的圆形转成的由十二个点表示的多边形。

polygon(circle) 示例

下面的语句示例展示了如何使用 PostgreSQL polygon(circle) 函数将圆形 circle '<(0,0),2>' 转为多边形。

SELECT polygon(circle '<(0,0),2>');
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ((-2,0),(-1.7320508075688774,0.9999999999999999),(-1.0000000000000002,1.7320508075688772),(-1.2246467991473532e-16,2),(0.9999999999999996,1.7320508075688774),(1.732050807568877,1.0000000000000007),(2,2.4492935982947064e-16),(1.7320508075688776,-0.9999999999999994),(1.0000000000000009,-1.732050807568877),(3.6739403974420594e-16,-2),(-0.9999999999999987,-1.732050807568878),(-1.7320508075688767,-1.0000000000000009))

下面的语句示例展示了如何使用 PostgreSQL polygon(circle) 函数将圆形 circle '<(1,2),3>' 转为多边形。

SELECT polygon(circle '<(1,2),3>');
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ((-2,2),(-1.598076211353316,3.5),(-0.5000000000000004,4.598076211353316),(0.9999999999999998,5),(2.499999999999999,4.598076211353316),(3.5980762113533156,3.500000000000001),(4,2.0000000000000004),(3.5980762113533165,0.5000000000000009),(2.5000000000000013,-0.5980762113533156),(1.0000000000000004,-1),(-0.499999999999998,-0.5980762113533169),(-1.5980762113533151,0.49999999999999867))