# Module to smooth out sploines. # Last edited on 2021-06-08 04:56:38 by jstolfi import sploine_smooth_IMP def curves(STS): # The argument {STS} must be a /sploine/ as defined in {sploine.py}, # that is, a list of states {(u,t,f)}, possibly interspersed by {Null} # elements. # # The procedure smooths out the curve {STS} by adjusting halfwidths # and positions of states so as to minimize the integral of the # squared jerk, while trying to retain the total length. # # The {None} elements are interpreted as gaps (zero-order # discontinuities) in the curve and are not chaned. States with {f=2} # are not changed either. States with {f=1} may be adjusted in # position but will retain their tangent direction. States with {f=0} # may be adjusted in both positon and tangent. # # Thus each section of the curve that is delimited by {None}s or # begins or ends with states with {f=2} is smoothed independently. . return sploine_smooth_IMP.curves(STS)