You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

3 years ago
%--------------------------
% @Author: Jingqiao Hu
% @Date: 2021-07-02 16:21:35
% @LastEditTime: 2021-07-02 16:45:10
%--------------------------
function plot_control_points(U_bezier, nelx, nely, num_b)
[ref_nodes, ~, ~] = multi_generate_mesh(1, nelx, nely, num_b);
offset = [0.9, 0.5];
regulated = [1, -1];
cp = colormap(jet);
u0 = reshape(U_bezier, 2, [])';
for kk = 1:2
mc = regulated(kk);
figure;
scatter3(ref_nodes(:,1),ref_nodes(:,2), mc*u0(:,kk) + offset(kk), 8, 'k','filled'); hold on;
maxk = max(mc*u0(:, kk));
mink = min(mc*u0(:, kk));
cci = round((mc * u0(:,kk) - mink) / (maxk-mink) * 255)+1;
colors1 = cp(cci, :);
x = [ref_nodes(:,1), ref_nodes(:,1)]';
y = [ref_nodes(:,2), ref_nodes(:,2)]';
z = [mc * u0(:,kk)+offset(kk), 0 * u0(:,kk)]';
for i2 = 1 : size(u0, 1)
plot3(x(:,i2), y(:,i2), z(:,i2), '-', 'LineWidth',1,'Color',colors1(i2,:)); hold on;
end
axis equal; axis off; colormap(jet);
end
end