1658 double TotalWidth = 0;
1659 double PartialWidth = 0;
1662 double closestMass = 0;
1663 double tmpLow1, tmpHigh1, deltaX, deltaY1, slope1;
1664 double deltaY2, tmpLow2, tmpHigh2, slope2, step;
1668 if (ID > 17 || ID < 0){
return 0; }
1673 if (mHrequested < 100 || mHrequested > 1000){
return 0; }
1677 if (mHrequested <= 140){ step = 10; i = (int)((mHrequested - 100)/step); closestMass = (int)(step*i + 100); }
1678 if (mHrequested > 140 && mHrequested <= 150){ step = 5; i = (int)(4 + (mHrequested-140)/step); closestMass = (step*(i-4) + 140); }
1679 if (mHrequested > 150 && mHrequested <= 190){ step = 1; i = (int)(6 + (mHrequested-150)/step); closestMass = (int)(step*(i-6) + 150); }
1680 if (mHrequested > 190 && mHrequested <= 200){ step = 5; i = (int)(46 + (mHrequested-190)/step); closestMass = (int)(step*(i-46) + 190); }
1681 if (mHrequested > 200 && mHrequested <= 330){ step = 10; i = (int)(48 + (mHrequested-200)/step); closestMass = (int)(step*(i-48) + 200); }
1682 if (mHrequested > 330 && mHrequested <= 335){ step = 5; i = (int)(61 + (mHrequested-330)/step); closestMass = (int)(step*(i-61) + 330); }
1683 if (mHrequested > 335 && mHrequested <= 340){ step = 1; i = (int)(62 + (mHrequested-335)/step); closestMass = (int)(step*(i-62) + 335); }
1684 if (mHrequested > 340 && mHrequested <= 345){ step = 5; i = (int)(67 + (mHrequested-340)/step); closestMass = (int)(step*(i-67) + 340); }
1685 if (mHrequested > 345 && mHrequested <= 355){ step = 1; i = (int)(68 + (mHrequested-345)/step); closestMass = (int)(step*(i-68) + 345); }
1686 if (mHrequested > 355 && mHrequested <= 360){ step = 5; i = (int)(78 + (mHrequested-355)/step); closestMass = (int)(step*(i-78) + 355); }
1687 if (mHrequested > 360 && mHrequested <= 370){ step = 10; i = (int)(79 + (mHrequested-360)/step); closestMass = (int)(step*(i-79) + 360); }
1688 if (mHrequested > 370 && mHrequested <= 380){ step = 5; i = (int)(80 + (mHrequested-370)/step); closestMass = (int)(step*(i-80) + 370); }
1689 if (mHrequested > 380 && mHrequested <= 500){ step = 10; i = (int)(82 + (mHrequested-380)/step); closestMass = (int)(step*(i-82) + 380); }
1690 if (mHrequested > 500 && mHrequested <= 800){ step = 50; i = (int)(94 + (mHrequested-500)/step); closestMass = (int)(step*(i-94) + 500); }
1691 if (mHrequested > 800 && mHrequested <= 1000){ step = 200; i = (int)(100 + (mHrequested-800)/step); closestMass = (int)(step*(i-100) + 800); }
1699 tmpHigh2 =
BR_SM4[0][i+1];
1700 deltaX = mHrequested - closestMass;
1702 deltaY1 = tmpHigh1 - tmpLow1;
1703 slope1 = deltaY1/step;
1706 deltaY2 = tmpHigh2 - tmpLow2;
1707 slope2 = deltaY2/step;
1712 PartialWidth = tmpLow1;
1713 TotalWidth = tmpLow2;
1716 PartialWidth = slope1*deltaX + tmpLow1;
1717 TotalWidth = slope2*deltaX + tmpLow2;
1721 if (ID == 0){ Width = TotalWidth; }
1722 else{ Width = PartialWidth; }