Cody

# Problem 1650. LASER Tracker - Mirror Distance and Angle

Solution 1648851

Submitted on 16 Oct 2018 by Yu Han
• Size: 19
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
d2=2; Phi=pi/4; d3=sqrt(2); x1=d2-d3*cos(Phi); y1=d3*sin(Phi); Theta=atan(y1/x1); d1=hypot(x1,y1); [od2, oPhi]=solve_mirror(d1,d2+d3,Theta); assert(abs(d2-od2)<.001) assert(abs(Phi-oPhi)<.001)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In solve_mirror (line 4) In ScoringEngineTestPoint1 (line 11) In solutionTest (line 3)]

2   Pass
d2=2; Phi=1.5*pi/4; d3=2; x1=d2-d3*cos(Phi); y1=d3*sin(Phi); Theta=atan(y1/x1); d1=hypot(x1,y1); [od2, oPhi]=solve_mirror(d1,d2+d3,Theta) assert(abs(d2-od2)<.001) assert(abs(Phi-oPhi)<.001)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In solve_mirror (line 4) In ScoringEngineTestPoint2 (line 11) In solutionTest (line 5)] od2 = 0 oPhi = 3.1416

3   Pass
d2=3; Phi=.5*pi/4; d3=1; x1=d2-d3*cos(Phi); y1=d3*sin(Phi); Theta=atan(y1/x1); d1=hypot(x1,y1); [od2, oPhi]=solve_mirror(d1,d2+d3,Theta) assert(abs(d2-od2)<.001) assert(abs(Phi-oPhi)<.001)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In solve_mirror (line 4) In ScoringEngineTestPoint3 (line 11) In solutionTest (line 7)] od2 = 0 oPhi = 3.1416

4   Pass
d2=3+rand; Phi=(.5+rand/10)*pi/4; d3=1+rand; x1=d2-d3*cos(Phi); y1=d3*sin(Phi); Theta=atan(y1/x1); d1=hypot(x1,y1); [od2, oPhi]=solve_mirror(d1,d2+d3,Theta) assert(abs(d2-od2)<.001) assert(abs(Phi-oPhi)<.001)

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In solve_mirror (line 4) In ScoringEngineTestPoint4 (line 11) In solutionTest (line 9)] od2 = 0 oPhi = 3.1416