Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
xy = [24 27;31 19;37 11;53 10;68 14;60 31;49 34;48 60;63 68;99 66;89 78;89 78;97 92;55 80;40 73;19 48;4 50];
ix = find_the_square(xy);
d = diff(xy(ix([1 2 3 4 1]),:));
dd = d(:,1).^2 + d(:,2).^2;
tf = ~any(diff(dd));
assert(tf)
sxy =
17
|
2 | Pass |
xy = [0 0; 1 0; 1 1; 0 1];
ix = find_the_square(xy);
d = diff(xy(ix([1 2 3 4 1]),:));
dd = d(:,1).^2 + d(:,2).^2;
tf = ~any(diff(dd));
assert(tf)
sxy =
4
|
3 | Pass |
xy = [35 33;41 28;68 39;67 47;68 48;89 41;85 78;79 79;76 89;70 92;28 76;29 61;26 47;23 43;1 4;7 1];
ix = find_the_square(xy);
d = diff(xy(ix([1 2 3 4 1]),:));
dd = d(:,1).^2 + d(:,2).^2;
tf = ~any(diff(dd));
assert(tf)
sxy =
16
|
4 | Pass |
xy = [18 53;21 46;46 18;68 12;65 24;95 46;81 46;64 61;65 71;53 81];
ix = find_the_square(xy);
d = diff(xy(ix([1 2 3 4 1]),:));
dd = d(:,1).^2 + d(:,2).^2;
tf = ~any(diff(dd));
assert(tf)
sxy =
10
|
5 | Pass |
xy = [39 83;48 77;55 78;55 98;65 94;100 70;94 45;83 55;64 63;65 37;73 20;55 11;53 14;32 7;22 10;11 39;12 41;11 53;11 54];
ix = find_the_square(xy);
d = diff(xy(ix([1 2 3 4 1]),:));
dd = d(:,1).^2 + d(:,2).^2;
tf = ~any(diff(dd));
assert(tf)
sxy =
19
|
6 | Pass |
xy = [29 13;41 7;53 16;58 48;80 41;78 85;46 80;7 46];
ix = find_the_square(xy);
d = diff(xy(ix([1 2 3 4 1]),:));
dd = d(:,1).^2 + d(:,2).^2;
tf = ~any(diff(dd));
assert(tf)
sxy =
8
|
1163 Solvers
Arrange vector in ascending order
624 Solvers
277 Solvers
Eliminate unnecessary polygon vertices
23 Solvers
60 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!