1663{
1664 uint32_t i;
1665 double tolsq = tolerance * tolerance;
1668 uint32_t n_points = pa->
npoints;
1669 uint32_t n_points_out = 1;
1671
1672 double dsq = FLT_MAX;
1673
1674
1675 if ( n_points <= min_points ) return;
1676
1678 void *p_to = ((char *)last) + pt_size;
1679 for (i = 1; i < n_points; i++)
1680 {
1681 int last_point = (i == n_points - 1);
1682
1683
1685
1686
1687 if (n_points + n_points_out > min_points + i)
1688 {
1689 if (tolerance > 0.0)
1690 {
1691
1693
1694 if (!last_point && dsq <= tolsq)
1695 {
1696 continue;
1697 }
1698 }
1699 else
1700 {
1701
1702 if (memcmp((char*)pt, (char*)last, pt_size) == 0)
1703 continue;
1704 }
1705
1706
1707
1708
1709
1710 if (last_point && n_points_out > 1 && tolerance > 0.0 && dsq <= tolsq)
1711 {
1712 n_points_out--;
1713 p_to = (char*)p_to - pt_size;
1714 }
1715 }
1716
1717
1718 memcpy(p_to, pt, pt_size);
1719 n_points_out++;
1720 p_to = (char*)p_to + pt_size;
1721 last = pt;
1722 }
1723
1725 return;
1726}
static double distance2d_sqr_pt_pt(const POINT2D *p1, const POINT2D *p2)
static size_t ptarray_point_size(const POINTARRAY *pa)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.