Cody

Solution 1584119

Submitted on 16 Jul 2018 by bainhome
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
pa = [-1,-1,-1]; pb = [2,2,2]; pc = [1,1,1]; tf_correct = true; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct));

2   Pass
pa = [0,0,0]; pb = [2,0,0]; pc = [3,0,0]; tf_correct = false; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct));

3   Pass
pa = [-9.20, -4.30, 1.02]; pb = [-12.40, -10.70, 13.82]; pc = [-9.7, -3.8, 2.52]; tf_correct = false; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct));

4   Pass
pa = [2,2,2]; pb = [3,4,7]; pc = [3,4,7]; tf_correct = true; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct));

5   Pass
pa = [0,0,0]; pb = [3,3,0]; pc = [2,2,0]; tf_correct = true; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct));

6   Pass
pa = [0,0,0]; pb = [3,3,3]; pc = [2,2,1]; tf_correct = false; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct));

7   Pass
for k = 1:25 v = 10*[rand-0.5,rand-0.5,rand-0.5]; pa = 5*[rand-0.5,rand-0.5,rand-0.5]; pb = pa + 4*v; pc = pa + 2*v; tf_correct = true; assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct)); end

8   Pass
for k = 1:25 v = 10*[rand-0.5,rand-0.5,rand-0.5]; pa = 5*[rand-0.5,rand-0.5,rand-0.5]; pb = pa + v; pc = pa + 2*v; tf_correct = false; assignin('base','pa',pa); assignin('base','pb',pb); assignin('base','pc',pc); assert(isequal(isPtOnSegment(pa,pb,pc),tf_correct)); end

Suggested Problems

More from this Author1