[instancer.solver] More fixes

This commit is contained in:
Behdad Esfahbod 2022-08-08 09:35:10 -06:00
parent 264ac96288
commit dd5452527e
2 changed files with 38 additions and 6 deletions

View File

@ -58,14 +58,24 @@ def _solveWithGain(tent, axisLimit):
crossing = peak + ((1 - gain) * (upper - peak) / (1 - outGain))
loc1 = (peak, peak, crossing)
scalar1 = 1
loc = (peak, peak, crossing)
scalar = 1
loc2 = (crossing, axisMax, axisMax)
scalar2 = supportScalar({'tag': axisMax}, {'tag': tent})
out.append((scalar - gain, loc))
out.append((scalar1 - gain, loc1))
if (peak < upper):
if upper >= axisMax:
loc = (crossing, axisMax, axisMax)
scalar = supportScalar({'tag': axisMax}, {'tag': tent})
out.append((scalar - gain, loc))
else:
loc1 = (crossing, upper, axisMax)
scalar1 = 0
loc2 = (upper, axisMax, axisMax)
scalar2 = supportScalar({'tag': axisMax}, {'tag': tent})
out.append((scalar1 - gain, loc1))
out.append((scalar2 - gain, loc2))
# case 3: outermost limit still fits within F2Dot14 bounds;

View File

@ -135,6 +135,28 @@ class RebaseTentTest(object):
(-.4, (.8, 1, 1)),
]
),
#
# Misc corner cases
#
pytest.param(
(.5, .5, .5), (.5, .5, .5),
[
(1, (0, 0, 0)),
]
),
pytest.param(
(.3, .5, .7), (.1, .5, .9),
[
(1, (-1, 0, 1)),
(-1, (0, 0.4999999999999999, 1)),
(-1, (0.4999999999999999, 1, 1)),
(-1, (-1, -.5, 0)),
(-1, (-1, -1, -.5)),
]
),
],
)
def test_rebaseTent(self, tent, axisRange, expected):