PostGIS  2.1.10dev-r@@SVN_REVISION@@
void ptarray_affine ( POINTARRAY pa,
const AFFINE affine 
)

Affine transform a pointarray.

Definition at line 1692 of file ptarray.c.

References AFFINE::afac, AFFINE::bfac, AFFINE::cfac, AFFINE::dfac, AFFINE::efac, AFFINE::ffac, POINTARRAY::flags, FLAGS_GET_Z, getPoint4d_p(), AFFINE::gfac, AFFINE::hfac, AFFINE::ifac, LWDEBUG, LWDEBUGF, POINTARRAY::npoints, ptarray_set_point4d(), pixval::x, POINT4D::x, AFFINE::xoff, pixval::y, POINT4D::y, AFFINE::yoff, POINT4D::z, and AFFINE::zoff.

Referenced by lwgeom_affine().

1693 {
1694  int i;
1695  double x,y,z;
1696  POINT4D p4d;
1697 
1698  LWDEBUG(2, "lwgeom_affine_ptarray start");
1699 
1700  if ( FLAGS_GET_Z(pa->flags) )
1701  {
1702  LWDEBUG(3, " has z");
1703 
1704  for (i=0; i<pa->npoints; i++)
1705  {
1706  getPoint4d_p(pa, i, &p4d);
1707  x = p4d.x;
1708  y = p4d.y;
1709  z = p4d.z;
1710  p4d.x = a->afac * x + a->bfac * y + a->cfac * z + a->xoff;
1711  p4d.y = a->dfac * x + a->efac * y + a->ffac * z + a->yoff;
1712  p4d.z = a->gfac * x + a->hfac * y + a->ifac * z + a->zoff;
1713  ptarray_set_point4d(pa, i, &p4d);
1714 
1715  LWDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, x, p4d.x, p4d.y, p4d.z);
1716  }
1717  }
1718  else
1719  {
1720  LWDEBUG(3, " doesn't have z");
1721 
1722  for (i=0; i<pa->npoints; i++)
1723  {
1724  getPoint4d_p(pa, i, &p4d);
1725  x = p4d.x;
1726  y = p4d.y;
1727  p4d.x = a->afac * x + a->bfac * y + a->xoff;
1728  p4d.y = a->dfac * x + a->efac * y + a->yoff;
1729  ptarray_set_point4d(pa, i, &p4d);
1730 
1731  LWDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, x, p4d.x, p4d.y, p4d.z);
1732  }
1733  }
1734 
1735  LWDEBUG(3, "lwgeom_affine_ptarray end");
1736 
1737 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:501
double x
Definition: liblwgeom.h:308
int npoints
Definition: liblwgeom.h:327
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
uint8_t flags
Definition: liblwgeom.h:325
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
double z
Definition: liblwgeom.h:308
tuple x
Definition: pixval.py:53
double y
Definition: liblwgeom.h:308
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
tuple y
Definition: pixval.py:54
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:217

Here is the call graph for this function:

Here is the caller graph for this function: