ST_Rotate
更新時(shí)間:
將一個(gè)幾何對(duì)象逆時(shí)針旋轉(zhuǎn)指定的角度。
語(yǔ)法
geometry ST_Rotate(geometry geomA , float rotRadians);
geometry ST_Rotate(geometry geomA , float rotRadians , float x0 , float y0);
geometry ST_Rotate(geometry geomA , float rotRadians , geometry pointOrigin);
參數(shù)
參數(shù)名稱(chēng) | 描述 |
geomA | 目標(biāo)Geometry對(duì)象。 |
rotRadians | 旋轉(zhuǎn)的弧度。 |
x0 | 旋轉(zhuǎn)原點(diǎn)的X坐標(biāo)。 |
y0 | 旋轉(zhuǎn)原點(diǎn)的Y坐標(biāo)。 |
pointOrigin | 作為旋轉(zhuǎn)原點(diǎn)的Point對(duì)象。 |
描述
若不指定旋轉(zhuǎn)原點(diǎn),則以Point(0,0)作為旋轉(zhuǎn)原點(diǎn)。
該函數(shù)支持Circular Strings、Curves、Polyhedral surfaces、Triangles、Triangulated Irregular Network Surfaces(TIN)和3D對(duì)象。
示例
旋轉(zhuǎn)180度:
SELECT ST_AsEWKT(ST_Rotate('LINESTRING (1 2,2 2)'::geometry, pi())); st_asewkt ------------------------- LINESTRING(-1 -2,-2 -2) (1 row)
以(-1,-1)為旋轉(zhuǎn)原點(diǎn),逆時(shí)針旋轉(zhuǎn)30度:
SELECT ST_AsEWKT(ST_Rotate('LINESTRING (1 2,2 2)'::geometry, pi()/6,-1,-1)); st_asewkt --------------------------------------------------------------- LINESTRING(-0.767949192431122 2.59807621135332,0.098076211353. .316 3.09807621135332) (1 row)
以中心點(diǎn)為旋轉(zhuǎn)原點(diǎn),順時(shí)針旋轉(zhuǎn)30度:
SELECT ST_AsEWKT(ST_Rotate('LINESTRING (1 2,2 2)'::geometry, pi()/6,ST_Centroid('LINESTRING (1 2,2 2)'::geometry))); st_asewkt --------------------------------------------------------- LINESTRING(1.06698729810778 1.75,1.93301270189222 2.25) (1 row)
文檔內(nèi)容是否對(duì)您有幫助?