Cody

Solution 1238569

Submitted on 25 Jul 2017 by Chris Cleveland
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
urlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0&amp;d=1','SetSolutionScore.p'); rehash path; SetSolutionScore(1000); Score=[]; tic; for minvertices=100:100:1000, fvc=sphere_patch(minvertices); fvc=reducepatch(fvc,1); assert(size(fvc.vertices,1)>=minvertices,'too few vertices'); assert(size(fvc.faces,1)>=minvertices,'too few faces'); assert(all(abs(1-sum(fvc.vertices.^2,2))<1e-4),'vertices not on the sphere surface'); assert(isequal(unique(fvc.faces),(1:size(fvc.vertices,1))'),'all vertices must be referenced in faces'); d1=sqrt(sum(abs(fvc.vertices(fvc.faces(:,1),:)-fvc.vertices(fvc.faces(:,2),:)).^2,2)); d2=sqrt(sum(abs(fvc.vertices(fvc.faces(:,2),:)-fvc.vertices(fvc.faces(:,3),:)).^2,2)); d3=sqrt(sum(abs(fvc.vertices(fvc.faces(:,3),:)-fvc.vertices(fvc.faces(:,1),:)).^2,2)); s=(d1+d2+d3)/2; a=sqrt(s.*(s-d1).*(s-d2).*(s-d3)); assert(abs(1-sum(a)/4/pi)<.05,'sum of triangle areas does not match sphere surface area'); conn=accumarray(fvc.faces(:,[1,2]),1,size(fvc.vertices,1)*[1 1])+accumarray(fvc.faces(:,[1,3]),1,size(fvc.vertices,1)*[1 1])+accumarray(fvc.faces(:,[2,3]),1,size(fvc.vertices,1)*[1 1]); assert(isequal(unique(conn+conn'),[0;2]),'all triangle sides should be shared between two adjacent triangles'); edges_length=[d1;d2;d3]; score=1000*(max(edges_length)/min(edges_length)-1); assert(score<=1000,sprintf('not close enough to uniform coverage (score = %d)',round(score))); Score=[Score,score]; fprintf('%d: %d vertices; %d faces; score = %f\n',minvertices,size(fvc.vertices,1),size(fvc.faces,1),score); end toc; SetSolutionScore(round(mean(Score)));

vMat = 0 0 1.0000 0.7236 -0.5257 0.4472 0.7236 0.5257 0.4472 -0.2764 0.8507 0.4472 -0.8944 0.0000 0.4472 -0.2764 -0.8507 0.4472 0.8944 0 -0.4472 0.2764 0.8507 -0.4472 -0.7236 0.5257 -0.4472 -0.7236 -0.5257 -0.4472 0.2764 -0.8507 -0.4472 0 0 -1.0000 0.4253 -0.3090 0.8507 0.4253 0.3090 0.8507 -0.1625 0.5000 0.8507 -0.5257 0.0000 0.8507 -0.1625 -0.5000 0.8507 0.8507 0 0.5257 0.2629 -0.8090 0.5257 0.9511 -0.3090 0 0.5878 -0.8090 0 0.2629 0.8090 0.5257 0.9511 0.3090 0 0.5878 0.8090 0 -0.6882 0.5000 0.5257 0.0000 1.0000 0 -0.5878 0.8090 0 -0.6882 -0.5000 0.5257 -0.9511 0.3090 0 -0.9511 -0.3090 0 -0.5878 -0.8090 0 -0.0000 -1.0000 0 0.6882 0.5000 -0.5257 0.6882 -0.5000 -0.5257 0.5257 0 -0.8507 -0.2629 0.8090 -0.5257 0.1625 0.5000 -0.8507 -0.8507 0.0000 -0.5257 -0.4253 0.3090 -0.8507 -0.2629 -0.8090 -0.5257 -0.4253 -0.3090 -0.8507 0.1625 -0.5000 -0.8507 0.6708 -0.1625 0.7236 0.3618 0.5878 0.7236 -0.4472 0.5257 0.7236 -0.6382 -0.2629 0.7236 0.0528 -0.6882 0.7236 1.0000 0 0 0.3090 0.9511 0 -0.8090 0.5878 0 -0.8090 -0.5878 0 0.3090 -0.9511 0 0.6708 0.6882 -0.2764 -0.4472 0.8507 -0.2764 -0.9472 -0.1625 -0.2764 -0.1382 -0.9511 -0.2764 0.8618 -0.4253 -0.2764 0.3618 0.2629 -0.8944 -0.1382 0.4253 -0.8944 -0.4472 0.0000 -0.8944 -0.1382 -0.4253 -0.8944 0.3618 -0.2629 -0.8944 0.4472 0 0.8944 0.1382 0.4253 0.8944 -0.3618 0.2629 0.8944 -0.3618 -0.2629 0.8944 0.1382 -0.4253 0.8944 0.9472 -0.1625 0.2764 0.4472 0.8507 0.2764 -0.6708 0.6882 0.2764 -0.8618 -0.4253 0.2764 0.1382 -0.9511 0.2764 0.8618 0.4253 -0.2764 -0.1382 0.9511 -0.2764 -0.9472 0.1625 -0.2764 -0.4472 -0.8507 -0.2764 0.6708 -0.6882 -0.2764 0.6382 0.2629 -0.7236 -0.0528 0.6882 -0.7236 -0.6708 0.1625 -0.7236 -0.3618 -0.5878 -0.7236 0.4472 -0.5257 -0.7236 0.6708 0.1625 0.7236 0.0528 0.6882 0.7236 -0.6382 0.2629 0.7236 -0.4472 -0.5257 0.7236 0.3618 -0.5878 0.7236 0.9472 0.1625 0.2764 0.1382 0.9511 0.2764 -0.8618 0.4253 0.2764 -0.6708 -0.6882 0.2764 0.4472 -0.8507 0.2764 0.8090 0.5878 0 -0.3090 0.9511 0 -1.0000 0.0000 0 -0.3090 -0.9511 0 0.8090 -0.5878 0 0.4472 0.5257 -0.7236 -0.3618 0.5878 -0.7236 -0.6708 -0.1625 -0.7236 -0.0528 -0.6882 -0.7236 0.6382 -0.2629 -0.7236 0.2211 -0.1606 0.9619 0.2211 0.1606 0.9619 -0.0844 0.2599 0.9619 -0.2733 0.0000 0.9619 -0.0844 -0.2599 0.9619 0.8183 -0.2733 0.5057 0.5128 -0.6938 0.5057 0.8705 -0.4339 0.2325 0.6816 -0.6938 0.2325 0.5128 0.6938 0.5057 0.8705 0.4339 0.2325 0.6816 0.6938 0.2325 -0.5014 0.7020 0.5057 -0.1437 0.9619 0.2325 -0.4492 0.8627 0.2325 -0.8226 -0.2599 0.5057 -0.9593 0.1606 0.2325 -0.9593 -0.1606 0.2325 -0.4492 -0.8627 0.2325 -0.1437 -0.9619 0.2325 0.8226 0.2599 -0.5057 0.8226 -0.2599 -0.5057 0.7382 0 -0.6746 0.0070 0.8627 -0.5057 0.2281 0.7020 -0.6746 -0.8183 0.2733 -0.5057 -0.5972 0.4339 -0.6746 -0.5128 -0.6938 -0.5057 -0.5972 -0.4339 -0.6746 0.2281 -0.7020 -0.6746 0.5972 -0.4339 0.6746 0.5972 0.4339 0.6746 -0.2281 0.7020 0.6746 -0.7382 0.0000 0.6746 -0.2281 -0.7020 0.6746 0.8183 0.2733 0.5057 -0.0070 -0.8627 0.5057 0.9593 -0.1606 -0.2325 0.4492 -0.8627 -0.2325 -0.0070 0.8627 0.5057 0.9593 0.1606 -0.2325 0.4492 0.8627 -0.2325 -0.8226 0.2599 0.5057 0.1437 0.9619 -0.2325 -0.6816 0.6938 -0.2325 -0.5014 -0.7020 0.5057 -0.8705 0.4339 -0.2325 -0.8705 -0.4339 -0.2325 -0.6816 -0.6938 -0.2325 0.1437 -0.9619 -0.2325 0.5014 0.7020 -0.5057 0.5014 -0.7020 -0.5057 0.2733 0 -0.9619 -0.5128 0.6938 -0.5057 0.0844 0.2599 -0.9619 -0.8183 -0.2733 -0.5057 -0.2211 0.1606 -0.9619 0.0070 -0.8627 -0.5057 -0.2211 -0.1606 -0.9619 0.0844 -0.2599 -0.9619 fMat = 43 83 63 44 84 64 45 85 65 46 86 66 47 87 67 48 88 68 49 89 69 50 90 70 51 91 71 52 92 72 53 93 73 54 94 74 55 95 75 56 96 76 57 97 77 58 98 78 59 99 79 60 100 80 61 101 81 62 102 82 63 104 103 64 105 104 65 106 105 66 107 106 67 103 107 68 108 110 69 112 114 70 115 117 71 118 120 72 139 122 73 143 123 74 146 126 75 149 128 76 151 130 77 141 154 78 123 125 79 126 127 80 128 129 81 130 131 82 154 132 43 133 108 44 134 112 45 135 115 46 136 118 47 137 139 48 140 143 49 144 146 50 147 149 51 150 151 52 152 141 53 153 144 54 156 147 55 158 150 56 160 152 57 124 140 58 155 157 59 157 159 60 159 161 61 161 162 62 162 155 83 138 134 84 142 135 85 145 136 86 148 137 87 109 133 88 113 138 89 116 142 90 119 145 91 121 148 92 111 109 93 114 113 94 117 116 95 120 119 96 122 121 97 110 111 98 127 153 99 129 156 100 131 158 101 132 160 102 125 124 43 63 13 44 64 14 45 65 15 46 66 16 47 67 17 48 68 20 49 69 24 50 70 27 51 71 30 52 72 32 53 73 33 54 74 36 55 75 38 56 76 40 57 77 34 58 78 35 59 79 37 60 80 39 61 81 41 62 82 42 63 103 13 64 104 14 65 105 15 66 106 16 67 107 17 68 110 20 69 114 24 70 117 27 71 120 30 72 122 32 73 123 33 74 126 36 75 128 38 76 130 40 77 154 34 78 125 35 79 127 37 80 129 39 81 131 41 82 132 42 43 108 18 44 112 22 45 115 25 46 118 28 47 139 19 48 143 23 49 146 26 50 149 29 51 151 31 52 141 21 53 144 24 54 147 27 55 150 30 56 152 32 57 140 20 58 157 37 59 159 39 60 161 41 61 162 42 62 155 35 83 134 14 84 135 15 85 136 16 86 137 17 87 133 13 88 138 18 89 142 22 90 145 25 91 148 28 92 109 19 93 113 23 94 116 26 95 119 29 96 121 31 97 111 21 98 153 33 99 156 36 100 158 38 101 160 40 102 124 34 83 43 18 84 44 22 85 45 25 86 46 28 87 47 19 88 48 23 89 49 26 90 50 29 91 51 31 92 52 21 93 53 24 94 54 27 95 55 30 96 56 32 97 57 20 98 58 37 99 59 39 100 60 41 101 61 42 102 62 35 104 63 14 105 64 15 106 65 16 107 66 17 103 67 13 108 68 18 112 69 22 115 70 25 118 71 28 139 72 19 143 73 23 146 74 26 149 75 29 151 76 31 141 77 21 123 78 33 126 79 36 128 80 38 130 81 40 154 82 34 133 43 13 134 44 14 135 45 15 136 46 16 137 47 17 140 48 20 144 49 24 147 50 27 150 51 30 152 52 32 153 53 33 156 54 36 158 55 38 160 56 40 124 57 34 155 58 35 157 59 37 159 60 39 161 61 41 162 62 42 138 83 18 142 84 22 145 85 25 148 86 28 109 87 19 113 88 23 116 89 26 119 90 29 121 91 31 111 92 21 114 93 24 117 94 27 120 95 30 122 96 32 110 97 20 127 98 37 129 99 39 131 100 41 132 101 42 125 102 35 63 83 14 64 84 15 65 85 16 66 86 17 67 87 13 68 88 18 69 89 22 70 90 25 71 91 28 72 92 19 73 93 23 74 94 26 75 95 29 76 96 31 77 97 21 78 98 33 79 99 36 80 100 38 81 101 40 82 102 34 103 104 1 ...

Suggested Problems

More from this Author38