Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
packages_apps_Camera2
Commits
c0dd3adf
Commit
c0dd3adf
authored
10 years ago
by
Neil Fuller
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Download
Plain Diff
Merge "Remove dependencies on FloatMath"
parents
d0927687
35f0ea43
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
8 deletions
+7
-8
src/com/android/camera/crop/GeometryMathUtils.java
src/com/android/camera/crop/GeometryMathUtils.java
+4
-4
src/com/android/camera/ui/PieRenderer.java
src/com/android/camera/ui/PieRenderer.java
+2
-3
src/com/android/camera/util/CameraUtil.java
src/com/android/camera/util/CameraUtil.java
+1
-1
No files found.
src/com/android/camera/crop/GeometryMathUtils.java
View file @
c0dd3adf
...
...
@@ -102,7 +102,7 @@ public final class GeometryMathUtils {
}
public
static
float
[]
normalize
(
float
[]
a
)
{
float
length
=
(
float
)
Math
.
sqr
t
(
a
[
0
]
*
a
[
0
]
+
a
[
1
]
*
a
[
1
]);
float
length
=
(
float
)
Math
.
hypo
t
(
a
[
0
]
,
a
[
1
]);
float
[]
b
=
{
a
[
0
]
/
length
,
a
[
1
]
/
length
};
...
...
@@ -111,7 +111,7 @@ public final class GeometryMathUtils {
// A onto B
public
static
float
scalarProjection
(
float
[]
a
,
float
[]
b
)
{
float
length
=
(
float
)
Math
.
sqr
t
(
b
[
0
]
*
b
[
0
]
+
b
[
1
]
*
b
[
1
]);
float
length
=
(
float
)
Math
.
hypo
t
(
b
[
0
]
,
b
[
1
]);
return
dotProduct
(
a
,
b
)
/
length
;
}
...
...
@@ -126,7 +126,7 @@ public final class GeometryMathUtils {
float
[]
p
=
{
point2
[
0
]
-
point1
[
0
],
point2
[
1
]
-
point1
[
1
]
};
float
length
=
(
float
)
Math
.
sqr
t
(
p
[
0
]
*
p
[
0
]
+
p
[
1
]
*
p
[
1
]);
float
length
=
(
float
)
Math
.
hypo
t
(
p
[
0
]
,
p
[
1
]);
p
[
0
]
=
p
[
0
]
/
length
;
p
[
1
]
=
p
[
1
]
/
length
;
return
p
;
...
...
@@ -149,7 +149,7 @@ public final class GeometryMathUtils {
}
public
static
float
vectorLength
(
float
[]
a
)
{
return
(
float
)
Math
.
sqr
t
(
a
[
0
]
*
a
[
0
]
+
a
[
1
]
*
a
[
1
]);
return
(
float
)
Math
.
hypo
t
(
a
[
0
]
,
a
[
1
]);
}
public
static
float
scale
(
float
oldWidth
,
float
oldHeight
,
float
newWidth
,
float
newHeight
)
{
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/ui/PieRenderer.java
View file @
c0dd3adf
...
...
@@ -30,7 +30,6 @@ import android.graphics.PointF;
import
android.graphics.RectF
;
import
android.os.Handler
;
import
android.os.Message
;
import
android.util.FloatMath
;
import
android.view.MotionEvent
;
import
android.view.ViewConfiguration
;
import
android.view.animation.Animation
;
...
...
@@ -379,7 +378,7 @@ public class PieRenderer extends OverlayRenderer
}
private
void
layoutLabel
(
int
level
)
{
int
x
=
mPieCenterX
-
(
int
)
(
Float
Math
.
sin
(
mCenterAngle
-
CENTER
)
int
x
=
mPieCenterX
-
(
int
)
(
Math
.
sin
(
mCenterAngle
-
CENTER
)
*
(
mArcRadius
+
(
level
+
2
)
*
mRadiusInc
));
int
y
=
mArcCenterY
-
mArcRadius
-
(
level
+
2
)
*
mRadiusInc
;
int
w
=
mLabel
.
getIntrinsicWidth
();
...
...
@@ -734,7 +733,7 @@ public class PieRenderer extends OverlayRenderer
x
=
x
-
mPieCenterX
;
float
y1
=
mSliceCenterY
-
getLevel
()
*
mRadiusInc
-
y
;
float
y2
=
mArcCenterY
-
getLevel
()
*
mRadiusInc
-
y
;
res
.
y
=
(
float
)
Math
.
sqrt
(
x
*
x
+
y2
*
y2
);
res
.
y
=
(
float
)
Math
.
hypot
(
x
,
y2
);
if
(
x
!=
0
)
{
res
.
x
=
(
float
)
Math
.
atan2
(
y1
,
x
);
if
(
res
.
x
<
0
)
{
...
...
This diff is collapsed.
Click to expand it.
src/com/android/camera/util/CameraUtil.java
View file @
c0dd3adf
...
...
@@ -385,7 +385,7 @@ public class CameraUtil {
public
static
float
distance
(
float
x
,
float
y
,
float
sx
,
float
sy
)
{
float
dx
=
x
-
sx
;
float
dy
=
y
-
sy
;
return
(
float
)
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
return
(
float
)
Math
.
hypot
(
dx
,
dy
);
}
public
static
int
clamp
(
int
x
,
int
min
,
int
max
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment