1631{
1632 int leftCount,
1633 rightCount;
1634 float4 ratio,
1635 overlap;
1636 float range;
1637
1638 POSTGIS_DEBUGF(5, "consider split: dimNum = %d, rightLower = %f, "
1639 "minLeftCount = %d, leftUpper = %f, maxLeftCount = %d ",
1640 dimNum, rightLower, minLeftCount, leftUpper, maxLeftCount);
1641
1642
1643
1644
1645
1647 {
1648 leftCount = minLeftCount;
1649 }
1650 else
1651 {
1652 if (maxLeftCount <= context->entriesCount / 2)
1653 leftCount = maxLeftCount;
1654 else
1656 }
1658
1659
1660
1661
1662
1663 ratio = ((float4) Min(leftCount, rightCount)) /
1665
1667 {
1668 bool selectthis = false;
1669
1670
1671
1672
1673
1674
1675
1676
1677 if (dimNum == 0)
1679 else
1681
1682 overlap = (leftUpper - rightLower) / range;
1683
1684
1686 selectthis = true;
1687 else if (context->
dim == dimNum)
1688 {
1689
1690
1691
1692
1693 if (overlap < context->overlap ||
1694 (overlap == context->
overlap && ratio > context->
ratio))
1695 selectthis = true;
1696 }
1697 else
1698 {
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1717 (range > context->
range &&
1719 selectthis = true;
1720 }
1721
1722 if (selectthis)
1723 {
1724
1725 context->
first =
false;
1726 context->
ratio = ratio;
1727 context->
range = range;
1731 context->
dim = dimNum;
1732 POSTGIS_DEBUG(5, "split selected");
1733 }
1734 }
1735}
static float non_negative(float val)