-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hierarchy.m
54 lines (44 loc) · 1.29 KB
/
Hierarchy.m
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
classdef Hierarchy < handle
%HIERARCHY represents a hierarchy of pointclouds.
% Detailed explanation goes here
properties
pointclouds
depth
fine2coarse
coarse2fine
MAXLEVELS = 30
CGMAX = 100
end
methods
function obj = Hierarchy(finePointcloud)
obj.pointclouds{1} = finePointcloud;
obj.pointclouds{1}.stats();
i=1;
obj.depth=1;
while ( obj.pointclouds{i}.N > obj.CGMAX && i < obj.MAXLEVELS )
[ obj.pointclouds{i+1}, obj.fine2coarse{i+1}, obj.coarse2fine{i+1} ] = obj.pointclouds{i}.coarsen;
if ( obj.pointclouds{i+1}.N < obj.CGMAX || obj.pointclouds{i}.N / obj.pointclouds{i+1}.N < 1.5)
obj.depth = i;
break;
else
obj.pointclouds{i+1}.findNeighbours();
obj.pointclouds{i+1}.organize;
obj.pointclouds{i+1}.stats()
i=i+1;
obj.depth = i;
end
end
end
function plot(obj,depth)
figure;
hold on;
for i=1:depth
plot(obj.pointclouds{i}.coords(:,1),obj.pointclouds{i}.coords(:,2),'.')
end
legend('Location','northwest');
hold off;
end
end
methods (Access=private)
end
end %class