forked from tom-etchells/PowerCubeSat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfcn_draw_geometry.m
25 lines (21 loc) · 974 Bytes
/
fcn_draw_geometry.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
function fcn_draw_geometry(app, thisAxes)
% clear axes
cla(thisAxes)
% set new geometry
app.panel = fcn_set_geometry(app.U, app.depPanels, app.theta, app.normalDir);
% for each panel
for j = 1:length(app.panel)
% draw the panel
patch(thisAxes, app.panel{j}.points(:,1), app.panel{j}.points(:,2), app.panel{j}.points(:,3), app.panel{j}.color);
% draw the panel normal
fcn_plot_line(thisAxes, mean(app.panel{j}.points(:,1)), mean(app.panel{j}.points(:,2)), mean(app.panel{j}.points(:,3)), app.panel{j}.unitNormal(1), app.panel{j}.unitNormal(2), app.panel{j}.unitNormal(3), 'k', 100)
end
%% Functions
function fcn_plot_line(thisAxes, x, y, z, i, j, k, C, mag)
% plots line
% x, y, z = starting point of line
% i, j, k = direction of line (unit vecotr)
% mag = length of line
line(thisAxes, [x (x + i * mag)], [y (y + j * mag)], [z (z + k * mag)],'Color', C, 'LineWidth', 2)
end
end