|
|
@@ -80,17 +80,25 @@ export default class BrushSession extends BaseSession {
|
|
80
|
80
|
}
|
|
81
|
81
|
}
|
|
82
|
82
|
|
|
83
|
|
- // Round the new point (helps keep our data tidy)
|
|
|
83
|
+ // Low pass the current input point against the previous one
|
|
|
84
|
+ const nextPrev = vec.med(this.previous, point)
|
|
|
85
|
+
|
|
|
86
|
+ // A delta to project the projected point
|
|
|
87
|
+ const offset = vec.mul(vec.sub(nextPrev, this.previous), 2)
|
|
|
88
|
+
|
|
|
89
|
+ this.previous = nextPrev
|
|
|
90
|
+
|
|
|
91
|
+ // Generate some temporary points towards a projected point
|
|
84
|
92
|
const temporaryPoints = [0.7, 0.9, 0.95, 1].map((v) =>
|
|
85
|
93
|
vec.round([
|
|
86
|
|
- ...vec.sub(vec.lrp(this.previous, point, v), this.origin),
|
|
|
94
|
+ ...vec.sub(
|
|
|
95
|
+ vec.lrp(this.previous, vec.add(point, offset), v),
|
|
|
96
|
+ this.origin
|
|
|
97
|
+ ),
|
|
87
|
98
|
pressure,
|
|
88
|
99
|
])
|
|
89
|
100
|
)
|
|
90
|
101
|
|
|
91
|
|
- // Low pass the current input point against the previous one
|
|
92
|
|
- this.previous = vec.med(this.previous, point)
|
|
93
|
|
-
|
|
94
|
102
|
// Don't add duplicate points. It's important to test against the
|
|
95
|
103
|
// adjusted (low-passed) point rather than the input point.
|
|
96
|
104
|
|