Skip to content
Permalink
Browse files

Test XRRigidTransform.inverse

  • Loading branch information...
Manishearth committed Jun 12, 2019
1 parent 745ed51 commit db7a08b5c64c031533def3a345d170b8436e041e
@@ -19687,11 +19687,11 @@
"testharness"
],
"webxr/obtain_frame.html": [
"902b0aecb449fe051512020f1acb746c92461428",
"f1edfc4d70a2125a44748b378a40b6855f79cc62",
"testharness"
],
"webxr/resources/webxr-util.js": [
"505173c82998a80b1e543f1a18aefaf1891f8269",
"08d9fa69730d2523d4a066636bef4959f3e1a725",
"support"
]
},
@@ -28,14 +28,16 @@
assert_matrix_approx_equals(view.projectionMatrix, VALID_PROJECTION_MATRIX, 0.001, "left projection matrix");
if (view.eye == "left") {
assert_matrix_approx_equals(view.transform.matrix, [1,0,0,0,0,0,1,0,0,-1,0,0,0.4,0.1,0.1,1], 0.001, "left transform");
assert_matrix_approx_equals(view.transform.matrix, [1,0,0,0,0,0,1,0,0,-1,0,0,0.4,0.1,0.1,1], 0.001, "left transform");
assert_matrix_approx_equals(view.transform.inverse.matrix, [1,0,0,0,0,0,-1,0,0,1,0,0,-0.4,-0.1,0.1,1], 0.001, "left inverse transform");
let position = view.transform.position;
assert_approx_equals(position.x, 0.4, 0.001, "left x value");
assert_approx_equals(position.y, 0.1, 0.001, "left y value");
assert_approx_equals(position.z, 0.1, 0.001, "left z value");
assert_approx_equals(position.w, 1, 0.001, "left w value");
} else if (view.eye == "right") {
assert_matrix_approx_equals(view.transform.matrix, [1,0,0,0,0,0,1,0,0,-1,0,0,0.6,0.1,0.1,1], 0.001, "right transform");
assert_matrix_approx_equals(view.transform.matrix, [1,0,0,0,0,0,1,0,0,-1,0,0,0.6,0.1,0.1,1], 0.001, "right transform");
assert_matrix_approx_equals(view.transform.inverse.matrix, [1,0,0,0,0,0,-1,0,0,1,0,0,-0.6,-0.1,0.1,1], 0.001, "right inverse transform");
let position = view.transform.position;
assert_approx_equals(position.x, 0.6, 0.001, "left x value");
assert_approx_equals(position.y, 0.1, 0.001, "left y value");
@@ -7,7 +7,7 @@ const RIGHT_OFFSET = {position: [0.1, 0, 0], orientation: [0,0,0,0]};
let assert_matrix_approx_equals = function(m1, m2, epsilon, prefix = "") {
assert_equals(m1.length, m2.length, prefix + "Matrix lengths should match");
for(var i = 0; i < m1.length; ++i) {
assert_approx_equals(m1[i], m2[i], epsilon, prefix + "Component number " + i + " should match");
assert_approx_equals(m1[i], m2[i], epsilon, prefix + " Component number " + i + " should match");
}
}

0 comments on commit db7a08b

Please sign in to comment.
You can’t perform that action at this time.