[postgis-users] ST_RotateX with pointOrigin!

Stephen Mather stephen at smathermather.com
Sun Dec 15 20:50:17 PST 2013


Hmm, I know so little about Euler, strike, dip and rake.  What are the
advantages?

What I do know is that it's easy now to construct a 3 axis rotation
function (which also might be better handled with ST_Affine):

http://trac.osgeo.org/postgis/attachment/ticket/2575/

-- Function: st_rotatezyz(geometry, double precision, double precision,
double precision, geometry)
CREATE OR REPLACE FUNCTION ST_RotateXYZ(geomA geometry, rotRadiansX double
precision, rotRadiansY double precision, rotRadiansZ double precision,
pointOrigin geometry)
  RETURNS geometry AS
$BODY$

-- Rotate around X-axis
WITH rotatedX AS (
    SELECT ST_RotateX(geomA, rotRadiansX, pointOrigin) AS geom
    ),
-- Rotate around Y-axis
rotatedXY AS (
    SELECT ST_RotateY(geom, rotRadiansY, pointOrigin) AS geom
      FROM rotatedX
    ),
-- Rotate around Z-axis
rotatedXYZ AS (
    SELECT ST_Rotate(geom, rotRadiansZ, pointOrigin) AS geom
      FROM rotatedXY
    )
-- Return rotated geometry
SELECT geom from rotatedXYZ
;

$BODY$
  LANGUAGE sql VOLATILE
  COST 100;



On Sun, Dec 15, 2013 at 9:27 PM, Mike Toews <mwtoews at gmail.com> wrote:

> What do you need to rotate on either X or Y axes? And is it always aligned
> to either grid directions? I personally see these functions as rather
> limiting and wouldn't miss them if they vanished.
>
> I have thought of developing a better 3d rotate function that is
> independent of grid X and Y assumptions. Either a function that takes Euler
> angles, or strike & dip (& possibly rake) angles used by geologists. If
> there is any interest on these, I can figure some stuff out.
>
> -Mike
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131215/4e4c524e/attachment.html>


More information about the postgis-users mailing list