[postgis-users] Scale without translate?
rindahl at lrcwe.com
Thu May 17 14:54:11 PDT 2007
The third line translates the center of the polygon to the centroid.
The scale function then scales that polygon by a factor of myScale (lines
2,3,4) Finally the final translate (lines 1 and 5) translates the polygon
back to the original center.
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Jeff
Sent: Thursday, May 17, 2007 3:41 PM
To: PostGIS Users Discussion
Subject: [postgis-users] Scale without translate?
What is the cleanest way to scale a polygon without translating it? If,
say, I wanted it doubled in every dimension, but the center to be on the
If I remember my computer graphics classes, I'd have to translate to the
origin, scale, then translate back. Which could be done in three steps,
each of which would be a separate matrix multiplication. Or I could
multiply the three matrices, and do it in one operation.
Reading the docs, It looks like I could do a translate(), scale(),
translate(), or if I knew the matrix I wanted, I could use affine().
Of course, I don't know the matrix I want. I need to get it by
obtaining the center of the polygon I'm trying to scale.
So, can anyone point me to:
1: what function I use to determine the center of a polygon?
2: syntax for building a call to translate() using the function that
determines the center of a polygon?
3: syntax for building a call to affine() that does the
translate/scale/translate, using the function that determines the center
of the polygon, and the scaling factors I supply?
(As an aside, does PSQL include data types and operators for
manipulating transform matrices?)
postgis-users mailing list
postgis-users at postgis.refractions.net
More information about the postgis-users