<div dir="ltr"><div><div>Thanks Bob,<br><br></div>That looks like a great resource. Now when will one of my bits of inspiration get permanently etched into a stone bridge? :D<br><br>Best,<br></div>Steve<br><br><div><div>
<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Dec 15, 2013 at 1:56 AM, Bob and Deb <span dir="ltr"><<a href="mailto:bobdebm@gmail.com" target="_blank">bobdebm@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p dir="ltr">So you don't like to do linear algebra? :-) Well, you might be interested in using Quaternion math for your rotations. You can even do rotations on an arbitrary axis. Take a look at this: <a href="http://3dgep.com/?p=1815" target="_blank">http://3dgep.com/?p=1815</a></p>
<span class="HOEnZb"><font color="#888888">
<p dir="ltr">-Bob</p>
</font></span><div class="gmail_quote"><div><div class="h5">On Dec 14, 2013 7:57 PM, "Stephen Mather" <<a href="mailto:stephen@smathermather.com" target="_blank">stephen@smathermather.com</a>> wrote:<br type="attribution">
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Ahem-- bugs fixed:<br>
<br>
-- Function: st_rotatex(geometry, double precision, geometry)<br>
CREATE OR REPLACE FUNCTION ST_RotateX(geomA geometry, rotRadians<br>
double precision, pointOrigin geometry)<br>
RETURNS geometry AS<br>
$BODY$<br>
<br>
----- Transform geometry to nullsville (0,0,0) so rotRadians will take<br>
place around the pointOrigin<br>
WITH transformed AS (<br>
SELECT ST_Translate(geomA, -1 * ST_X(pointOrigin), -1 *<br>
ST_Y(pointOrigin), -1 * ST_Z(pointOrigin)) AS the_geom<br>
),<br>
----- Rotate in place<br>
rotated AS (<br>
SELECT ST_RotateX(the_geom, rotRadians) AS the_geom FROM transformed<br>
),<br>
----- Translate back home<br>
rotTrans AS (<br>
SELECT ST_Translate(the_geom, ST_X(pointOrigin),<br>
ST_Y(pointOrigin), ST_Z(pointOrigin)) AS the_geom<br>
FROM rotated<br>
)<br>
----- profit<br>
SELECT the_geom from rotTrans<br>
<br>
;<br>
<br>
$BODY$<br>
LANGUAGE sql VOLATILE<br>
COST 100;<br>
<br>
<br>
On Sat, Dec 14, 2013 at 8:37 PM, Stephen Mather<br>
<<a href="mailto:stephen@smathermather.com" target="_blank">stephen@smathermather.com</a>> wrote:<br>
> Hi All,<br>
><br>
> I think I avoided doing linear algebra, which is good since I never<br>
> studied it... .<br>
><br>
> This is my cludgy patch for making a version of<br>
><br>
> geometry ST_RotateX(geometry geomA, float rotRadians, geometry pointOrigin)<br>
><br>
> It's not pretty enough to be a real patch ('cause my brain couldn't do<br>
> that whole linear algebra thing, and hence why it's here and not the<br>
> developers list), but thought I'd share it anyway and get impressions,<br>
> and have some brighter minds make sure I don't have some major logic<br>
> failure here:<br>
><br>
> -------<br>
><br>
> DROP FUNCTION st_rotatex(geometry,double precision,geometry);<br>
><br>
> CREATE OR REPLACE FUNCTION ST_RotateX(geomA geometry, rotRadians<br>
> double precision, pointOrigin geometry)<br>
> RETURNS geometry AS<br>
> $BODY$<br>
><br>
> ----- Transform geometry to nullsville (0,0,0) so rotRadians will take<br>
> place around the pointOrigin<br>
> WITH transformed AS (<br>
> SELECT ST_Translate(geomA, -1 * ST_X(pointOrigin), -1 *<br>
> ST_Y(pointOrigin), -1 * ST_Z(pointOrigin)) AS the_geom<br>
> ),<br>
> ----- Rotate in place<br>
> rotated AS (<br>
> SELECT ST_RotateX(the_geom, rotRadians) FROM transformed<br>
> ),<br>
> ----- Translate back home<br>
> rotTrans AS (<br>
> SELECT ST_Translate(geomA, ST_X(pointOrigin), ST_Y(pointOrigin),<br>
> ST_Z(pointOrigin)) AS the_geom<br>
> )<br>
> ----- profit<br>
> SELECT the_geom from rotTrans<br>
><br>
> ;<br>
><br>
> $BODY$<br>
> LANGUAGE sql VOLATILE<br>
> COST 100;<br></div></div><div class="im">
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div></blockquote></div>
</div>
<br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br></blockquote></div><br></div>