名前

ST_Rotate — ジオメトリを原点について回転させます。

概要

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);

説明

ジオメトリを原点について反時計回りにrotRadiasnぶん回転させます。原点はPOINTジオメトリか、xとyの座標値を指定します。原点を指定しない場合にはPOINT(0,0)について回転させます。

Enhanced: 2.0.0 多面体サーフェス対応、三角対応、TIN対応が導入されました。

Enhanced: 2.0.0 回転の原点を指定するパラメタを追加しました。

Availability: 1.1.2 RotateからST_Rotateに名称変更しました。

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves

This function supports Polyhedral surfaces.

This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).

-- 180度回転
SELECT ST_AsEWKT(ST_Rotate('LINESTRING (50 160, 50 50, 100 50)', pi()));
               st_asewkt
---------------------------------------
 LINESTRING(-50 -160,-50 -50,-100 -50)
(1 row)

-- x=50,y=160で反時計回りに30度回転
SELECT ST_AsEWKT(ST_Rotate('LINESTRING (50 160, 50 50, 100 50)', pi()/6, 50, 160));
                                 st_asewkt
---------------------------------------------------------------------------
 LINESTRING(50 160,105 64.7372055837117,148.301270189222 89.7372055837117)
(1 row)

-- 重心位置で時計回りに60度回転
SELECT ST_AsEWKT(ST_Rotate(geom, -pi()/3, ST_Centroid(geom)))
FROM (SELECT 'LINESTRING (50 160, 50 50, 100 50)'::geometry AS geom) AS foo;
                           st_asewkt
--------------------------------------------------------------
 LINESTRING(116.4225 130.6721,21.1597 75.6721,46.1597 32.3708)
(1 row)
                

関連情報

ST_Affine, ST_RotateX, ST_RotateY, ST_RotateZ