更新时间:2024-04-18 GMT+08:00
分享

几何函数

area(object)

描述:计算图形的面积。

返回类型:double precision

示例:

1
2
3
4
5
SELECT area(box '((0,0),(1,1))') AS RESULT;
 result 
--------
      1
(1 row)

center(object)

描述:计算图形的中心。

返回类型:point

示例:

1
2
3
4
5
SELECT center(box '((0,0),(1,2))') AS RESULT;
 result  
---------
 (0.5,1)
(1 row)

diameter(circle)

描述:计算圆的直径。

返回类型:double precision

示例:

1
2
3
4
5
SELECT diameter(circle '((0,0),2.0)') AS RESULT;
 result 
--------
      4
(1 row)

height(box)

描述:矩形的竖直高度。

返回类型:double precision

示例:

1
2
3
4
5
SELECT height(box '((0,0),(1,1))') AS RESULT;
 result 
--------
      1
(1 row)

isclosed(path)

描述:图形是否为闭合路径。

返回类型:boolean

示例:

1
2
3
4
5
SELECT isclosed(path '((0,0),(1,1),(2,0))') AS RESULT;
 result 
--------
 t
(1 row)

isopen(path)

描述:图形是否为开放路径。

返回类型:boolean

示例:

1
2
3
4
5
SELECT isopen(path '[(0,0),(1,1),(2,0)]') AS RESULT;
 result 
--------
 t
(1 row)

length(object)

描述:计算图形的长度。

返回类型:double precision

示例:

1
2
3
4
5
SELECT length(path '((-1,0),(1,0))') AS RESULT;
 result 
--------
      4
(1 row)

npoints(path)

描述:计算路径的顶点数。

返回类型:int

示例:

1
2
3
4
5
SELECT npoints(path '[(0,0),(1,1),(2,0)]') AS RESULT;
 result 
--------
      3
(1 row)

npoints(polygon)

描述:计算多边形的顶点数。

返回类型:int

示例:

1
2
3
4
5
SELECT npoints(polygon '((1,1),(0,0))') AS RESULT;
 result 
--------
      2
(1 row)

pclose(path)

描述:把路径转换为闭合路径。

返回类型:path

示例:

1
2
3
4
5
SELECT pclose(path '[(0,0),(1,1),(2,0)]') AS RESULT;
       result        
---------------------
 ((0,0),(1,1),(2,0))
(1 row)

popen(path)

描述:把路径转换为开放路径。

返回类型:path

示例:

1
2
3
4
5
SELECT popen(path '((0,0),(1,1),(2,0))') AS RESULT;
       result        
---------------------
 [(0,0),(1,1),(2,0)]
(1 row)

radius(circle)

描述:计算圆的半径。

返回类型:double precision

示例:

1
2
3
4
5
SELECT radius(circle '((0,0),2.0)') AS RESULT;
 result 
--------
      2
(1 row)

width(box)

描述:计算矩形的水平尺寸。

返回类型:double precision

示例:

1
2
3
4
5
SELECT width(box '((0,0),(1,1))') AS RESULT;
 result 
--------
      1
(1 row)
分享:

    相关文档

    相关产品