Skip to content

PostgreSQL box(circle) 函数 ​

PostgreSQL box(circle) 函数计算并返回一个指定的圆的内切的矩形。

一个矩形 box 由右上角的点和左下角的点表示,比如:(1,1),(0,0)

box(circle) 语法 ​

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

sql
box(circle) -> box

参数 ​

  • circle

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

返回值 ​

PostgreSQL box(circle) 函数返回一个指定的圆的内切的矩形。

box(circle) 示例 ​

下面的语句示例展示了如何使用 PostgreSQL box(circle) 函数计算圆 circle '<(0,0),1>' 的内切的矩形。

sql
SELECT box(circle '<(0,0),1>');
bash
                                        box
-----------------------------------------------------------------------------------
 (0.7071067811865475,0.7071067811865475),(-0.7071067811865475,-0.7071067811865475)

下面的语句展示了如何使用 PostgreSQL box(circle) 函数计算圆 circle '<(5,5),2>' 的内切的矩形。

sql
SELECT box(circle '<(5,5),2>');
bash
                                     box
-----------------------------------------------------------------------------
 (6.414213562373095,6.414213562373095),(3.585786437626905,3.585786437626905)