The new faster calculation comparing pointarray to another pointarray the arrays can come from both polygons and linestrings.
The naming is not good but comes from that it compares a chosen selection of the points not all of them
2040 float deltaX, deltaY, c1m, c2m;
2043 float min1X, max1X, max1Y, min1Y, min2X, max2X, max2Y, min2Y;
2052 LWDEBUG(2,
"lw_dist2d_fast_ptarray_ptarray is called");
2063 c1.
x = min1X + (max1X - min1X) / 2;
2064 c1.
y = min1Y + (max1Y - min1Y) / 2;
2065 c2.
x = min2X + (max2X - min2X) / 2;
2066 c2.
y = min2Y + (max2Y - min2Y) / 2;
2068 deltaX = (c2.
x - c1.
x);
2069 deltaY = (c2.
y - c1.
y);
2074 if ((deltaX * deltaX) < (deltaY * deltaY))
2076 k = -deltaX / deltaY;
2077 for (t = 0; t < n1; t++)
2080 thevalue = theP->
y - (k * theP->
x);
2084 for (t = 0; t < n2; t++)
2087 thevalue = theP->
y - (k * theP->
x);
2091 c1m = c1.
y - (k * c1.
x);
2092 c2m = c2.
y - (k * c2.
x);
2100 k = -deltaY / deltaX;
2101 for (t = 0; t < n1; t++)
2104 thevalue = theP->
x - (k * theP->
y);
2109 for (t = 0; t < n2; t++)
2112 thevalue = theP->
x - (k * theP->
y);
2117 c1m = c1.
x - (k * c1.
y);
2118 c2m = c2.
x - (k * c2.
y);
void * lwalloc(size_t size)
#define LW_TRUE
Return types for functions with status returns.
#define LWDEBUG(level, msg)
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
int struct_cmp_by_measure(const void *a, const void *b)
int lw_dist2d_pre_seg_seg(POINTARRAY *l1, POINTARRAY *l2, LISTSTRUCT *list1, LISTSTRUCT *list2, double k, DISTPTS *dl)
preparation before lw_dist2d_seg_seg.