ST_RotateX — Rotates a geometry, an Angle (in radians), around the X axis.
bytea ST_RotateX(
bytea
Geometry, double
AngleRadians)
;
Rotates a geometry, an Angle (in radians), around the X axis. In the following table transformation matrices and equations to transform the vertices are shown.
Transformation matrix | Equations to transform the vertices |
ST_RotateX (geomA, rotRadians) is an abreviation for the method: ST_Affine(geomA, 1, 0, 0, 0, cos(rotRadians), -sin(rotRadians), 0, sin(rotRadians), cos(rotRadians), 0, 0, 0) |
2D | 3D | M |
---|---|---|
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 |
---|---|---|---|
- | - | - | - |
--Rotates 180º a 4D Point SELECT ST_AsEWKT(ST_RotateX(ST_GeomFromEWKT('POINT (1 2.5 3 4)'),pi())); --Result POINT (1 -2.5 -3 4) --Rotates 90º SELECT ST_AsEWKT(ST_RotateX(ST_GeomFromEWKT('LINESTRING (10 10 15, 5 2 10)'),pi()/2)); --Result LINESTRING (10 -15 10.000000000000002, 5 -10 2) --Same Rotation with ST_Affine SELECT ST_AsEWKT(ST_Affine(geomA, 1, 0, 0, 0, cos(rotRadians), -sin(rotRadians), 0, sin(rotRadians), 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 (10 -15 10.000000000000002, 5 -10 2)