Name

ST_Rotate — Rotates a geometry about an origin point.

Synopsis

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

설명

Rotates geometry rotRadians counter-clockwise about the origin point. The rotation origin can be specified either as a POINT geometry, or as x and y coordinates. If the origin is not specified, the geometry is rotated about POINT(0 0).

개선 사항: 2.0.0 버전부터 다면체 표면, 삼각형 및 TIN을 지원하기 시작했습니다.

Enhanced: 2.0.0 additional parameters for specifying the origin of rotation were added.

Availability: 1.1.2. Name changed from Rotate to ST_Rotate in 1.2.2

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

예시

This example rotates a geometry by 180 degrees.

SELECT ST_AsText(ST_Rotate('LINESTRING (50 160, 50 50, 100 50)'::geometry, pi()), 6);
LINESTRING(-50 -160,-50 -50,-100 -50)

This example rotates a geometry 30 degrees counter-clockwise around x=50, y=160.

SELECT ST_AsText(ST_Rotate('LINESTRING (50 160, 50 50, 100 50)'::geometry, pi()/6, 50, 160), 6);
LINESTRING(50 160,105 64.737206,148.30127 89.737206)

This example rotates a geometry 60 degrees clockwise around its centroid.

SELECT ST_AsText(ST_Rotate(geom, -pi()/3, ST_Centroid(geom)), 4)
FROM (SELECT 'LINESTRING (50 160, 50 50, 100 50)'::geometry AS geom) AS foo;
LINESTRING(116.4225 130.6721,21.1597 75.6721,46.1597 32.3708)