[postgis-users] ST_RotateX with pointOrigin!

Bborie Park dustymugs at gmail.com
Sun Dec 15 10:29:47 PST 2013


Start in the regress directory found in the root of the postgis source.
You'll see that there are always two files for any particular test
(MYTEST.sql and MYTEST_expected). To include MYTEST as part of "make
check", you add MYTEST to regress/Makefile.in

-bborie


On Sat, Dec 14, 2013 at 10:29 PM, Stephen Mather
<stephen at smathermather.com>wrote:

> I have ticketed.  It's a little messy of a ticket (actually two), so
> apologies for that.
>
> http://trac.osgeo.org/postgis/ticket/2570
> http://trac.osgeo.org/postgis/ticket/2571
>
> I have not yet written any unit tests.  Where would I begin...
>
>
>
> On Sun, Dec 15, 2013 at 1:02 AM, Bborie Park <dustymugs at gmail.com> wrote:
>
>> Sweet. Can you create a ticket and attach the patch?
>>
>> Some unit tests would be nice so that expected behavior is maintained...
>> and bugs are caught.
>>
>> Thanks!
>>
>> -bborie
>>
>>
>> On Sat, Dec 14, 2013 at 7:57 PM, Stephen Mather <
>> stephen at smathermather.com> wrote:
>>
>>> Ahem-- bugs fixed:
>>>
>>> -- Function: st_rotatex(geometry, double precision, geometry)
>>> CREATE OR REPLACE FUNCTION ST_RotateX(geomA geometry, rotRadians
>>> double precision, pointOrigin geometry)
>>>   RETURNS geometry AS
>>> $BODY$
>>>
>>> ----- Transform geometry to nullsville (0,0,0) so rotRadians will take
>>> place around the pointOrigin
>>> WITH transformed AS (
>>>     SELECT ST_Translate(geomA, -1 * ST_X(pointOrigin), -1 *
>>> ST_Y(pointOrigin), -1 * ST_Z(pointOrigin)) AS the_geom
>>>     ),
>>> ----- Rotate in place
>>> rotated AS (
>>>     SELECT ST_RotateX(the_geom, rotRadians) AS the_geom FROM transformed
>>>     ),
>>> ----- Translate back home
>>> rotTrans AS (
>>>     SELECT ST_Translate(the_geom, ST_X(pointOrigin),
>>> ST_Y(pointOrigin), ST_Z(pointOrigin)) AS the_geom
>>>     FROM rotated
>>>     )
>>> ----- profit
>>> SELECT the_geom from rotTrans
>>>
>>> ;
>>>
>>> $BODY$
>>>   LANGUAGE sql VOLATILE
>>>   COST 100;
>>>
>>>
>>> On Sat, Dec 14, 2013 at 8:37 PM, Stephen Mather
>>> <stephen at smathermather.com> wrote:
>>> > Hi All,
>>> >
>>> > I think I avoided doing linear algebra, which is good since I never
>>> > studied it... .
>>> >
>>> > This is my cludgy patch for making a version of
>>> >
>>> > geometry ST_RotateX(geometry geomA, float rotRadians, geometry
>>> pointOrigin)
>>> >
>>> > It's not pretty enough to be a real patch ('cause my brain couldn't do
>>> > that whole linear algebra thing, and hence why it's here and not the
>>> > developers list), but thought I'd share it anyway and get impressions,
>>> > and have some brighter minds make sure I don't have some major logic
>>> > failure here:
>>> >
>>> > -------
>>> >
>>> > DROP FUNCTION st_rotatex(geometry,double precision,geometry);
>>> >
>>> > CREATE OR REPLACE FUNCTION ST_RotateX(geomA geometry, rotRadians
>>> > double precision, pointOrigin geometry)
>>> >   RETURNS geometry AS
>>> > $BODY$
>>> >
>>> > ----- Transform geometry to nullsville (0,0,0) so rotRadians will take
>>> > place around the pointOrigin
>>> > WITH transformed AS (
>>> >     SELECT ST_Translate(geomA, -1 * ST_X(pointOrigin), -1 *
>>> > ST_Y(pointOrigin), -1 * ST_Z(pointOrigin)) AS the_geom
>>> >     ),
>>> > ----- Rotate in place
>>> > rotated AS (
>>> >     SELECT ST_RotateX(the_geom, rotRadians) FROM transformed
>>> >     ),
>>> > ----- Translate back home
>>> > rotTrans AS (
>>> >     SELECT ST_Translate(geomA, ST_X(pointOrigin), ST_Y(pointOrigin),
>>> > ST_Z(pointOrigin)) AS the_geom
>>> >     )
>>> > ----- profit
>>> > SELECT the_geom from rotTrans
>>> >
>>> > ;
>>> >
>>> > $BODY$
>>> >   LANGUAGE sql VOLATILE
>>> >   COST 100;
>>> _______________________________________________
>>> postgis-users mailing list
>>> postgis-users at lists.osgeo.org
>>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>>
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>>
>
>
> _______________________________________________
> 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/c6e243c0/attachment.html>


More information about the postgis-users mailing list