PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ ptarray_affine()

void ptarray_affine ( POINTARRAY pa,
const AFFINE a 
)

Affine transform a pointarray.

Definition at line 1760 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().

1761 {
1762  int i;
1763  double x,y,z;
1764  POINT4D p4d;
1765 
1766  LWDEBUG(2, "lwgeom_affine_ptarray start");
1767 
1768  if ( FLAGS_GET_Z(pa->flags) )
1769  {
1770  LWDEBUG(3, " has z");
1771 
1772  for (i=0; i<pa->npoints; i++)
1773  {
1774  getPoint4d_p(pa, i, &p4d);
1775  x = p4d.x;
1776  y = p4d.y;
1777  z = p4d.z;
1778  p4d.x = a->afac * x + a->bfac * y + a->cfac * z + a->xoff;
1779  p4d.y = a->dfac * x + a->efac * y + a->ffac * z + a->yoff;
1780  p4d.z = a->gfac * x + a->hfac * y + a->ifac * z + a->zoff;
1781  ptarray_set_point4d(pa, i, &p4d);
1782 
1783  LWDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, z, p4d.x, p4d.y, p4d.z);
1784  }
1785  }
1786  else
1787  {
1788  LWDEBUG(3, " doesn't have z");
1789 
1790  for (i=0; i<pa->npoints; i++)
1791  {
1792  getPoint4d_p(pa, i, &p4d);
1793  x = p4d.x;
1794  y = p4d.y;
1795  p4d.x = a->afac * x + a->bfac * y + a->xoff;
1796  p4d.y = a->dfac * x + a->efac * y + a->yoff;
1797  ptarray_set_point4d(pa, i, &p4d);
1798 
1799  LWDEBUGF(3, " POINT %g %g => %g %g", x, y, p4d.x, p4d.y);
1800  }
1801  }
1802 
1803  LWDEBUG(3, "lwgeom_affine_ptarray end");
1804 
1805 }
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
Definition: lwgeom_api.c:549
double x
Definition: liblwgeom.h:351
int npoints
Definition: liblwgeom.h:370
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
double zoff
Definition: liblwgeom.h:269
double ifac
Definition: liblwgeom.h:269
double ffac
Definition: liblwgeom.h:269
double xoff
Definition: liblwgeom.h:269
double afac
Definition: liblwgeom.h:269
uint8_t flags
Definition: liblwgeom.h:368
double cfac
Definition: liblwgeom.h:269
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:139
double dfac
Definition: liblwgeom.h:269
double z
Definition: liblwgeom.h:351
double efac
Definition: liblwgeom.h:269
double yoff
Definition: liblwgeom.h:269
double y
Definition: liblwgeom.h:351
double gfac
Definition: liblwgeom.h:269
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
double hfac
Definition: liblwgeom.h:269
double bfac
Definition: liblwgeom.h:269
int getPoint4d_p(const POINTARRAY *pa, int n, POINT4D *point)
Definition: lwgeom_api.c:244
Here is the call graph for this function:
Here is the caller graph for this function: