Files
mcm-26-b/scripts/matlab/fig_geo_q2_safe_disk.m
T
2026-09-13 10:27:09 +08:00

56 lines
2.4 KiB
Matlab
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
function fig_geo_q2_safe_disk()
%FIG_GEO_Q2_SAFE_DISK 问题二:截断角域外接圆与保证接收的安全候选盘。
S = fig_style();
D = load_data(S, 'geo_q2');
H = geom_helpers();
fig = figure('Color', 'w', 'Visible', 'off');
t = tiledlayout(fig, 1, 2, 'TileSpacing', 'compact', 'Padding', 'compact');
% 左:真实几何(Ω 内的角域与两个候选圆)
ax1 = nexttile(t);
hold(ax1, 'on');
H.circle(ax1, [0 0], D.omega_r, pick_color(S, 'primary'), 1.2, '-');
hw = H.wedge(ax1, D.wedge, pick_color(S, 'accent'), 0.25);
hd = H.circle(ax1, D.c, D.a, pick_color(S, 'violet'), 1.2, '--');
hs = H.disk(ax1, D.c, D.safe, pick_color(S, 'success'), 0.30, '-');
H.marker(ax1, [0 0], pick_color(S, 'accent'), 6, true);
H.marker(ax1, D.c, pick_color(S, 'violet'), 5, true);
H.label_points(ax1, [0 0], {'s1'}, pick_color(S, 'accent'));
H.label_points(ax1, D.c, {'c'}, pick_color(S, 'violet'));
hold(ax1, 'off');
axis(ax1, 'equal');
xlim(ax1, [-D.half, D.half]);
ylim(ax1, [-D.half, D.half]);
xlabel(ax1, 'x / m');
ylabel(ax1, 'y / m');
legend(ax1, [hw, hd, hs], D.legend, 'Location', 'southoutside', ...
'Orientation', 'horizontal');
% 右:半径分解 a + (1000 − a) = 1000 m
ax2 = nexttile(t);
hold(ax2, 'on');
H.circle(ax2, [0 0], D.a, pick_color(S, 'violet'), 1.2, '--');
H.disk(ax2, [0 0], D.safe, pick_color(S, 'success'), 0.30, '-');
H.marker(ax2, [0 0], 'k', 5, true);
ang = deg2rad(35);
p_out = D.a * [cos(ang), sin(ang)];
p_in = D.safe * [cos(-ang), sin(-ang)];
H.arrow(ax2, [0 0], p_out, pick_color(S, 'violet'));
H.arrow(ax2, [0 0], p_in, pick_color(S, 'success'));
text(ax2, p_out(1) * 1.06, p_out(2) * 1.12, sprintf('a = %.1f m', D.a), ...
'Color', pick_color(S, 'violet'), 'Interpreter', 'none');
text(ax2, p_in(1) * 1.04, p_in(2) * 1.30, sprintf('1000 − a = %.1f m', D.safe), ...
'Color', pick_color(S, 'success'), 'HorizontalAlignment', 'right', ...
'Interpreter', 'none');
text(ax2, -D.safe * 0.45, 0, 'c', 'Color', 'k', ...
'HorizontalAlignment', 'right', 'VerticalAlignment', 'middle');
hold(ax2, 'off');
axis(ax2, 'equal');
xlim(ax2, [-D.a * 1.15, D.a * 1.75]);
ylim(ax2, [-D.a * 1.05, D.a * 1.05]);
axis(ax2, 'off');
fig_save(fig, S, 'geo-q2-guaranteed-reception-disk.png');
end