Cody

Solution 1427654

Submitted on 29 Jan 2018 by Charles Juenger
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
x = [-1,-1,1,1]; y = [-1,1,1,-1]; d_correct = true; assert(isequal(isSortedClockwise(x,y),d_correct))

a = 0 2 0 a = 0 2 0 -2 b = 0 2 0 -2 c = 8 tf = logical 1

2   Pass
x = [-1,-1,-2,-2]; y = [-1,1,1,-1]; d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

a = 0 -1 0 a = 0 -1 0 1 b = 0 2 0 -2 c = -4 tf = logical 0

3   Pass
x = [-1,-1,-2,-2]; y = [-1,1,1,-1]; d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

a = 0 -1 0 a = 0 -1 0 1 b = 0 2 0 -2 c = -4 tf = logical 0

4   Pass
x = [-6,-7,-2,1,1,-2]; y = [4,-7,-13,-11,0,5]; d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

a = -1 5 3 0 -3 a = -1 5 3 0 -3 -4 b = -3 -20 -24 -11 5 9 c = -220 tf = logical 0

5   Pass
x = [-59,-59,-55,-51,-50,-46,-45,-45,-39,-40,-40,-41,-46,-50,-50]; y = [-68,-33, -5,-13,-28,-30,-20,-10, -8,-23,-34,-45,-48,-51,-51]; d_correct = true; assert(isequal(isSortedClockwise(x,y),d_correct))

a = 0 4 4 1 4 1 0 6 -1 0 -1 -5 -4 0 a = 0 4 4 1 4 1 0 6 -1 0 -1 -5 -4 0 -9 b = -101 -38 -18 -41 -58 -50 -30 -18 -31 -57 -79 -93 -99 -102 -119 c = 1387 tf = logical 1

6   Pass
x = flip([-59,-59,-55,-51,-50,-46,-45,-45,-39,-40,-40,-41,-46,-50,-50]); y = flip([-68,-33, -5,-13,-28,-30,-20,-10, -8,-23,-34,-45,-48,-51,-51]); d_correct = false; assert(isequal(isSortedClockwise(x,y),d_correct))

a = 0 4 5 1 0 1 -6 0 -1 -4 -1 -4 -4 0 a = 0 4 5 1 0 1 -6 0 -1 -4 -1 -4 -4 0 9 b = -102 -99 -93 -79 -57 -31 -18 -30 -50 -58 -41 -18 -38 -101 -119 c = -1387 tf = logical 0

7   Pass
x = [1,1,2,2]; y = [2,1,1,2]; assert(isequal(isSortedClockwise(x,y),false));

a = 0 1 0 a = 0 1 0 -1 b = 3 2 3 4 c = -2 tf = logical 0

8   Pass
x = flip([1,1,2,2]); y = flip([2,1,1,2]); assert(isequal(isSortedClockwise(x,y),true));

a = 0 -1 0 a = 0 -1 0 1 b = 3 2 3 4 c = 2 tf = logical 1

9   Pass
x = [-2,-2,-4,-4]; y = [1,3,1,-1]; assert(isequal(isSortedClockwise(x,y),false));

a = 0 -2 0 a = 0 -2 0 2 b = 4 4 0 0 c = -8 tf = logical 0

10   Pass
x = flip([-2,-2,-4,-4]); y = flip([1,3,1,-1]); assert(isequal(isSortedClockwise(x,y),true));

a = 0 2 0 a = 0 2 0 -2 b = 0 4 4 0 c = 8 tf = logical 1

11   Pass
r=rand(100,15); a=2*pi*rand(100,1); d=2*(rand(100,1)>.5)-1; x=r.*cos(a*ones(1,15)+d*2*pi*(0:14)/15)+randn(100,1); y=r.*sin(a*ones(1,15)+d*2*pi*(0:14)/15)+randn(100,1); assert(all(arrayfun(@(i)isequal(isSortedClockwise(x(i,:),y(i,:)),d(i)<0),1:100)))

a = -0.0550 0.0125 -0.0958 -0.3834 -0.1661 0.0675 -0.6199 -0.1233 0.5103 -0.1566 0.1980 0.2704 0.1719 0.1125 a = -0.0550 0.0125 -0.0958 -0.3834 -0.1661 0.0675 -0.6199 -0.1233 0.5103 -0.1566 0.1980 0.2704 0.1719 0.1125 0.2569 b = -4.0256 -3.5529 -3.0285 -3.1886 -3.1654 -3.2135 -3.4346 -3.4549 -3.9439 -4.4439 -4.9519 -5.1296 -4.9084 -4.5611 -4.3410 c = -1.6031 tf = logical 0 a = 0.3948 -0.3668 0.3154 0.0854 -0.3530 0.3440 0.0878 0.2224 -0.2071 0.3000 -0.3287 0.0298 0.0433 -0.1595 a = 0.3948 -0.3668 0.3154 0.0854 -0.3530 0.3440 0.0878 0.2224 -0.2071 0.3000 -0.3287 0.0298 0.0433 -0.1595 -0.4081 b = 0.1286 -0.5731 -0.6593 -0.7802 -1.4711 -2.0710 -1.4454 -1.0842 -1.0089 -0.7291 -0.6995 -0.6489 -0.3531 0.1274 0.6104 c = -0.6589 tf = logical 0 a = 0.1303 0.0874 0.2135 -0.0338 0.3538 -0.0463 -0.2591 -0.2700 -0.0720 -0.1765 -0.5191 -0.0626 0.3150 -0.0886 a = 0.1303 0.0874 0.2135 -0.0338 0.3538 -0.0463 -0.2591 -0.2700 -0.0720 -0.1765 -0.5191 -0.0626 0.3150 -0.0886 0.4282 b = 0.2952 0.5822 0.3795 0.4739 0.8297 1.3186 1.7493 1.8731 1.3694 1.0219 1.2495 1.0169 0.4934 -0.1373 -0.3474 c = -1.5447 tf = logical 0 a = -0.0623 0.0610 -0.5541 -0.1191 0.5286 0.1240 -0.0004 0.1388 -0.0118 0.5761 0.0673 -0.3586 -0.1702 -0.1327 a = -0.0623 0.0610 -0.5541 -0.1191 0.5286 0.1240 -0.0004 0.1388 -0.0118 0.5761 0.0673 -0.3586 -0.1702 -0.1327 -0.0865 b = -2.0035 -1.0422 -1.0494 -0.9505 -0.6781 -0.7081 -0.6096 -0.2255 -0.3029 -0.3713 -0.4244 -0.9221 -1.1763 -1.2140 -2.0011 c = 0.9049 tf = logical 1 a = 0.3975 -0.0389 0.0450 -0.3565 -0.4542 -0.1177 0.0404 -0.6358 0.1963 0.1700 0.1155 -0.0234 0.1889 0.1867 a = 0.3975 -0.0389 0.0450 -0.3565 -0.4542 -0.1177 0.0404 -0.6358 0.1963 0.1700 0.1155 -0.0234 0.1889 0.1867 0.2862 b = 0.6732 0.1997 -0.5423 -1.0856 -0.7597 -0.8395 -0.8401 -0.6489 -0.6494 -0.1060 0.1424 0.4981 0.9615 0.9184 0.7355 c = 1.8678 tf = logical 1 a = -0.2795 -0.0523 0.0241 -0.6766 0.4870 -0.1106 0.1878 0.1451 0.2386 -0.0120 -0.2126 0.1441 0.5316 -0.2595 a = -0.2795 -0.0523 0.0241 -0.6766 0.4870 -0.1106 0.1878 0.1451 0.2386 -0.0120 -0.2126 0.1441 0.5316 -0.2595 -0.1551 b = -2.6312 -2.1434 -1.4882 -1.5623 -1.4957 -1.0707 -0.8762 -1.0295 -0.2833 -0.0537 -1.0219 -1.2941 -1.5330 -1.9400 -2.3334 c = 0.9592 tf = logical 1 a = -0.1484 0.0482 -0.6346 -0.0134 0.6291 -0.4379 0.1272 0.4134 0.1480 0.0151 0.2925 -0.1084 -0.3281 0.1817 a = -0.1484 0.0482 -0.6346 -0.0134 0.6291 -0.4379 0.1272 0.4134 0.1480 0.0151 0.2925 -0.1084 -0.3281 0.1817 -0.1843 b = 0.7622 0.8308 0.5404 0.5125 0.0378 -0.5223 -1.3587 -0.9860 -0.4721 -0.5359 -0.3441 -0.1647 0.0057 0.2365 0.2851 c = -0.9229 tf = logical 0 a = -0.3817 0.3648 0.3227 0.1319 0.3906 -0.0537 0.0248 -0.1529 0.3988 -0.4685 -0.2064 -0.3144 -0.3009 0.0078 a = -0.3817 0.3648 0.3227 0.1319 0.3906 -0.0537 0.0248 -0.1529 0.3988 -0.4685 -0.2064 -0.3144 -0.3009 0.0078 0.2372 b = 2.6342 3.1558 3.0808 2.7602 2.9678 2.9370 2.3803 2.0702 1.4110 1.0366 1.1805 0.9570 0.8958 1.3992 1.9873 c = 1.9930 tf = logical 1 a = -0.0160 0.1432 -0.5931 0.4105 0.2872 -0.0067 0.3526 0.0498 -0.4721 0.4166 -0.0190 -0.3534 -0.2390 -0.1416 a = -0.0160 0.1432 -0.5931 0.4105 0.2872 -0.0067 0.3526 0.0498 -0.4721 0.4166 -0.0190 -0.3534 -0.2390 -0.1416 0.1812 b = -1.7613 -1.6849 -0.9883 -0.3429 -0.3366 -0.8673 -1.2679 -1.2968 -1.6017 -2.0102 -2.7207 -2.9163 -2.7729 -2.6274 -2.1248 c = 1.2808 tf = logical 1 a = 0.3371 0.0703 0.1034 0.3945 -0.1639 0.1335 -0.3385 0.1256 0.1269 -0.2509 -0.2704 -0.4852 0.4446 -0.5927 a = 0.3371 0.0703 0.1034 0.3945 -0.1639 0.1335 -0.3385 0.1256 0.1269 -0.2509 -0.2704 -0.4852 0.4446 -0.5927 0.3659 b = 0.9730 0.8562 1.5965 2.3680 1.7560 1.0138 0.7621 0.4987 -0.0858 -0.8492 -0.7642 -0.5716 -0.1442 0.5830 0.8629 c = 1.7319 tf = logical 1 a = 0.2028 0.1731 -0.1937 0.0434 0.3649 -0.1427 -0.0695 -0.0467 -0.1972 -0.4033 0.1023 0.0129 -0.4707 0.3414 a = 0.2028 0.1731 -0.1937 0.0434 0.3649 -0.1427 -0.0695 -0.0467 -0.1972 -0.4033 0.1023 0.0129 -0.4707 0.3414 0.2830 b = -2.5701 -2.5782 -1.6695 -1.2613 -1.1861 -0.9913 -0.7352 0.0530 -0.1403 -0.5554 -0.5051 -1.0355 -1.5024 -1.9611 -2.0858 c = -1.3077 tf = logical 0 a = 0.2931 -0.0344 -0.2251 0.3979 0.2310 -0.5958 -0.0493 -0.0280 -0.4496 0.0105 0.1627 0.2621 -0.0614 0.0177 a = 0.2931 -0.0344 -0.2251 0.3979 0.2310 -0.5958 -0.0493 -0.0280 -0.4496 0.0105 0.1627 0.2621 -0.0614 0.0177 0.0687 b = 0.3239 0.5078 0.0007 -0.2793 -0.7638 -0.7895 -0.4769 -0.3926 -0.7436 -0.9150 -0.4010 -0.1878 -0.0922 0.1030 0.0153 c = 0.5135 tf = logical 1 a = -0.2009 0.0193 0.4523 -0.4058 -0.2568 -0.3588 0.4099 -0.3009 -0.4300 0.0849 0.4617 0.2001 0.3385 0.2370 a = -0.2009 0.0193 0.4523 -0.4058 -0.2568 -0.3588 0.4099 -0.3009 -0.4300 0.0849 0.4617 0.2001 0.3385 0.2370 -0.2506 b = -0.9057 -0.7341 -0.0669 0.4259 0.4677 0.6555 -0.0236 -0.6963 -0.9237 -1.5283 -1.7724 -1.7024 -2.1032 -2.1920 -1.4706 c = -1.9452 tf = logical 0 a = 0.6733 -0.3582 0.3639 0.0819 0.1602 0.7038 -0.4955 0.3880 -0.3508 -0.3623 -0.0922 -0.1647 0.0059 -0.2218 a = 0.6733 -0.3582 0.3639 0.0819 0.1602 0.7038 -0.4955 0.3880 -0.3508 -0.3623 -0.0922 -0.1647 0.0059 -0.2218 -0.3316 b = 0.4525 -0.1661 -1.0359 -0.2877 0.4476 0.1526 0.3545 1.0915 1.5898 1.4363 1.1108 1.1849 1.1211 0.8869 0.5747 c = -1.3657 tf = logical 0 a = 0.1309 0.2266 0.2071 -0.2381 0.8080 -0.5881 0.0180 -0.2939 -0.0775 -0.3233 0.3452 -0.2533 -0.6264 0.4710 a = 0.1309 0.2266 0.2071 -0.2381 0.8080 -0.5881 0.0180 -0.2939 -0.0775 -0.3233 0.3452 -0.2533 -0.6264 0.4710 0.1938 b = 1.9408 1.8299 2.0928 2.5095 2.8903 3.0773 3.4655 3.4758 3.4396 3.9366 3.6117 3.0305 2.8637 2.5184 2.3250 c = -1.1462 tf = logical 0 a = -0.5691 0.3645 -0.7279 0.0959 0.4768 0.2288 0.1893 0.1374 0.6365 -0.0479 -0.2328 0.0158 -0.2608 -0.2370 a = -0.5691 0.3645 -0.7279 0.0959 0.4768 0.2288 0.1893 0.1374 0.6365 -0.0479 -0.2328 0.0158 -0.2608 -0.2370 -0.0695 b = 0.5541 0.5504 1.2151 1.7182 2.1541 2.2827 2.0443 1.7878 2.1429 2.0198 1.3379 0.7900 0.4200 0.4282 0.8165 c = 2.0480 tf = logical 1 a = 0.0640 -0.2114 -0.3926 -0.3470 0.4871 -0.0610 -0.5929 0.5054 0.3131 0.0433 0.2494 0.1138 0.1048 -0.1004 a = 0.0640 -0.2114 -0.3926 -0.3470 0.4871 -0.0610 -0.5929 0.5054 0.3131 0.0433 0.2494 0.1138 0.1048 -0.1004 -0.1754 b = 1.9567 2.6880 3.0768 2.8832 2.0485 1.3369 0.8667 0.4898 0.8343 0.9998 0.5954 0.5423 0.9044 1.2687 1.5300 c = -1.7880 tf = logical 0 a = 0.4821 -0.3784 0.2245 -0.2601 0.3677 0.1195 0.0755 0.5589 -0.0093 -0.5686 -0.0525 0.0927 -0.2556 0.0577 a = 0.4821 -0.3784 0.2245 -0.2601 0.3677 0.1195 0.0755 0.5589 -0.0093 -0.5686 -0.0525 0.0927 -0.2556 0.0577 -0.4541 b = -0.1669 0.2733 0.4042 1.0874 1.6634 1.0563 0.4950 0.6228 0.4690 0.1218 0.0628 -0.3856 -1.1513 -0.7234 -0.2372 c = 0.9949 tf = logical 1 a = 0.5731 -0.2079 -0.4326 0.0544 -0.1906 -0.1013 -0.2919 -0.0632 -0.5526 0.3582 0.4987 -0.0865 0.1295 0.1889 a = 0.5731 -0.2079 -0.4326 0.0544 -0.1906 -0.1013 -0.2919 -0.0632 -0.5526 0.3582 0.4987 -0.0865 0.1295 0.1889 0.1240 b = 1.7636 2.0507 2.5433 2.8213 2.8936 3.4274 3.9331 3.4708 3.0672 2.6486 2.3357 2.1477 1.8584 1.6520 1.6889 c = -1.6340 tf = logical 0 a = 0.1277 -0.4458 -0.0267 -0.5939 0.1779 0.3151 -0.2730 -0.2581 0.3269 0.3500 0.2703 0.1415 -0.1220 0.6004 a = 0.1277 -0.4458 -0.0267 -0.5939 0.1779 0.3151 -0.2730 -0.2581 0.3269 0.3500 0.2703 0.1415 -0.1220 0.6004 -0.5904 b = 0.5198 0.6393 1.3215 0.6885 0.5173 1.2465 1.6115 2...