Problem 45358. Do they touch?

Solution 2804182

Submitted on 7 Aug 2020 by Rafael S.T. Vieira
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
x1=[0,0]; x2=[5,5]; r1=3; r2=2; assert(isequal(touch(x1,x2,r1,r2),0))

2   Pass
x1=[0,0]; x2=[3,4]; r1=3; r2=2; assert(isequal(touch(x1,x2,r1,r2),1))

3   Pass
x1=[2,1]; x2=[3,4]; r1=4; r2=2; assert(isequal(touch(x1,x2,r1,r2),0))

4   Pass
x1=[-1,0]; x2=[3,-3]; r1=3; r2=8; assert(isequal(touch(x1,x2,r1,r2),1))

5   Pass
x1=[-5,-5]; x2=[5,5]; r1=5; r2=5; assert(isequal(touch(x1,x2,r1,r2),0))

Suggested Problems

More from this Author149

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!