Changeset View
Changeset View
Standalone View
Standalone View
mocap/mocap_tools.py
| Context not available. | |||||
| a = Rxyd[i - 1] | a = Rxyd[i - 1] | ||||
| b = Rxyd[i] | b = Rxyd[i] | ||||
| #sign change (zerocrossing) at point i, denoting max point (only) | #sign change (zerocrossing) at point i, denoting max point (only) | ||||
| if (a >= 0 and b < 0) or (a < 0 and b >= 0): | if (a >= 0 > b) or (a < 0 <= b): | ||||
| maxs.append((i, max(Rxy[i], Rxy[i - 1]))) | maxs.append((i, max(Rxy[i], Rxy[i - 1]))) | ||||
| return [x[0] for x in maxs] | return [x[0] for x in maxs] | ||||
| #~ return max(maxs, key=lambda x: x[1])[0] | #~ return max(maxs, key=lambda x: x[1])[0] | ||||
| Context not available. | |||||
| #calculate max error and point where it occurs | #calculate max error and point where it occurs | ||||
| maxError, maxErrorPt = maxErrorAmount(data_pts, bez, s, e) | maxError, maxErrorPt = maxErrorAmount(data_pts, bez, s, e) | ||||
| #if error is small enough, reparameterization might be enough | #if error is small enough, reparameterization might be enough | ||||
| if maxError < reparaError and maxError > error: | if reparaError > maxError > error: | ||||
| for i in range(maxIterations): | for i in range(maxIterations): | ||||
| newtonRaphson(data_pts, s, e, bez) | newtonRaphson(data_pts, s, e, bez) | ||||
| if e - s < 3: | if e - s < 3: | ||||
| Context not available. | |||||