[instancer/L4] Fix crossing calculation

This commit is contained in:
Behdad Esfahbod 2023-06-21 09:47:08 -06:00
parent 060b5f36bf
commit 023ad3a363
2 changed files with 20 additions and 1 deletions

View File

@ -100,7 +100,7 @@ def _solve(tent, axisLimit, negative=False):
if gain > outGain:
# Crossing point on the axis.
crossing = peak + ((1 - gain) * (upper - peak) / (1 - outGain))
crossing = peak + (1 - gain) * (upper - peak)
loc = (axisDef, peak, crossing)
scalar = 1

View File

@ -91,6 +91,25 @@ class RebaseTentTest(object):
(-1, (-1, -1, 0)),
],
),
pytest.param(
(0.0, 0.5, 1),
(0, 0.5, 0.75),
[
(1, None),
(-0.5, (0, 1, 1)),
(-1, (-1, -1, 0)),
],
),
pytest.param(
(0.0, 0.5, 1),
(0, 0.25, 0.8),
[
(0.5, None),
(0.5, (0, 0.45454545, 0.9090909090)),
(-0.1, (0.9090909090, 1.0, 1.0)),
(-0.5, (-1, -1, 0)),
],
),
# Case 3a/1neg
pytest.param(
(0.0, 0.5, 2),