|
88 | 88 | assert_ray_approx_equals(xrRay2, xrRay3, FLOAT_EPSILON, "ray2-ray3:"); |
89 | 89 | } |
90 | 90 |
|
| 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 | + } |
91 | 111 | // |
92 | 112 | // Constructor 2 - from rigid transform. |
93 | 113 | // |
|
0 commit comments