Debian Codegraph @

docs/resampling.typ

raw
1 #set page(width: 16cm, margin: 0.5em, height: auto)
2 #let definition(content) = box(fill: luma(92%), width: 100%, inset: 0.5em, stroke: black)[#content]
3
4 #let pr = $nu$
5 #let time = $t$
6
7 == Resampling
8 #let inv = $v$
9
10 *Algorithm* : Upsampling\
11 *Input* : ${inv[k] = (x[k],y[k],t[k]), 0 <= k <= n}$ and a target rate `sampling_min_output_rate`\, Interpolate time and
12 position between each $k$ by linearly adding interpolated values\
13 This is done by adding linearly interpolated values so that the output stream is
14 $
15 {
16 inv[0], underbrace(u_0[1]\, dots\, u_0[n_0-1], "interpolated"), inv[
17 1
18 ], underbrace(u_1[1]\, dots\, u_1[n_1 - 1 ], "interpolated"),inv[2], dots
19 }
20 $
21 Each $n_i$ is the minimum integer such that
22 $
23 & (t[i]-t[i-1]) / n_i < Delta_"target"\
24 <=> & n_i = ceil((t[i+1]-t[i])/Delta_"target")
25 $
26 and the linear interpolation means
27 $
28 u_j [k] = (1 - k / n_j) inv[j] + k / n_i inv[j+1]
29 $\
30 *Output* : ${(x'[k'],y'[k'],t'[k']), 0 <= k; <= n'}$ the upsampled position and times. This verifies $
31 forall k', t'[k'] - t'[k'-1] < Delta_"target" = 1/#text[`sampling_min_output_rate`]
32 $\
33 *Remark* : As this is a streaming algorithm, we only calculate this interpolation with respect to the latest stroke
34 position.