1 |
edhill |
1.1 |
function m = unmangleJPL1(A, ne, tx) |
2 |
|
|
|
3 |
|
|
% Function m = unmangleJPL1(A, ne, tx) |
4 |
|
|
% |
5 |
|
|
% |
6 |
|
|
% INPUTS |
7 |
|
|
% A matrix in 1 layer of the rotten JPL format |
8 |
|
|
% ne number of values alone each edge of each face |
9 |
|
|
% tx number of values along each tile edge |
10 |
|
|
% |
11 |
|
|
% OUTPUTS |
12 |
|
|
% m output array of dimension ne,ne,6 |
13 |
|
|
|
14 |
|
|
if nargin ~= 3 |
15 |
|
|
disp('Error: wrong number of arguments') |
16 |
|
|
exit |
17 |
|
|
end |
18 |
|
|
|
19 |
|
|
cx = ne; |
20 |
|
|
cy = ne; |
21 |
|
|
nt = ne*ne*6/(tx*tx); |
22 |
|
|
|
23 |
|
|
m = zeros(ne,ne,6); |
24 |
|
|
ite = 0; |
25 |
|
|
jte = 1; |
26 |
|
|
ntte = 1; |
27 |
|
|
for i = 1:nt |
28 |
|
|
il = (i - 1)*tx + 1; |
29 |
|
|
ih = il + tx - 1; |
30 |
|
|
tepart = A(il:ih,:); |
31 |
|
|
ite = ite + 1; |
32 |
|
|
itel = (ite - 1)*tx + 1; |
33 |
|
|
iteh = itel + tx - 1; |
34 |
|
|
jtel = (jte - 1)*tx + 1; |
35 |
|
|
jteh = jtel + tx - 1; |
36 |
|
|
m(itel:iteh,jtel:jteh,ntte) = tepart; |
37 |
|
|
if iteh == cx |
38 |
|
|
ite = 0; |
39 |
|
|
jte = jte + 1; |
40 |
|
|
if jteh == cy |
41 |
|
|
jte = 1; |
42 |
|
|
ntte = ntte + 1; |
43 |
|
|
end |
44 |
|
|
end |
45 |
|
|
end |