diff options
author | Neil Fuller <nfuller@google.com> | 2014-10-23 12:54:49 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-23 12:54:49 +0000 |
commit | 72b6e99903e53f4d0c775e84a2cde84888d91691 (patch) | |
tree | 39a90e19e4f328c501915e3125c8e3a2a301484c /InCallUI/src/com | |
parent | 737e925cc889f211acbcf6c3ebfa91a9a6808cea (diff) | |
parent | 279b67ae1df52bc77f43c9252f7de1b2bbbd246c (diff) |
am 6676f4e2: Merge "Remove dependencies on FloatMath"
* commit '6676f4e282b0c1166a4fd92c8f0a3c78ac8b37b5':
Remove dependencies on FloatMath
Diffstat (limited to 'InCallUI/src/com')
3 files changed, 9 insertions, 10 deletions
diff --git a/InCallUI/src/com/android/incallui/AccelerometerListener.java b/InCallUI/src/com/android/incallui/AccelerometerListener.java index 1a7077866..95f48e363 100644 --- a/InCallUI/src/com/android/incallui/AccelerometerListener.java +++ b/InCallUI/src/com/android/incallui/AccelerometerListener.java @@ -120,7 +120,7 @@ public final class AccelerometerListener { if (x == 0.0 || y == 0.0 || z == 0.0) return; // magnitude of the acceleration vector projected onto XY plane - final double xy = Math.sqrt(x*x + y*y); + final double xy = Math.hypot(x, y); // compute the vertical angle double angle = Math.atan2(xy, z); // convert to degrees diff --git a/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java b/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java index a5733de2c..993f8b962 100644 --- a/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java +++ b/InCallUI/src/com/android/incallui/widget/multiwaveview/GlowPadView.java @@ -882,7 +882,7 @@ public class GlowPadView extends View { // tx and ty are relative to wave center float tx = eventX - mWaveCenterX; float ty = eventY - mWaveCenterY; - float touchRadius = (float) Math.sqrt(dist2(tx, ty)); + float touchRadius = (float) Math.hypot(tx, ty); final float scale = touchRadius > mOuterRadius ? mOuterRadius / touchRadius : 1.0f; float limitX = tx * scale; float limitY = ty * scale; diff --git a/InCallUI/src/com/android/incallui/widget/multiwaveview/PointCloud.java b/InCallUI/src/com/android/incallui/widget/multiwaveview/PointCloud.java index 77aac2bda..07a2cb964 100644 --- a/InCallUI/src/com/android/incallui/widget/multiwaveview/PointCloud.java +++ b/InCallUI/src/com/android/incallui/widget/multiwaveview/PointCloud.java @@ -20,7 +20,6 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.drawable.Drawable; -import android.util.FloatMath; import android.util.Log; import java.util.ArrayList; @@ -151,8 +150,8 @@ public class PointCloud { float eta = PI/2.0f; float dEta = 2.0f * PI / pointsInBand; for (int i = 0; i < pointsInBand; i++) { - float x = r * FloatMath.cos(eta); - float y = r * FloatMath.sin(eta); + float x = r * (float) Math.cos(eta); + float y = r * (float) Math.sin(eta); eta += dEta; mPointCloud.add(new Point(x, y, r)); } @@ -168,7 +167,7 @@ public class PointCloud { } private static float hypot(float x, float y) { - return FloatMath.sqrt(x*x + y*y); + return (float) Math.hypot(x, y); } private static float max(float a, float b) { @@ -181,8 +180,8 @@ public class PointCloud { float glowAlpha = 0.0f; if (glowDistance < glowManager.radius) { - float cosf = FloatMath.cos(PI * 0.25f * glowDistance / glowManager.radius); - glowAlpha = glowManager.alpha * max(0.0f, (float) Math.pow(cosf, 10.0f)); + double cos = Math.cos(Math.PI * 0.25d * glowDistance / glowManager.radius); + glowAlpha = glowManager.alpha * max(0.0f, (float) Math.pow(cos, 10.0d)); } // Compute contribution from Wave @@ -190,8 +189,8 @@ public class PointCloud { float distanceToWaveRing = (radius - waveManager.radius); float waveAlpha = 0.0f; if (distanceToWaveRing < waveManager.width * 0.5f && distanceToWaveRing < 0.0f) { - float cosf = FloatMath.cos(PI * 0.25f * distanceToWaveRing / waveManager.width); - waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cosf, 20.0f)); + double cos = Math.cos(Math.PI * 0.25d * distanceToWaveRing / waveManager.width); + waveAlpha = waveManager.alpha * max(0.0f, (float) Math.pow(cos, 20.0d)); } return (int) (max(glowAlpha, waveAlpha) * 255); |