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
2041 float deltaX, deltaY, c1m, c2m;
2044 float min1X, max1X, max1Y, min1Y, min2X, max2X, max2Y, min2Y;
2053 LWDEBUG(2,
"lw_dist2d_fast_ptarray_ptarray is called");
2064 c1.
x = min1X + (max1X - min1X) / 2;
2065 c1.
y = min1Y + (max1Y - min1Y) / 2;
2066 c2.
x = min2X + (max2X - min2X) / 2;
2067 c2.
y = min2Y + (max2Y - min2Y) / 2;
2069 deltaX = (c2.
x - c1.
x);
2070 deltaY = (c2.
y - c1.
y);
2075 if ((deltaX * deltaX) < (deltaY * deltaY))
2077 k = -deltaX / deltaY;
2078 for (t = 0; t < n1; t++)
2081 thevalue = theP->
y - (k * theP->
x);
2085 for (t = 0; t < n2; t++)
2088 thevalue = theP->
y - (k * theP->
x);
2092 c1m = c1.
y - (k * c1.
x);
2093 c2m = c2.
y - (k * c2.
x);
2101 k = -deltaY / deltaX;
2102 for (t = 0; t < n1; t++)
2105 thevalue = theP->
x - (k * theP->
y);
2110 for (t = 0; t < n2; t++)
2113 thevalue = theP->
x - (k * theP->
y);
2118 c1m = c1.
x - (k * c1.
y);
2119 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.