draw differences from predictions
This commit is contained in:
parent
8ea57efc9f
commit
68e785f0fa
1 changed files with 4 additions and 1 deletions
|
@ -60,12 +60,13 @@ class ProceduralChain():
|
||||||
DeltaT = float # delta_t
|
DeltaT = float # delta_t
|
||||||
|
|
||||||
class DiffSegment():
|
class DiffSegment():
|
||||||
DRAW_DECAY_SPEED = 5
|
DRAW_DECAY_SPEED = 25
|
||||||
|
|
||||||
def __init__(self, prediction: ProjectedTrack):
|
def __init__(self, prediction: ProjectedTrack):
|
||||||
self.ptrack = prediction
|
self.ptrack = prediction
|
||||||
self._last_diff_frame_idx = 0
|
self._last_diff_frame_idx = 0
|
||||||
self.finished = False
|
self.finished = False
|
||||||
|
self.ready = False
|
||||||
|
|
||||||
self.points: List[Coordinate] = []
|
self.points: List[Coordinate] = []
|
||||||
self._drawn_points = []
|
self._drawn_points = []
|
||||||
|
@ -130,9 +131,11 @@ class DiffSegment():
|
||||||
if np.isclose(self._drawn_points[-1], target, atol=.05).all():
|
if np.isclose(self._drawn_points[-1], target, atol=.05).all():
|
||||||
# TODO: might want to migrate to np.isclose()
|
# TODO: might want to migrate to np.isclose()
|
||||||
if len(self._drawn_points) == len(self.points):
|
if len(self._drawn_points) == len(self.points):
|
||||||
|
self.ready = True
|
||||||
return # done until a new point is added
|
return # done until a new point is added
|
||||||
# add new point as drawing head
|
# add new point as drawing head
|
||||||
self._drawn_points.append(self._drawn_points[-1])
|
self._drawn_points.append(self._drawn_points[-1])
|
||||||
|
self.ready = False
|
||||||
|
|
||||||
x = exponentialDecayRounded(self._drawn_points[-1][0], target[0], self.DRAW_DECAY_SPEED, dt, .05)
|
x = exponentialDecayRounded(self._drawn_points[-1][0], target[0], self.DRAW_DECAY_SPEED, dt, .05)
|
||||||
y = exponentialDecayRounded(self._drawn_points[-1][1], target[1], self.DRAW_DECAY_SPEED, dt, .05)
|
y = exponentialDecayRounded(self._drawn_points[-1][1], target[1], self.DRAW_DECAY_SPEED, dt, .05)
|
||||||
|
|
Loading…
Reference in a new issue