1610{
1611 int leftCount,
1612 rightCount;
1613 float4 ratio,
1614 overlap;
1615 float range;
1616
1617 POSTGIS_DEBUGF(5, "consider split: dimNum = %d, rightLower = %f, "
1618 "minLeftCount = %d, leftUpper = %f, maxLeftCount = %d ",
1619 dimNum, rightLower, minLeftCount, leftUpper, maxLeftCount);
1620
1621
1622
1623
1624
1626 {
1627 leftCount = minLeftCount;
1628 }
1629 else
1630 {
1631 if (maxLeftCount <= context->entriesCount / 2)
1632 leftCount = maxLeftCount;
1633 else
1635 }
1637
1638
1639
1640
1641
1642 ratio = ((float4) Min(leftCount, rightCount)) /
1644
1646 {
1647 bool selectthis = false;
1648
1649
1650
1651
1652
1653
1654
1655
1656 if (dimNum == 0)
1658 else
1660
1661 overlap = (leftUpper - rightLower) / range;
1662
1663
1665 selectthis = true;
1666 else if (context->
dim == dimNum)
1667 {
1668
1669
1670
1671
1672 if (overlap < context->overlap ||
1673 (overlap == context->
overlap && ratio > context->
ratio))
1674 selectthis = true;
1675 }
1676 else
1677 {
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1696 (range > context->
range &&
1698 selectthis = true;
1699 }
1700
1701 if (selectthis)
1702 {
1703
1704 context->
first =
false;
1705 context->
ratio = ratio;
1706 context->
range = range;
1710 context->
dim = dimNum;
1711 POSTGIS_DEBUG(5, "split selected");
1712 }
1713 }
1714}
static float non_negative(float val)