PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ptarray_affine()

void ptarray_affine ( POINTARRAY pa,
const AFFINE a 
)

Affine transform a pointarray.

Definition at line 1796 of file ptarray.c.

1797 {
1798  uint32_t i;
1799  double x,y,z;
1800  POINT4D p4d;
1801 
1802  LWDEBUG(2, "lwgeom_affine_ptarray start");
1803 
1804  if ( FLAGS_GET_Z(pa->flags) )
1805  {
1806  LWDEBUG(3, " has z");
1807 
1808  for (i=0; i<pa->npoints; i++)
1809  {
1810  getPoint4d_p(pa, i, &p4d);
1811  x = p4d.x;
1812  y = p4d.y;
1813  z = p4d.z;
1814  p4d.x = a->afac * x + a->bfac * y + a->cfac * z + a->xoff;
1815  p4d.y = a->dfac * x + a->efac * y + a->ffac * z + a->yoff;
1816  p4d.z = a->gfac * x + a->hfac * y + a->ifac * z + a->zoff;
1817  ptarray_set_point4d(pa, i, &p4d);
1818 
1819  LWDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, z, p4d.x, p4d.y, p4d.z);
1820  }
1821  }
1822  else
1823  {
1824  LWDEBUG(3, " doesn't have z");
1825 
1826  for (i=0; i<pa->npoints; i++)
1827  {
1828  getPoint4d_p(pa, i, &p4d);
1829  x = p4d.x;
1830  y = p4d.y;
1831  p4d.x = a->afac * x + a->bfac * y + a->xoff;
1832  p4d.y = a->dfac * x + a->efac * y + a->yoff;
1833  ptarray_set_point4d(pa, i, &p4d);
1834 
1835  LWDEBUGF(3, " POINT %g %g => %g %g", x, y, p4d.x, p4d.y);
1836  }
1837  }
1838 
1839  LWDEBUG(3, "lwgeom_affine_ptarray end");
1840 
1841 }
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:123
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:435
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
double gfac
Definition: liblwgeom.h:273
double zoff
Definition: liblwgeom.h:273
double bfac
Definition: liblwgeom.h:273
double ifac
Definition: liblwgeom.h:273
double xoff
Definition: liblwgeom.h:273
double dfac
Definition: liblwgeom.h:273
double afac
Definition: liblwgeom.h:273
double ffac
Definition: liblwgeom.h:273
double cfac
Definition: liblwgeom.h:273
double hfac
Definition: liblwgeom.h:273
double efac
Definition: liblwgeom.h:273
double yoff
Definition: liblwgeom.h:273
double x
Definition: liblwgeom.h:355
double z
Definition: liblwgeom.h:355
double y
Definition: liblwgeom.h:355
uint32_t npoints
Definition: liblwgeom.h:374
uint8_t flags
Definition: liblwgeom.h:372
unsigned int uint32_t
Definition: uthash.h:78

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(), POINT4D::x, pixval::x, AFFINE::xoff, POINT4D::y, pixval::y, AFFINE::yoff, POINT4D::z, and AFFINE::zoff.

Referenced by lwgeom_affine().

Here is the call graph for this function:
Here is the caller graph for this function: