Skip to content

Commit 0fce2e9

Browse files
committed
Update XRRay semantics
Implements changes from immersive-web/hit-test#85
1 parent 7513c92 commit 0fce2e9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

webxr/hit-test/xrRay_constructor.https.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,26 @@
8888
assert_ray_approx_equals(xrRay2, xrRay3, FLOAT_EPSILON, "ray2-ray3:");
8989
}
9090

91+
{
92+
// Check that we throw exception on direction too close to 0,0,0:
93+
let originDict = {x : 10.0, y : 10.0, z : 10.0, w : 1.0};
94+
let directionDict = {x : 1.0, y : 0.0, z : 0.0, w : 0.0};
95+
96+
assert_throws_js(TypeError, () => new XRRay(
97+
DOMPoint.fromPoint(originDict),
98+
DOMPoint.fromPoint({x : 0.0, y : 0.0, z : 0.0, w : 0.0})
99+
), "Constructor should throw for zero direction");
100+
101+
assert_throws_js(TypeError, () => new XRRay(
102+
DOMPoint.fromPoint(originDict),
103+
DOMPoint.fromPoint({x : 1.0, y : 0.0, z : 0.0, w : 0.5})
104+
), "Constructor should throw for nonzero direction w coordinate");
105+
106+
assert_throws_js(TypeError, () => new XRRay(
107+
DOMPoint.fromPoint({x : 10.0, y : 10.0, z : 10.0, w : 0.5}),
108+
DOMPoint.fromPoint(directionDict)
109+
), "Constructor should throw for non-1 origin w coordinate");
110+
}
91111
//
92112
// Constructor 2 - from rigid transform.
93113
//

0 commit comments

Comments
 (0)