1525 uint32_t split = it_first;
1526 if ((it_first - it_last) < 2)
1535 for (uint32_t itk = it_first + 1; itk < it_last; itk++)
1539 if (distance_sqr > max_distance_sqr)
1542 max_distance_sqr = distance_sqr;
1549 double ba_x = (B->
x - A->
x);
1550 double ba_y = (B->
y - A->
y);
1551 double ab_length_sqr = (ba_x * ba_x + ba_y * ba_y);
1554 max_distance_sqr *= ab_length_sqr;
1555 for (uint32_t itk = it_first + 1; itk < it_last; itk++)
1558 double distance_sqr;
1559 double ca_x = (C->
x - A->
x);
1560 double ca_y = (C->
y - A->
y);
1561 double dot_ac_ab = (ca_x * ba_x + ca_y * ba_y);
1563 if (dot_ac_ab <= 0.0)
1567 else if (dot_ac_ab >= ab_length_sqr)
1573 double s_numerator = ca_x * ba_y - ca_y * ba_x;
1574 distance_sqr = s_numerator * s_numerator;
1577 if (distance_sqr > max_distance_sqr)
1580 max_distance_sqr = distance_sqr;
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static double distance2d_sqr_pt_pt(const POINT2D *p1, const POINT2D *p2)