-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_indeces.m
More file actions
75 lines (71 loc) · 2.56 KB
/
generate_indeces.m
File metadata and controls
75 lines (71 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
function [ indeces ] = generate_indeces( low, high, dimension )
%
%indicesA are selections of 3 points from the number of points in the NNC
%(not used in the current version of the script)
%indicesB generates the permutations of points in a long string. The number
%of permutations of D=dimension points is the number of elements of
%indicesB / D.
%indicesD is the possible registrations.
%indicesC is the possible registrations extended to vectorise difference
%calculations between points of D dimension. So that all of the distances
%can be identified for the registration.
n = high - low + 1;
indeces = struct;
indeces = repmat(indeces, 1, n);
npointsB = high;
for a = 1:n;
npointsA = a + low - 1;
if dimension == 3;
indecesB = zeros(1, factorial(dimension) * nchoosek(npointsB, dimension));
c = 1:npointsB;
count = 1;
for x = 1:npointsB
for y = 1:npointsB
for z = 1:npointsB
if ne(x,y) && ne(x,z) && ne(y,z);
indecesB(count*3-2 : count*3) = [c(x), c(y), c(z)];
count = count + 1;
end
end
end
end
elseif dimension == 2;
indecesB = zeros(1, dimension * nchoosek(npointsB, dimension));
c = 1:npointsB;
count = 1;
for x = 1:npointsB
for y = 1:npointsB
if ne(x,y)
indecesB(count*2-1 : count*2) = [c(x), c(y)];
count = count + 1;
end
end
end
end
I = 1:npointsA;
indecesA = nchoosek(I, dimension);
indecesA = reshape(indecesA',1, numel(indecesA(:,1)) * numel(indecesA(1,:)));
indecesC = zeros(npointsA*npointsB*dimension,2); % for the ICP and vectorising diff
count = 1;
dim = dimension; %so i can fit subsequent calcs onto one line
for x = 1:npointsA
for y = 1:npointsB
for z = 0:(dimension-1)
indecesC(count, :) = [x * dim - (dim - 1) + z, y*dim-(dim-1) + z];
count = count + 1;
end
end
end
indecesD = zeros(npointsA * npointsB, 2);
count = 1;
for x = 1:npointsA
for y = 1:npointsB
indecesD(count, :) = [x,y];
count = count + 1;
end
end
indeces(a).indecesA = indecesA;
indeces(a).indecesB = indecesB;
indeces(a).indecesC = indecesC;
indeces(a).indecesD = indecesD;
end