fix: remove duplicate soften_forward definition (cherry-pick artifact)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
dog
2026-07-09 17:37:01 +08:00
parent 94c52bd3be
commit d1f70e5753

View File

@@ -92,42 +92,6 @@ def enforce_forward_monotonic(forward: np.ndarray) -> np.ndarray:
return forward
def soften_forward(
forward: np.ndarray,
backtrack_tol: float = 0.02,
overshoot_span: float = 0.08,
) -> np.ndarray:
"""Softly regularise the forward axis without destroying natural motion.
Real trajectories contain small backward corrections and overshoot
past the target; hard clipping turns both into visible artifacts
(stacked points, vertical walls). Instead:
- Backtracking is tolerated up to ``backtrack_tol``; larger dips are
raised to ``prev - backtrack_tol``.
- Values above 1.0 are compressed with tanh so they asymptote at
``1 + overshoot_span`` (moderate overshoot survives, extremes
cannot fly far past the target).
- No lower clip: the endpoint warp pins the first point later.
Args:
forward: (T,) forward coordinates.
backtrack_tol: max allowed per-step regression.
overshoot_span: asymptotic max excess above 1.0.
Returns:
New (T,) array.
"""
out = forward.copy()
for i in range(1, len(out)):
floor = out[i - 1] - backtrack_tol
if out[i] < floor:
out[i] = floor
over = out > 1.0
out[over] = 1.0 + overshoot_span * np.tanh((out[over] - 1.0) / overshoot_span)
return out
def damp_start(lateral: np.ndarray, n: int = 4) -> np.ndarray:
"""Dampen lateral oscillation over the first ``n`` points, continuously.