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

FloatMath is deprecated. use Math instead #73

Open
wants to merge 2 commits into
base: master
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
10 changes: 5 additions & 5 deletions main/src/com/polites/android/MathUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ public class MathUtils {
public static float distance(MotionEvent event) {
float x = event.getX(0) - event.getX(1);
float y = event.getY(0) - event.getY(1);
return FloatMath.sqrt(x * x + y * y);
return (float)Math.sqrt(x * x + y * y);
}

public static float distance(PointF p1, PointF p2) {
float x = p1.x - p2.x;
float y = p1.y - p2.y;
return FloatMath.sqrt(x * x + y * y);
return (float)Math.sqrt(x * x + y * y);
}

public static float distance(float x1, float y1, float x2, float y2) {
float x = x1 - x2;
float y = y1 - y2;
return FloatMath.sqrt(x * x + y * y);
return (float)Math.sqrt(x * x + y * y);
}

public static void midpoint(MotionEvent event, PointF point) {
Expand All @@ -62,8 +62,8 @@ public void rotate(PointF p1, PointF p2, float angle) {
float py = p1.y;
float ox = p2.x;
float oy = p2.y;
p1.x = (FloatMath.cos(angle) * (px-ox) - FloatMath.sin(angle) * (py-oy) + ox);
p1.y = (FloatMath.sin(angle) * (px-ox) + FloatMath.cos(angle) * (py-oy) + oy);
p1.x = ((float)Math.cos(angle) * (px-ox) - (float)Math.sin(angle) * (py-oy) + ox);
p1.y = ((float)Math.sin(angle) * (px-ox) + (float)Math.cos(angle) * (py-oy) + oy);
}

public static float angle(PointF p1, PointF p2) {
Expand Down
4 changes: 2 additions & 2 deletions main/src/com/polites/android/VectorF.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class VectorF {
public final PointF end = new PointF();

public void calculateEndPoint() {
end.x = FloatMath.cos(angle) * length + start.x;
end.y = FloatMath.sin(angle) * length + start.y;
end.x = (float)Math.cos(angle) * length + start.x;
end.y = (float)Math.sin(angle) * length + start.y;
}

public void setStart(PointF p) {
Expand Down