Name

ST_RotateY — Rotates a geometry, an Angle (in radians), around the Y axis.

Synopsis

bytea ST_RotateY(bytea Geometry, double AngleRadians);

Alias

RotateY

Description

Rotates a geometry, an Angle (in radians), around the Y axis. In the following table transformation matrices and equations to transform the vertices are shown.

Transformation matrix

Equations to transform the vertices

[Note]

ST_RotateY (geomA, rotRadians) is an abreviation for the method:

ST_Affine(geomA, cos(rotRadians), 0, sin(rotRadians), 0, 1, 0, -sin(rotRadians), 0, cos(rotRadians), 0, 0, 0)

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

--Rotates 180º a 4D Point
SELECT ST_AsEWKT(ST_RotateY(ST_GeomFromEWKT('POINT (1 2.5 3 4)'),pi()));
--Result
POINT (-1 2.5 -3 4)

--Rotates 90º 
SELECT ST_AsEWKT(ST_RotateY(ST_GeomFromEWKT('LINESTRING (10 10 15, 5 2 10)'),pi()/2));
--Result
LINESTRING (15 10 -9.999999999999998, 10 2 -4.999999999999999)

--Same Rotation with ST_Affine
SELECT ST_AsEWKT(ST_Affine(geomA, cos(rotRadians), 0, sin(rotRadians), 0, 1, 0, -sin(rotRadians), 0, cos(rotRadians), 0, 0, 0)) 
FROM (SELECT ST_GeomFromEWKT('LINESTRING (10 10 15, 5 2 10)') as geomA, pi()/2 as rotRadians) as foo;  

--Result
LINESTRING (15 10 -9.999999999999998, 10 2 -4.999999999999999)

Related functions

ST_AffineST_RotateXST_RotateZ