Cody

Solution 528985

Submitted on 14 Nov 2014
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

Test Suite

Test Status Code Input and Output
1   Pass
%% Random integer vertices rng default for ii=1:100 X = randi([-1000,1000],4,1); Y = randi([-1000,1000],4,1); tf = isrectangle(X,Y); assert(~tf) %all of these should not be valid rectangles end

ans = 1.0e+03 * 0.1817 -0.9245 2.1459 -0.4573 1.4069 0.0309 1.7968 -0.0358 -1.9683 1.6208 ans = 0 ans = 1.0e+05 * 5.2666 -0.0032 5.2698 -0.0051 -0.0180 5.2901 0.0837 -0.0082 0.0919 0.0259 -0.0223 0.0875 ans = 0 ans = 1.0e+03 * -0.6210 -1.7952 2.8814 -1.0615 -1.3024 -0.0942 -1.4306 -0.1395 2.0353 2.5740 ans = 0 ans = 1.0e+03 * 0.8527 -1.5827 2.1962 -1.3544 0.6205 0.1390 0.7280 0.0595 1.7299 -1.6279 ans = 0 ans = 1.0e+04 * 0.1098 -1.2913 1.1815 -0.0952 -0.3439 1.3776 -0.0671 -0.9097 0.9768 -0.2615 0.0277 1.0920 ans = 0 ans = 1.0e+03 * 0.0483 0.8386 -1.3274 1.5378 -0.5498 0.4166 -1.0588 -0.2493 -0.2295 1.4544 ans = 0 ans = 1.0e+03 * 2.3595 -1.6051 -0.7544 -1.8803 3.0113 0.1491 -0.4448 -0.3583 0.8031 1.5207 0.2782 -1.6414 ans = 0 ans = 1.0e+03 * 2.3952 -2.8566 -0.4614 -0.1866 3.4069 -2.1921 -3.6538 2.7884 -0.8655 2.6173 -4.2509 -0.5777 ans = 0 ans = 1.0e+03 * -0.0646 1.9445 1.8777 -1.9061 -0.3209 -0.0321 -1.2276 1.3275 1.3265 -2.3000 ans = 0 ans = 1.0e+03 * -0.2560 1.7311 -0.1843 -0.4286 -1.7496 -0.4292 -0.4746 -1.9309 1.7430 0.8375 ans = 0 ans = 1.0e+03 * 1.7034 -1.7989 0.0955 -3.0535 1.6533 1.2965 2.0629 -1.0809 -0.9820 -2.3167 0.8599 1.8962 ans = 0 ans = 1.0e+03 * -0.6671 1.9323 0.7245 -2.5979 2.0151 -0.5048 -1.4579 2.3096 0.0710 -1.6412 ans = 0 ans = 1.0e+03 * -0.8372 1.7856 -0.9484 2.4985 -2.1967 -0.5567 -0.5299 -0.8894 1.4194 0.3931 2.0809 -2.0829 ans = 0 ans = 1.0e+03 * 0.4041 -1.9500 -0.2821 -1.3844 2.0167 -0.4596 -0.7955 2.0870 -1.4749 0.1577 ans = 0 ans = 1.0e+03 * 0.1635 -2.9105 -1.5857 1.4037 2.8165 1.0168 0.4867 2.3699 -2.5956 -0.4449 ans = 0 ans = 1.0e+03 * 0.4395 -2.8004 -0.1842 1.0714 2.8474 0.7029 0.3894 3.0594 -2.6165 -1.1341 ans = 0 ans = 1.0e+03 * 0.4227 -0.4837 -0.3535 -0.0335 1.2760 -1.3200 -2.3044 2.3279 -1.6914 1.1108 ans = 0 ans = 1.0e+03 * 1.6470 1.1623 0.4847 -1.5553 2.2942 -0.7763 -2.0677 -0.1265 -1.9411 3.3191 -1.4602 -1.9348 ans = 0 ans = 1.0e+03 * -0.0243 0.8331 -1.0624 -0.7438 0.4737 -0.1399 0.5780 -0.2621 0.6891 -0.9863 ans = 0 ans = 1.0e+03 * -0.0605 2.0749 -1.5820 -2.3610 1.1333 -0.7917 -0.1548 1.3514 0.0183 -2.0714 ans = 0 ans = 1.0e+03 * -0.5321 2.0675 -0.2041 -2.3009 -0.2008 0.0094 0.9051 -2.2477 -0.4201 2.3303 ans = 0 ans = 1.0e+03 * -0.4277 -2.4622 0.3817 1.7601 2.7664 0.8151 1.5738 -2.3858 -1.6553 -0.9412 ans = 0 ans = 1.0e+03 * 1.6771 -2.6556 0.9785 2.8170 -2.2428 0.5194 0.5546 -0.0134 -0.5412 0.5270 0.7947 -1.3639 ans = 0 ans = 1.0e+03 * 0.1227 -0.8150 0.6922 1.3533 2.2005 -2.2160 -1.6773 0.5183 1.1590 2.8927 -1.5839 0.4832 ans = 0 ans = -138.5735 854.0493 -42.1627 -117.0777 -659.3947 4.9652 110.3779 -860.1196 715.1919 -300.6747 ans = 0 ans = 1.0e+03 * 0.4936 1.8471 -1.6357 0.2534 -1.6919 -0.4217 -0.5870 -0.6497 1.7417 -0.9456 ans = 0 ans = 1.0e+03 * 0.2545 1.1912 1.8072 -1.7626 0.2281 -0.2959 1.3236 -0.2668 -0.2535 -1.8125 ans = 0 ans = 1.0e+03 * -5.1848 6.0925 0.9077 -1.0299 -6.5365 2.5867 0.0654 0.7037 0.7690 -1.7057 -0.5923 0.9276 ans = 0 ans = 1.0e+03 * -0.3728 1.9400 0.7064 -1.6562 -0.0117 -0.5155 -0.9668 2.0492 1.6314 -2.3247 ans = 0 ans = 1.0e+03 * -0.0901 0.4176 0.7674 -0.6661 -1.5830 -0.4183 -2.0596 2.4074 -1.9931 -1.9693 ans = 0 ans = 1.0e+03 * 1.7044 1.1001 0.6043 -2.4136 1.9336 -0.3041 1.5198 2.4480 -0.9282 0.3891 3.1407 -2.6088 ans = 0 ans = 1.0e+03 * -0.5285 -1.5739 0.8493 0.5760 -0.6254 0.1185 -1.2069 -1.6640 1.7772 1.8822 ans = 0 ans = 1.0e+03 * -1.9892 -2.2232 0.2341 2.0681 -4.0554 0.6955 -0.6650 -2.2232 1.5582 -0.8420 -1.4421 3.6887 ans = 0 ans = 1.0e+03 * 0.3520 -0.2467 -1.8923 1.5055 0.2836 0.0421 -1.9493 0.5289 -0.9473 1.7560 ans = 0 ans = 1.0e+03 * -1.8182 -2.1813 -1.9350 1.6070 2.4552 -0.3188 -1.1161 -1.7720 1.8497 0.9253 ans = 0 ans = 1.0e+03 * -0.7752 -0.9671 1.3890 -0.0621 0.1865 -0.0641 -1.5793 1.4698 -2.0213 1.8425 ans = 0 ans = 1.0e+03 * -0.2077 -1.2869 2.3148 -2.2446 -0.8719 -0.1773 2.0204 -0.6165 -0.3973 -2.1062 ans = 0 ans = 1.0e+03 * -0.0007 1.5780 -1.5954 0.0639 -1.2254 -0.0322 0.6743 0.6319 -1.7468 -1.2465 ans = 0 ans = 1.0e+03 * 0.3704 -1.6649 0.9444 0.4844 2.3346 0.5375 1.2349 -1.8452 2.2838 -0.0166 ans = 0 ans = 1.0e+03 * 0.1096 1.5583 -1.9440 1.8020 -0.2843 -0.1900 1.2847 0.5474 -0.8907 -1.9899 ans = 0 ans = 1.0e+03 * -0.0448 1.0895 -1.8611 -0.5911 2.0528 1.0274 -1.9269 1.1986 2.0342 -0.5225 ans = 0 ans = 1.0e+03 * 0.3659 2.5667 -2.0609 -0.8927 -0.9609 -0.0818 0.0768 0.8470 -2.0415 -2.3813 ans = 0 ans = 1.0e+03 * 2.5917 1.7371 -4.3288 -0.4617 -3.6267 4.3770 -0.3997 1.3469 -0.9472 2.5579 -1.2180 0.5693 ans = 0 ans = 1.0e+03 * 0.1096 -0.7953 -1.9989 1.4039 0.9424 0.0201 -1.9128 0.5439 -1.3880 1.7347 ans = 0 ans = 1.0e+04 * 0.0333 -2.2115 2.1783 0.0815 -0.2124 2.3503 -0.0848 0.0848 0 -0.2418 0.0387 -0.0894 ans = 0 ans = 1.0e+04 * -0.6262 -0.5233 -0.1029 0.6471 0.2537 -0.2381 1.8541 1.8359 0.0182 -2.0358 0.1034 0.1916 ans = 0 ans = 1.0e+03 * 0.6559 -0.5998 0.4974 -1.0051 1.0806 -0.4881 -1.8718 1.9390 1.6891 -1.6850 ans = 0 ans = 1.0e+03 * 0.0335 1.4110 -0.1671 -0.9876 0.9563 0.4687 0.6794 -1.5571 0.4794 0.5393 ans = 0 ans = 1.0e+04 * 2.2602 -2.1903 -0.0699 2.3596 -0.0168 -0.2512 0.7518 -0.6384 -0.1134 0.7457 0.2451 -0.2078 ans = 0 ans = 1.0e+03 * 0.4418 -0.4052 -1.1692 1.5623 -0.0708 0.9772 2.0081 2.0766 -1.3251 -2.3820 ans = 0 ans = 1.0e+03 * 0.3130 0.0226 -1.6177 0.5608 1.7625 0.0227 1.8584 -0.9150 1.7117 -0.3714 ans = 0 ans = 1.0e+03 * 0.3420 1.0791 -1.6520 1.8909 -0.8568 0.7126 -1.6047 1.0052 -0.9323 1.9263 ans = 0 ans = 1.0e+04 * 1.2655 1.2256 0.0399 -1.3672 0.0744 0.2132 -0.7351 -0.8078 0.0727 0.8459 -0.2136 0.0331 ans = 0 ans = 1.0e+03 * 0.3802 0.2914 -1.3490 1.4323 -0.3921 0.1691 -1.3799 0.4115 -0.2925 1.4083 ans = 0 ans = 1.0e+03 * -0.9512 -1.1873 2.1385 0.0781 -2.6710 2.6189 0.7947 -1.1625 0.3677 2.4365 -1.8552 -1.2227 ans = 0 ans = 1.0e+03 * -0.4294 -1.1110 -2.4174 0.5577 2.1610 0.5364 -1.9393 -0.1691 2.3583 0.5701 ans = 0 ans = 1.0e+03 * 0.6594 0.0242 -0.6837 0.3604 1.2491 -1.6503 -3.7397 5.0738 -1.3341 -5.2276 3.6928 -1.8387 ans = 0 ans = 1.0e+04 * -0.1965 1.7440 1.5476 0.2772 -1.7122 0.0191 0.0982 -2.2002 -2.1020 -0.2346 2.2534 -0.2383 ans = 0 ans = 1.0e+03 * -0.1378 1.4927 -1.7028 -0.3531 1.4203 0.0544 -1.1345 1.0923 -1.9919 1.2240 ans = 0 ans = 1.0e+03 * 0.4779 1.3276 -0.8497 -1.3725 1.4260 0.1456 0.3454 -2.1559 2.5013 0.5187 -3.1579 1.4468 ans = 0 ans = 1.0e+03 * 0.1092 -0.4538 -1.5468 -1.4440 1.4157 0.2889 -1.5025 0.1405 -0.6150 0.6389 ans = 0 ans = 1.0e+03 * 0.2111 -0.6423 0.3201 -1.0765 1.0785 0.1746 0.8821 -1.0282 0.0293 0.1658 ans = 0 ans = 1.0e+03 * -0.0450 0.8136 1.8041 -1.5770 1.4339 -0.0788 1.6570 -0.3912 -0.9298 -1.1383 ans = 0 ans = 1.0e+03 * -0.5589 0.2513 -1.3602 0.7983 -0.0330 1.0895 -2.4049 -1.6918 2.2824 2.1705 ans = 0 ans = 1.0e+03 * 0.6442 -0.0737 0.7179 -1.2404 -0.4521 0.6769 1.0091 -3.6574 4.6665 0.2447 -4.6336 1.9652 ans = 0 ans = 1.0e+03 * -1.1154 -0.6756 -0.4397 1.1535 -1.7162 -0.1322 0.3408 -0.3483 0.6891 -1.2003 -0.2194 1.3151 ans = 0 ans = 1.0e+03 * -0.1076 1.2424 -1.4582 -1.1435 0.7799 -1.1512 -1.8655 1.4422 1.9277 -1.8968 ans = 0 ans = 1.0e+03 * 4.7415 -5.0369 0.2954 -5.4553 1.3920 -0.7434 7.0153 -6.8133 -0.2019 -7.6788 -0.2235 1.0848 ans = 0 ans = 1.0e+03 * 0.8808 -1.2045 1.3196 -0.4821 -0.2511 0.5151 -1.6354 1.7915 1.9730 -2.2108 ans = 0 ans = 1.0e+03 * 0.9451 1.8012 -1.0544 0.4525 0.5685 -1.5997 -0.3949 3.1725 -1.7876 -3.2944 ans = 0 ans = 1.0e+03 * 1.9316 -1.9727 0.0410 2.7183 -0.2728 -1.3394 -2.0327 3.2961 -1.2634 -3.0218 2.5338 -0.1457 ans = 0 ans = 1.0e+03 * 0.1179 0.4959 -1.7293 1.9706 -0.4581...

2   Pass
%% Random real-valued vertices rng default for ii=1:100 X = -1000+2000*rand(4,1); Y = -1000+2000*rand(4,1); tf = isrectangle(X,Y); assert(~tf) %all of these should not be valid rectangles end

ans = 1.0e+03 * 0.1826 -0.9243 2.1463 -0.4573 1.4057 0.0311 1.7965 -0.0362 -1.9679 1.6223 ans = 0 ans = 1.0e+05 * 8.4964 -0.0032 8.4996 -0.0051 -0.0180 8.5200 0.1329 -0.0082 0.1412 0.0259 -0.0222 0.1368 ans = 0 ans = 1.0e+03 * -0.6215 -1.7948 2.8810 -1.0620 -1.3050 -0.0944 -1.4299 -0.1403 2.0343 2.5723 ans = 0 ans = 1.0e+03 * 0.8529 -1.5821 2.1955 -1.3564 0.6202 0.1391 0.7268 0.0600 1.7274 -1.6268 ans = 0 ans = 1.0e+04 * 0.1098 -1.2775 1.1677 -0.0950 -0.3437 1.3637 -0.0671 -0.8993 0.9664 -0.2614 0.0277 1.0816 ans = 0 ans = 1.0e+03 * 0.0478 0.8373 -1.3254 1.5360 -0.5496 0.4155 -1.0575 -0.2502 -0.2271 1.4522 ans = 0 ans = 1.0e+03 * 2.3581 -1.6024 -0.7557 -1.8818 3.0082 0.1495 -0.4463 -0.3579 0.8041 1.5211 0.2768 -1.6412 ans = 0 ans = 1.0e+03 * 2.3900 -2.8519 -0.4619 -0.1855 3.4010 -2.1916 -3.6484 2.7839 -0.8645 2.6152 -4.2454 -0.5754 ans = 0 ans = 1.0e+03 * -0.0652 1.9429 1.8771 -1.9044 -0.3208 -0.0324 -1.2278 1.3263 1.3269 -2.2988 ans = 0 ans = 1.0e+03 * -0.2560 1.7306 -0.1843 -0.4294 -1.7492 -0.4295 -0.4744 -1.9308 1.7423 0.8380 ans = 0 ans = 1.0e+03 * 1.6997 -1.7955 0.0958 -3.0486 1.6514 1.2965 2.0595 -1.0787 -0.9808 -2.3138 0.8603 1.8931 ans = 0 ans = 1.0e+03 * -0.6669 1.9304 0.7260 -2.5967 2.0142 -0.5037 -1.4564 2.3066 0.0707 -1.6404 ans = 0 ans = 1.0e+03 * -0.8370 1.7840 -0.9471 2.4971 -2.1945 -0.5568 -0.5294 -0.8879 1.4173 0.3928 2.0783 -2.0808 ans = 0 ans = 1.0e+03 * 0.4033 -1.9488 -0.2817 -1.3822 2.0146 -0.4594 -0.7946 2.0856 -1.4741 0.1580 ans = 0 ans = 1.0e+03 * 0.1629 -2.9087 -1.5846 1.4036 2.8150 1.0162 0.4842 2.3688 -2.5932 -0.4451 ans = 0 ans = 1.0e+03 * 0.4392 -2.7988 -0.1838 1.0706 2.8458 0.7029 0.3896 3.0582 -2.6152 -1.1348 ans = 0 ans = 1.0e+03 * 0.4216 -0.4866 -0.3525 -0.0334 1.2777 -1.3141 -2.2989 2.3233 -1.6896 1.1061 ans = 0 ans = 1.0e+03 * 1.6492 1.1638 0.4854 -1.5562 2.2961 -0.7753 -2.0677 -0.1281 -1.9396 3.3175 -1.4608 -1.9344 ans = 0 ans = 1.0e+03 * -0.0241 0.8333 -1.0616 -0.7446 0.4751 -0.1401 0.5781 -0.2642 0.6885 -0.9855 ans = 0 ans = 1.0e+03 * -0.0605 2.0733 -1.5801 -2.3582 1.1331 -0.7905 -0.1551 1.3513 0.0147 -2.0682 ans = 0 ans = 1.0e+03 * -0.5317 2.0668 -0.2044 -2.2991 -0.2022 0.0091 0.9048 -2.2468 -0.4202 2.3285 ans = 0 ans = 1.0e+03 * -0.4272 -2.4588 0.3764 1.7595 2.7630 0.8160 1.5728 -2.3851 -1.6536 -0.9407 ans = 0 ans = 1.0e+03 * 1.6893 -2.6617 0.9724 2.8281 -2.2366 0.5208 0.5567 -0.0184 -0.5382 0.5297 0.7921 -1.3621 ans = 0 ans = 1.0e+03 * 0.1238 -0.8155 0.6917 1.3542 2.2009 -2.2150 -1.6765 0.5191 1.1574 2.8898 -1.5843 0.4830 ans = 0 ans = -137.5402 851.9132 -38.1278 -115.9341 -658.3530 4.8969 110.2593 -858.1722 714.2006 -300.1576 ans = 0 ans = 1.0e+03 * 0.4926 1.8455 -1.6356 0.2536 -1.6906 -0.4215 -0.5877 -0.6487 1.7411 -0.9451 ans = 0 ans = 1.0e+03 * 0.2547 1.1906 1.8066 -1.7613 0.2265 -0.2963 1.3224 -0.2662 -0.2535 -1.8120 ans = 0 ans = 1.0e+03 * -5.1072 6.0147 0.9075 -1.0272 -6.4594 2.5845 0.0747 0.6946 0.7693 -1.7063 -0.5825 0.9273 ans = 0 ans = 1.0e+03 * -0.3723 1.9399 0.7051 -1.6554 -0.0121 -0.5151 -0.9640 2.0483 1.6309 -2.3238 ans = 0 ans = 1.0e+03 * -0.0911 0.4190 0.7667 -0.6651 -1.5811 -0.4233 -2.0542 2.4077 -1.9882 -1.9710 ans = 0 ans = 1.0e+03 * 1.7020 1.0978 0.6043 -2.4132 1.9306 -0.3039 1.5172 2.4457 -0.9285 0.3878 3.1377 -2.6086 ans = 0 ans = 1.0e+03 * -0.5275 -1.5738 0.8483 0.5764 -0.6253 0.1182 -1.2043 -1.6624 1.7751 1.8805 ans = 0 ans = 1.0e+03 * -1.9929 -2.2267 0.2338 2.0672 -4.0580 0.6956 -0.6670 -2.2235 1.5565 -0.8418 -1.4447 3.6862 ans = 0 ans = 1.0e+03 * 0.3520 -0.2453 -1.8914 1.5039 0.2833 0.0421 -1.9483 0.5278 -0.9468 1.7544 ans = 0 ans = 1.0e+03 * -1.8197 -2.1811 -1.9361 1.6082 2.4550 -0.3195 -1.1160 -1.7702 1.8483 0.9247 ans = 0 ans = 1.0e+03 * -0.7755 -0.9660 1.3890 -0.0646 0.1856 -0.0645 -1.5799 1.4701 -2.0215 1.8425 ans = 0 ans = 1.0e+03 * -0.2082 -1.2869 2.3143 -2.2445 -0.8710 -0.1778 2.0200 -0.6172 -0.3974 -2.1065 ans = 0 ans = 1.0e+03 * -0.0008 1.5769 -1.5945 0.0628 -1.2285 -0.0340 0.6739 0.6310 -1.7473 -1.2441 ans = 0 ans = 1.0e+03 * 0.3696 -1.6636 0.9434 0.4835 2.3323 0.5366 1.2346 -1.8443 2.2817 -0.0099 ans = 0 ans = 1.0e+03 * 0.1094 1.5579 -1.9434 1.8013 -0.2853 -0.1897 1.2845 0.5481 -0.8913 -1.9894 ans = 0 ans = 1.0e+03 * -0.0436 1.0879 -1.8594 -0.5892 2.0516 1.0246 -1.9234 1.1940 2.0334 -0.5222 ans = 0 ans = 1.0e+03 * 0.3658 2.5642 -2.0585 -0.8903 -0.9586 -0.0818 0.0765 0.8466 -2.0400 -2.3795 ans = 0 ans = 1.0e+03 * 2.5895 1.7394 -4.3289 -0.4592 -3.6283 4.3733 -0.3987 1.3476 -0.9489 2.5570 -1.2193 0.5705 ans = 0 ans = 1.0e+03 * 0.1089 -0.7969 -1.9972 1.4036 0.9406 0.0200 -1.9101 0.5431 -1.3868 1.7345 ans = 0 ans = 1.0e+04 * 0.0335 -1.3107 1.2771 0.0819 -0.2125 1.4492 -0.0852 0.0507 0.0344 -0.2419 0.0388 -0.0553 ans = 0 ans = 1.0e+04 * -0.6418 -0.5390 -0.1028 0.6628 0.2536 -0.2380 1.9008 1.8827 0.0181 -2.0825 0.1035 0.1915 ans = 0 ans = 1.0e+03 * 0.6563 -0.5984 0.4947 -1.0059 1.0810 -0.4876 -1.8713 1.9390 1.6876 -1.6840 ans = 0 ans = 1.0e+03 * 0.0331 1.4097 -0.1656 -0.9873 0.9559 0.4692 0.6822 -1.5573 0.4789 0.5390 ans = 0 ans = 1.0e+04 * 2.3086 -2.2390 -0.0696 2.4082 -0.0169 -0.2508 0.7672 -0.6540 -0.1132 0.7612 0.2450 -0.2076 ans = 0 ans = 1.0e+03 * 0.4423 -0.4055 -1.1677 1.5626 -0.0720 0.9757 2.0072 2.0765 -1.3235 -2.3812 ans = 0 ans = 1.0e+03 * 0.3132 0.0223 -1.6173 0.5595 1.7620 0.0227 1.8578 -0.9144 1.7116 -0.3717 ans = 0 ans = 1.0e+03 * 0.3423 1.0782 -1.6507 1.8891 -0.8549 0.7116 -1.6032 1.0039 -0.9327 1.9255 ans = 0 ans = 1.0e+04 * 1.2431 1.2031 0.0399 -1.3447 0.0742 0.2130 -0.7213 -0.7940 0.0727 0.8321 -0.2135 0.0331 ans = 0 ans = 1.0e+03 * 0.3798 0.2920 -1.3486 1.4312 -0.3903 0.1691 -1.3793 0.4109 -0.2928 1.4077 ans = 0 ans = 1.0e+03 * -0.9489 -1.1919 2.1407 0.0793 -2.6755 2.6166 0.7933 -1.1653 0.3720 2.4355 -1.8575 -1.2202 ans = 0 ans = 1.0e+03 * -0.4297 -1.1108 -2.4169 0.5588 2.1607 0.5365 -1.9391 -0.1704 2.3576 0.5706 ans = 0 ans = 1.0e+03 * 0.6593 0.0247 -0.6840 0.3603 1.2488 -1.6492 -3.7274 5.0634 -1.3361 -5.2149 3.6945 -1.8391 ans = 0 ans = 1.0e+04 * -0.1963 1.7588 1.5625 0.2769 -1.7271 0.0192 0.0982 -2.2201 -2.1219 -0.2345 2.2732 -0.2381 ans = 0 ans = 1.0e+03 * -0.1392 1.4915 -1.7032 -0.3497 1.4187 0.0549 -1.1338 1.0918 -1.9927 1.2237 ans = 0 ans = 1.0e+03 * 0.4780 1.3243 -0.8464 -1.3720 1.4220 0.1453 0.3454 -2.1518 2.4972 0.5195 -3.1540 1.4467 ans = 0 ans = 1.0e+03 * 0.1078 -0.4512 -1.5449 -1.4367 1.4141 0.2854 -1.4994 0.1412 -0.6227 0.6380 ans = 0 ans = 1.0e+03 * 0.2110 -0.6421 0.3198 -1.0754 1.0774 0.1744 0.8811 -1.0271 0.0296 0.1662 ans = 0 ans = 1.0e+03 * -0.0446 0.8137 1.8031 -1.5762 1.4323 -0.0781 1.6560 -0.3915 -0.9299 -1.1390 ans = 0 ans = 1.0e+03 * -0.5589 0.2524 -1.3595 0.7961 -0.0330 1.0905 -2.4050 -1.6912 2.2834 2.1696 ans = 0 ans = 1.0e+03 * 0.6457 -0.0710 0.7168 -1.2398 -0.4493 0.6789 1.0135 -3.6169 4.6304 0.2434 -4.5923 1.9693 ans = 0 ans = 1.0e+03 * -1.1151 -0.6776 -0.4375 1.1508 -1.7176 -0.1318 0.3389 -0.3478 0.6867 -1.1978 -0.2183 1.3140 ans = 0 ans = 1.0e+03 * -0.1070 1.2417 -1.4560 -1.1434 0.7821 -1.1511 -1.8649 1.4420 1.9267 -1.8941 ans = 0 ans = 1.0e+03 * 4.6381 -4.9340 0.2959 -5.3523 1.3927 -0.7434 6.8620 -6.6600 -0.2021 -7.5250 -0.2230 1.0847 ans = 0 ans = 1.0e+03 * 0.8798 -1.2034 1.3180 -0.4825 -0.2507 0.5141 -1.6340 1.7899 1.9711 -2.2086 ans = 0 ans = 1.0e+03 * 0.9487 1.8005 -1.0575 0.4494 0.5727 -1.6120 -0.3975 3.1850 -1.7883 -3.3067 ans = 0 ans = 1.0e+03 * 1.9176 -1.9589 0.0413 2.7036 -0.2728 -1.3385 -2.0179 3.2838 -1.2659 -3.0065 2.5352 -0.1447 ans = 0 ans = 1.0e+03 * 0.1178 0.4960 -1.7288 1.9703 -0.4588...

3   Fail
%% Axis-aligned rectangles with integer vertices rng default for ii=1:100 X = randi([-1000,1000],2,1); X = [X;X]; Y = randi([-1000,1000],2,1); Y = [Y;flipud(Y)]; randorder = randperm(4); X = X(randorder); Y = Y(randorder); tic; tf = isrectangle(X,Y); assert(tf) %all of these should be valid rectangles end

ans = 1.0e+03 * 0 0 -1.5835 1.5835 0 0 1.5835 0 0 -1.5835 ans = 1 ans = 1.0e+03 * 0 1.6271 0 -1.6271 0 0 0 1.6271 0 -1.6271 ans = 1 ans = 1.0e+03 * 0 0 0 -1.0439 1.0439 0 1.0439 -1.0439 0 0 ans = 1 ans = 0 0 720.5366 -720.5366 0 0 720.5366 0 0 -720.5366 ans = 1 ans = 1.0e+03 * 0 0 -1.5247 1.5247 0 0 -1.5247 0 0 1.5247 ans = 1 ans = 0 128.8255 0 -128.8255 0 0 0 128.8255 0 -128.8255 ans = 1 ans = 0 -813.1082 0 813.1082 0 0 0 813.1082 0 -813.1082 ans = 1 ans = 1.0e+03 * 0 0 1.4350 -1.4350 0 0 -1.4350 0 0 1.4350 ans = 1 ans = 0 -828.4069 0 828.4069 0 0 0 828.4069 0 -828.4069 ans = 1 ans = 1.0e+03 * 0 0 0 -1.6271 1.6271 0 1.6271 -1.6271 0 0 ans = 1 ans = 0 961.6990 0 0 -961.6990 0 0 961.6990 -961.6990 0 ans = 1 ans = 0 0 -377.5725 377.5725 0 0 377.5725 0 0 -377.5725 ans = 1 ans = 0 680.7364 0 0 -680.7364 0 0 680.7364 -680.7364 0 ans = 1 ans = 1.0e+03 * 0 1.1720 -1.1720 0 0 0 0 0 -1.1720 1.1720 ans = 1 ans = 1.0e+03 * 0 -1.9213 1.9213 0 0 0 0 0 -1.9213 1.9213 ans = 1 ans = 1.0e+03 * 0 -2.3027 2.3027 0 0 0 0 0 -2.3027 2.3027 ans = 1 ans = 1.0e+03 * 0 1.4443 -1.4443 0 0 0 0 0 -1.4443 1.4443 ans = 1 ans = 0 996.2429 -996.2429 0 0 0 0 0 -996.2429 996.2429 ans = 1 ans = 0 -692.7193 0 0 692.7193 0 0 692.7193 -692.7193 0 ans = 1 ans = 0 0 -84.0952 0 84.0952 0 84.0952 0 -84.0952 0 ans = 1 ans = 0 846.8465 -846.8465 0 0 0 0 0 846.8465 -846.8465 ans = 1 ans = 1.0e+03 * 0 -1.0579 0 0 1.0579 0 0 1.0579 -1.0579 0 ans = 1 ans = 0 0 427.5418 -427.5418 0 0 427.5418 0 0 -427.5418 ans = 1 ans = 1.0e+03 * 0 -1.1306 0 1.1306 0 0 0 -1.1306 0 1.1306 ans = 1 ans = 0 0 0 -298.9398 298.9398 0 298.9398 -298.9398 0 0 ans = 1 ans = 0 0 -770.2422 770.2422 0 0 770.2422 0 0 -770.2422 ans = 1