PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ ptarray_affine()

void ptarray_affine ( POINTARRAY pa,
const AFFINE a 
)

Affine transform a pointarray.

Definition at line 1758 of file ptarray.c.

1759 {
1760  uint32_t i;
1761  double x,y,z;
1762  POINT4D p4d;
1763 
1764  LWDEBUG(2, "lwgeom_affine_ptarray start");
1765 
1766  if ( FLAGS_GET_Z(pa->flags) )
1767  {
1768  LWDEBUG(3, " has z");
1769 
1770  for (i=0; i<pa->npoints; i++)
1771  {
1772  getPoint4d_p(pa, i, &p4d);
1773  x = p4d.x;
1774  y = p4d.y;
1775  z = p4d.z;
1776  p4d.x = a->afac * x + a->bfac * y + a->cfac * z + a->xoff;
1777  p4d.y = a->dfac * x + a->efac * y + a->ffac * z + a->yoff;
1778  p4d.z = a->gfac * x + a->hfac * y + a->ifac * z + a->zoff;
1779  ptarray_set_point4d(pa, i, &p4d);
1780 
1781  LWDEBUGF(3, " POINT %g %g %g => %g %g %g", x, y, z, p4d.x, p4d.y, p4d.z);
1782  }
1783  }
1784  else
1785  {
1786  LWDEBUG(3, " doesn't have z");
1787 
1788  for (i=0; i<pa->npoints; i++)
1789  {
1790  getPoint4d_p(pa, i, &p4d);
1791  x = p4d.x;
1792  y = p4d.y;
1793  p4d.x = a->afac * x + a->bfac * y + a->xoff;
1794  p4d.y = a->dfac * x + a->efac * y + a->yoff;
1795  ptarray_set_point4d(pa, i, &p4d);
1796 
1797  LWDEBUGF(3, " POINT %g %g => %g %g", x, y, p4d.x, p4d.y);
1798  }
1799  }
1800 
1801  LWDEBUG(3, "lwgeom_affine_ptarray end");
1802 
1803 }
#define FLAGS_GET_Z(flags)
Definition: liblwgeom.h:179
int getPoint4d_p(const POINTARRAY *pa, uint32_t n, POINT4D *point)
Definition: lwgeom_api.c:125
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
Definition: lwgeom_api.c:376
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
double gfac
Definition: liblwgeom.h:318
double zoff
Definition: liblwgeom.h:318
double bfac
Definition: liblwgeom.h:318
double ifac
Definition: liblwgeom.h:318
double xoff
Definition: liblwgeom.h:318
double dfac
Definition: liblwgeom.h:318
double afac
Definition: liblwgeom.h:318
double ffac
Definition: liblwgeom.h:318
double cfac
Definition: liblwgeom.h:318
double hfac
Definition: liblwgeom.h:318
double efac
Definition: liblwgeom.h:318
double yoff
Definition: liblwgeom.h:318
double x
Definition: liblwgeom.h:400
double z
Definition: liblwgeom.h:400
double y
Definition: liblwgeom.h:400
lwflags_t flags
Definition: liblwgeom.h:417
uint32_t npoints
Definition: liblwgeom.h:413

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: