Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove low-pass filter from gestures #240

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ public class GestureRecognizer {

protected List<GestureListener> listenerList = new ArrayList<>();

protected float lowPassWeight = 0.4f;

@WorldWind.GestureState
private int state = WorldWind.POSSIBLE;

Expand Down Expand Up @@ -244,12 +242,10 @@ protected void handleActionPointerDown(MotionEvent event) {

protected void handleActionMove(MotionEvent event) {
this.eventCentroid(event, this.centroidArray);
float dx = this.centroidArray[0] - this.startX + this.centroidShiftX;
float dy = this.centroidArray[1] - this.startY + this.centroidShiftY;
this.translationX = this.centroidArray[0] - this.startX + this.centroidShiftX;
this.translationY = this.centroidArray[1] - this.startY + this.centroidShiftY;
this.x = this.centroidArray[0];
this.y = this.centroidArray[1];
this.translationX = this.lowPassFilter(this.translationX, dx);
this.translationY = this.lowPassFilter(this.translationY, dy);

this.actionMove(event);
}
Expand Down Expand Up @@ -318,11 +314,6 @@ protected float[] eventCentroid(MotionEvent event, float[] result) {
return result;
}

protected float lowPassFilter(float value, float newValue) {
float w = this.lowPassWeight;
return value * (1 - w) + newValue * w;
}

protected void actionDown(MotionEvent event) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ protected void actionMove(MotionEvent event) {
}
} else if (state == WorldWind.BEGAN || state == WorldWind.CHANGED) {
float distance = this.currentPinchDistance(event);
float newScale = Math.abs(distance / this.referenceDistance);
this.scale = this.lowPassFilter(this.scale, newScale);
this.scale = Math.abs(distance / this.referenceDistance);
this.transitionToState(event, WorldWind.CHANGED);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ protected void actionMove(MotionEvent event) {
}
} else if (state == WorldWind.BEGAN || state == WorldWind.CHANGED) {
float angle = this.currentTouchAngle(event);
float newRotation = (float) WWMath.normalizeAngle180(angle - this.referenceAngle);
this.rotation = this.lowPassFilter(this.rotation, newRotation);
this.rotation = (float) WWMath.normalizeAngle180(angle - this.referenceAngle);
this.transitionToState(event, WorldWind.CHANGED);
}
}
Expand Down