File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,15 @@ bool TabletFilterNoiseReduction::GetPosition(Vector2D *outputVector) {
5858
5959// Update
6060void TabletFilterNoiseReduction::Update () {
61+
62+ // One position in the buffer?
63+ if (bufferPositionCount == 1 ) {
64+ position.x = buffer[0 ].x ;
65+ position.y = buffer[0 ].y ;
66+ return ;
67+ }
68+
69+ // Calculate geometric median from the buffer positions
6170 GetGeometricMedianVector (&position, iterations);
6271
6372 // Reset the buffer when distance to last target position is larger than the threshold
@@ -72,6 +81,9 @@ void TabletFilterNoiseReduction::Update() {
7281
7382
7483
84+ //
85+ // Reset buffer
86+ //
7587void TabletFilterNoiseReduction::ResetBuffer () {
7688 bufferPositionCount = 0 ;
7789 bufferCurrentIndex = 0 ;
You can’t perform that action at this time.
0 commit comments