-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathplot_chk_collision.m
More file actions
27 lines (23 loc) · 852 Bytes
/
plot_chk_collision.m
File metadata and controls
27 lines (23 loc) · 852 Bytes
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
function plot_chk_collision(line, poly)
close(findobj('type','figure','name','collision test'));
figure('name','collision test');
% poly should be a cell array
shape_count = size(poly, 2);
for i = 1:shape_count
crnt_poly = poly{i};
poly_size = size(crnt_poly); % the ith perticular segments
% check dimension is 2
if poly_size(2) ~= 2
close(findobj('type','figure','name','collition test'));
return; % error, incorrect polymer definition
end
% check line segement return to start
if any(crnt_poly(poly_size(1), :) ~= crnt_poly(1, :))
poly_size(1) = poly_size(1)+1;
crnt_poly(poly_size(1), :) = crnt_poly(1, :);
end
%seg_count = poly_size(1) - 1;
plot(crnt_poly(:,1), crnt_poly(:,2)); hold on;
end
plot(line(:,1), line(:,2), 'r:*'); axis equal;
end