0
|
1 % Plots a transfinite interpolation in x,y space using nu and nv curves along u and v axes.
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8 % Plots a interp of a triangle where one the interpolation is from a square
|
|
9 % with one side collapsed to
|
|
10 function h = triang_plot_interp_kindaworking(S,n)
|
|
11 u = linspace(0,1,n);
|
|
12 v = linspace(0,1,n);
|
|
13
|
|
14 m = 100;
|
|
15 m = 20;
|
|
16
|
|
17 Xl_curves = cell(n,1);
|
|
18 Xr_curves = cell(n,1);
|
|
19 Y_curves = cell(n,1);
|
|
20
|
|
21
|
|
22 function u = wierdness(v,d,N)
|
|
23 if N == 0
|
|
24 u = 0;
|
|
25 else
|
|
26 u = N*d./(1-v);
|
|
27 end
|
|
28 end
|
|
29
|
|
30
|
|
31 %Y curves
|
|
32 t = linspace(0,1,m);
|
|
33 for i = 1:n
|
|
34 x = []; y = [];
|
|
35 for j = 1:length(t)
|
|
36 [x(j),y(j)] = S(t(j),v(i));
|
|
37 end
|
|
38 Y_curves{i} = [x', y'];
|
|
39 end
|
|
40
|
|
41
|
|
42 % Right and left X curves
|
|
43 t = linspace(0,1,m);
|
|
44 d = u(2);
|
|
45 for i = 1:n
|
|
46 xl = []; yl = [];
|
|
47 xr = []; yr = [];
|
|
48 N = i-1;
|
|
49 t = linspace(0,1-N*d,m);
|
|
50 for j = 1:length(t)
|
|
51 w = wierdness(t(j),d,N);
|
|
52 [xr(j),yr(j)] = S(w,t(j));
|
|
53 [xl(j),yl(j)] = S(1-w,t(j));
|
|
54 end
|
|
55 Xl_curves{i} = [xl', yl'];
|
|
56 Xr_curves{i} = [xr', yr'];
|
|
57 end
|
|
58
|
|
59 for i = 1:n-1
|
|
60 line(Xl_curves{i}(:,1),Xl_curves{i}(:,2))
|
|
61 line(Xr_curves{i}(:,1),Xr_curves{i}(:,2))
|
|
62 line(Y_curves{i}(:,1),Y_curves{i}(:,2))
|
|
63 end
|
|
64 end
|
|
65
|
|
66
|
|
67
|
|
68
|
|
69 function h = triang_plot_interp_nonworking(S,n)
|
|
70
|
|
71 u = linspace(0,1,n);
|
|
72 v = linspace(0,1,n);
|
|
73
|
|
74 m = 100;
|
|
75
|
|
76 X_curves = cell(n-1,1);
|
|
77 Y_curves = cell(n-1,1);
|
|
78 K_curves = cell(n-1,1);
|
|
79
|
|
80
|
|
81 t = linspace(0,1,m);
|
|
82 for i = 1:n-1
|
|
83 x = []; y = [];
|
|
84 for j = find(t+u(i) <= 1)
|
|
85 [x(j),y(j)] = S(u(i),t(j));
|
|
86 end
|
|
87 X_curves{i} = [x', y'];
|
|
88 end
|
|
89
|
|
90 for i = 1:n-1
|
|
91 x = []; y = [];
|
|
92 for j = find(t+v(i) <= 1)
|
|
93 [x(j),y(j)] = S(t(j),v(i));
|
|
94 end
|
|
95 Y_curves{i} = [x', y'];
|
|
96 end
|
|
97
|
|
98 for i = 2:n
|
|
99 x = []; y = [];
|
|
100 for j = find(t<u(i))
|
|
101 [x(j),y(j)] = S(t(j), u(i)-t(j));
|
|
102 end
|
|
103 K_curves{i-1} = [x', y'];
|
|
104 end
|
|
105
|
|
106 for i = 1:n-1
|
|
107 line(X_curves{i}(:,1),X_curves{i}(:,2))
|
|
108 line(Y_curves{i}(:,1),Y_curves{i}(:,2))
|
|
109 line(K_curves{i}(:,1),K_curves{i}(:,2))
|
|
110 end
|
|
111
|
|
112 h = -1;
|
|
113 % h = plot(X_curves{:},Y_curves{:},K_curves{:});
|
|
114 end
|