-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_gui.m
93 lines (81 loc) · 2.76 KB
/
my_gui.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
% digital art
clearvars *
close all
clc
figure
t = linspace(0,4*pi,500);
x = cos(t);
y = sin(t);
z = (cos(2.*t)).*sin(20.*t);
a = -pi : pi/2 : pi; % Define Corners
ph = pi/4; % Define Angular Orientation (‘Phase’)
A = [cos(a+ph); cos(a+ph)]/cos(ph)./5;
B = [sin(a+ph); sin(a+ph)]/sin(ph)./5;
C = [-ones(size(a)); ones(size(a))]./5;
colormap bone
cmap = colormap;
temp = cmap(1:2:end,:);
temp_flip = flip(temp);
cmap = [temp; temp_flip];
k=1;
t_k = t(k);
x_k = x(k);
y_k = y(k);
z_k = z(k);
Plot_color=cmap(round(k*end/(length(t)+5))+1,:);
plot3(x_k, y_k, z_k, 'o', 'LineWidth', 3, 'MarkerSize', 15,'Color','r')
hold on
surf(A,B,C, 'FaceColor',Plot_color,'EdgeColor','none') % Plot Cube
patch(A', B', C', Plot_color, 'EdgeColor', 'none')
plot3(x,y,z,'-', 'LineWidth', 3,'Color',Plot_color)
hold off
view([30 + 360*t_k/(4*pi) 50+35*cos(pi/2+t_k/4)])
axis off
title('TundeFinder')
drawnow
set(figure(1),'WindowButtonDownFcn',@mytestcallback);
function []=mytestcallback(src,~)
t = linspace(0,4*pi,500);
x = cos(t);
y = sin(t);
z = (cos(2.*t)).*sin(20.*t);
a = -pi : pi/2 : pi; % Define Corners
ph = pi/4; % Define Angular Orientation (‘Phase’)
A = [cos(a+ph); cos(a+ph)]/cos(ph)./5;
B = [sin(a+ph); sin(a+ph)]/sin(ph)./5;
C = [-ones(size(a)); ones(size(a))]./5;
colormap bone
cmap = colormap;
temp = cmap(1:2:end,:);
temp_flip = flip(temp);
cmap = [temp; temp_flip];
ending_condition = 1 ;
while ending_condition
for k=1:length(t)
t_k = t(k);
x_k = x(k);
y_k = y(k);
z_k = z(k);
Plot_color=cmap(round(k*end/(length(t)+5))+1,:);
plot3(x_k, y_k, z_k, 'o', 'LineWidth', 3, 'MarkerSize', 15,'Color','r')
hold on
surf(A,B,C, 'FaceColor',Plot_color,'EdgeColor','none') % Plot Cube
patch(A', B', C', Plot_color, 'EdgeColor', 'none')
plot3(x,y,z,'-', 'LineWidth', 3,'Color',Plot_color)
hold off
view([30 + 360*t_k/(4*pi) 50+35*cos(pi/2+t_k/4)])
axis off
drawnow
end
if ~ending_condition
close all
predictionn = "yalan";
plot_prediction(predictionn)
end
end
end
function []=plot_prediction(predictionn)
img_read = imread("./figs/"+predictionn);
image(img_read)
axis off
end