Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit a1e996a

Browse files
committed
Bug 1631648 [wpt PR 23126] - WebXR - AR - adjust XRRay to match the spec, a=testonly
Automatic update from web-platform-tests WebXR - AR - adjust XRRay to match the spec Bring XRRay up to spec, adjusting the behavior with changes introduced by PR: immersive-web/hit-test#85 Additionally, fix Chrome's Web IDL to not rely on overloads. Change-Id: I98af1a4ed90dbeb8e311795e818efb64bb15034d -- wpt-commits: fd045759df43fa155b34a5e4fe4187610ad1bb24 wpt-pr: 23126
1 parent d08937a commit a1e996a

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

testing/web-platform/tests/webxr/hit-test/xrRay_constructor.https.html

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,28 @@
1818
{
1919
// Check defaults - should be 0,0,0,1 for origin and 0,0,-1,0 for direction,
2020
// identity matrix for the transform:
21-
let xrRay = new XRRay();
21+
let xrRay1 = new XRRay();
22+
let xrRay2 = new XRRay({});
23+
let xrRay3 = new XRRay({}, {});
24+
2225
assert_point_approx_equals(
23-
xrRay.origin, {x : 0.0, y : 0.0, z : 0.0, w : 1.0},
26+
xrRay1.origin, {x : 0.0, y : 0.0, z : 0.0, w : 1.0},
2427
FLOAT_EPSILON, "origin-default:");
2528
assert_point_approx_equals(
26-
xrRay.direction, {x : 0.0, y : 0.0, z : -1.0, w : 0.0},
29+
xrRay1.direction, {x : 0.0, y : 0.0, z : -1.0, w : 0.0},
2730
FLOAT_EPSILON, "direction-default:");
2831
assert_matrix_approx_equals(
29-
xrRay.matrix, IDENTITY_MATRIX,
32+
xrRay1.matrix, IDENTITY_MATRIX,
3033
FLOAT_EPSILON, "matrix-default:");
34+
35+
assert_ray_approx_equals(xrRay1, xrRay2, FLOAT_EPSILON, "ray1-ray2-default:");
36+
assert_ray_approx_equals(xrRay2, xrRay3, FLOAT_EPSILON, "ray2-ray3-default:");
3137
}
3238

3339
{
3440
// Check custom value for origin, default for direction:
3541
let originDict = {x : 11.0, y : 12.0, z : 13.0, w : 1.0};
42+
let xrRay1 = new XRRay(originDict);
3643
let xrRay2 = new XRRay(DOMPoint.fromPoint(originDict));
3744
let xrRay3 = new XRRay(DOMPointReadOnly.fromPoint(originDict));
3845
let matrix1 = [ 1, 0, 0, 0,
@@ -41,15 +48,16 @@
4148
11, 12, 13, 1];
4249

4350
assert_point_approx_equals(
44-
xrRay2.origin, originDict,
51+
xrRay1.origin, originDict,
4552
FLOAT_EPSILON, "origin-custom-direction-default:");
4653
assert_point_approx_equals(
47-
xrRay2.direction, {x : 0.0, y : 0.0, z : -1.0, w : 0.0},
54+
xrRay1.direction, {x : 0.0, y : 0.0, z : -1.0, w : 0.0},
4855
FLOAT_EPSILON, "direction-custom-direction-default:");
4956
assert_matrix_approx_equals(
50-
xrRay2.matrix, matrix1,
57+
xrRay1.matrix, matrix1,
5158
FLOAT_EPSILON, "matrix-custom-direction-default:");
5259

60+
assert_ray_approx_equals(xrRay1, xrRay2, FLOAT_EPSILON, "ray1-ray2-direction-default:");
5361
assert_ray_approx_equals(xrRay2, xrRay3, FLOAT_EPSILON, "ray2-ray3-direction-default:");
5462
}
5563

@@ -67,6 +75,10 @@
6775
-1, 0, 0, 0,
6876
10, 10, 10, 1];
6977

78+
let xrRay1 = new XRRay(
79+
originDict,
80+
directionDict);
81+
7082
let xrRay2 = new XRRay(
7183
DOMPoint.fromPoint(originDict),
7284
DOMPoint.fromPoint(directionDict));
@@ -76,15 +88,16 @@
7688
DOMPointReadOnly.fromPoint(directionDict));
7789

7890
assert_point_approx_equals(
79-
xrRay2.origin, originDict,
91+
xrRay1.origin, originDict,
8092
FLOAT_EPSILON, "origin-custom:");
8193
assert_point_approx_equals(
82-
xrRay2.direction, directionNorm,
94+
xrRay1.direction, directionNorm,
8395
FLOAT_EPSILON, "direction-custom:");
8496
assert_matrix_approx_equals(
85-
xrRay2.matrix, matrix1,
97+
xrRay1.matrix, matrix1,
8698
FLOAT_EPSILON, "matrix-custom:");
8799

100+
assert_ray_approx_equals(xrRay1, xrRay2, FLOAT_EPSILON, "ray1-ray2:");
88101
assert_ray_approx_equals(xrRay2, xrRay3, FLOAT_EPSILON, "ray2-ray3:");
89102
}
90103

@@ -108,6 +121,7 @@
108121
DOMPoint.fromPoint(directionDict)
109122
), "Constructor should throw for non-1 origin w coordinate");
110123
}
124+
111125
//
112126
// Constructor 2 - from rigid transform.
113127
//
@@ -122,20 +136,20 @@
122136
0.707, 0, -0.707, 0,
123137
10., 10, 10., 1];
124138

125-
let xrRay4 = new XRRay(
139+
let xrRay = new XRRay(
126140
new XRRigidTransform(
127141
DOMPoint.fromPoint(originDict),
128142
DOMPoint.fromPoint(directionQuaternionDict)));
129143

130144
assert_point_approx_equals(
131-
xrRay4.origin, originDict,
145+
xrRay.origin, originDict,
132146
FLOAT_EPSILON, "origin-custom-rigid:");
133147
assert_point_approx_equals(
134-
xrRay4.direction, directionNorm2,
148+
xrRay.direction, directionNorm2,
135149
FLOAT_EPSILON, "direction-custom-rigid:");
136150

137151
assert_matrix_approx_equals(
138-
xrRay4.matrix, matrix2,
152+
xrRay.matrix, matrix2,
139153
FLOAT_EPSILON, "matrix-custom-rigid:");
140154
}
141155
};

0 commit comments

Comments
 (0)