Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4649)

Unified Diff: chrome/browser/android/vr_shell/vr_math.cc

Issue 2730883003: Remove unnecessary UI element math. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/vr_math.cc
diff --git a/chrome/browser/android/vr_shell/vr_math.cc b/chrome/browser/android/vr_shell/vr_math.cc
index 112d491c7d26e30d9995d767f0574a04e044ad35..72b1c3e6a31231dc5c909ec334892b5157e4a232 100644
--- a/chrome/browser/android/vr_shell/vr_math.cc
+++ b/chrome/browser/android/vr_shell/vr_math.cc
@@ -46,26 +46,6 @@ void TranslateM(gvr::Mat4f& tmat, gvr::Mat4f& mat, float x, float y, float z) {
tmat.m[2][3] += z;
}
-// Right multiply a translation matrix.
-void TranslateMRight(gvr::Mat4f& tmat,
- gvr::Mat4f& mat,
- float x,
- float y,
- float z) {
- if (&tmat != &mat) {
- for (int i = 0; i < 4; ++i) {
- for (int j = 0; j < 3; ++j) {
- tmat.m[i][j] = mat.m[i][j];
- }
- }
- }
-
- for (int i = 0; i < 4; i++) {
- tmat.m[i][3] =
- mat.m[i][0] * x + mat.m[i][1] * y + mat.m[i][2] * z + mat.m[i][3];
- }
-}
-
// Left multiply a scale matrix.
void ScaleM(gvr::Mat4f& tmat,
const gvr::Mat4f& mat,
@@ -87,27 +67,6 @@ void ScaleM(gvr::Mat4f& tmat,
}
}
-// Right multiply a scale matrix.
-void ScaleMRight(gvr::Mat4f& tmat,
- const gvr::Mat4f& mat,
- float x,
- float y,
- float z) {
- if (&tmat != &mat) {
- for (int i = 0; i < 4; ++i) {
- for (int j = 0; j < 3; ++j) {
- tmat.m[i][j] = mat.m[i][j];
- }
- }
- }
- // Multiply columns, don't change translation components.
- for (int i = 0; i < 3; ++i) {
- tmat.m[i][0] *= x;
- tmat.m[i][1] *= y;
- tmat.m[i][2] *= z;
- }
-}
-
gvr::Mat4f MatrixTranspose(const gvr::Mat4f& mat) {
gvr::Mat4f result;
for (int i = 0; i < 4; ++i) {
@@ -224,6 +183,10 @@ float VectorLength(const gvr::Vec3f& vec) {
return sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z);
}
+gvr::Vec3f VectorSubtract(const gvr::Vec3f& a, const gvr::Vec3f& b) {
+ return {a.x - b.x, a.y - b.y, a.z - b.z};
+}
+
float NormalizeVector(gvr::Vec3f& vec) {
float len = VectorLength(vec);
vec.x /= len;

Powered by Google App Engine
This is Rietveld 408576698