1463{
1464 int leftCount,
1465 rightCount;
1466 float4 ratio,
1467 overlap;
1468 float range;
1469
1470 POSTGIS_DEBUGF(5, "consider split: dimNum = %d, rightLower = %f, "
1471 "minLeftCount = %d, leftUpper = %f, maxLeftCount = %d ",
1472 dimNum, rightLower, minLeftCount, leftUpper, maxLeftCount);
1473
1474
1475
1476
1477
1479 {
1480 leftCount = minLeftCount;
1481 }
1482 else
1483 {
1484 if (maxLeftCount <= context->entriesCount / 2)
1485 leftCount = maxLeftCount;
1486 else
1488 }
1490
1491
1492
1493
1494
1495 ratio = ((float4) Min(leftCount, rightCount)) /
1497
1499 {
1500 bool selectthis = false;
1501
1502
1503
1504
1505
1506
1507
1508
1509 if (dimNum == 0)
1511 else
1513
1514 overlap = (leftUpper - rightLower) / range;
1515
1516
1518 selectthis = true;
1519 else if (context->
dim == dimNum)
1520 {
1521
1522
1523
1524
1525 if (overlap < context->overlap ||
1526 (overlap == context->
overlap && ratio > context->
ratio))
1527 selectthis = true;
1528 }
1529 else
1530 {
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1549 (range > context->
range &&
1551 selectthis = true;
1552 }
1553
1554 if (selectthis)
1555 {
1556
1557 context->
first =
false;
1558 context->
ratio = ratio;
1559 context->
range = range;
1563 context->
dim = dimNum;
1564 POSTGIS_DEBUG(5, "split selected");
1565 }
1566 }
1567}
static float non_negative(float val)