-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointTest.m
More file actions
38 lines (31 loc) · 1.12 KB
/
pointTest.m
File metadata and controls
38 lines (31 loc) · 1.12 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
%import surface and image
armPoints=createSurface();
%Convert R theta y values into x,z,y
armXZY=zeros(10000,3);
armXZY(:,1)=armPoints(:,1).*cos(armPoints(:,2));
armXZY(:,2)=armPoints(:,1).*sin(armPoints(:,2));
armXZY(:,3)=armPoints(:,3);
%Flatten surface
for i=0:length(armXZY)/length(unique(armXZY(:,3)))-1
tfCordsSt1 = sqrt((armXZY(i*100+2:i*100+100,1)-armXZY(i*100+1:i*100+99,1)).^2+(armXZY(i*100+2:i*100+100,2)-armXZY(i*100+1:i*100+99,2)).^2);
tfCords(i*100+2:i*100+100,1) = cumsum(tfCordsSt1);
tfCords(i*100+1:i*100+100,2) = armXZY(i*100+1:i*100+100,3);
end
%angled line
u=transpose(linspace(2,100,100));
v=[u(1:50);-u(1:50)+u(75)];
zuv=ones([length(u),1])*41;
%find closest points on flattened/unwrapped surface
k=dsearchn(tfCords,[u,v]);
%use index to reverse transform points on unwrapped surface to original
%surface
bustanut=armXZY(k,:);
%plots
scatter3(armXZY(:,1),armXZY(:,3),armXZY(:,2))
hold on
tfCords4Plot = tfCords;
tfCords4Plot(:,3) = 40;
scatter3(-tfCords4Plot(:,1),tfCords4Plot(:,2),tfCords4Plot(:,3),'red')
scatter3(-u,v,zuv,'green')
scatter3(bustanut(:,1),bustanut(:,3),bustanut(:,2),'green')
hold off