-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_checker.m
More file actions
37 lines (31 loc) · 882 Bytes
/
plot_checker.m
File metadata and controls
37 lines (31 loc) · 882 Bytes
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
function [checker_plot] = plot_checker(checker, color, transp)
%PLOT_CHECKER Plots the checkerboard
% Intakes the NaN-separated checkerboard squares, plots them as a patch
%
% Copyright (c) 2020, Ian G. Bennett
% All rights reserved.
% Development funded by the University of Toronto, Department of
% Mechanical and Industrial Engineering.
% Distributed under GNU AGPLv3 license.
if ~exist('checker', 'var')
load('checker.mat')
end
if ~exist('color', 'var')
color = 'k';
end
if ~exist('transp', 'var')
transp = 0.3;
end
% Strip the NaNs from the checker definition array
x = checker(:,1);
y = checker(:,2);
x(isnan(x)) = [];
y(isnan(y)) = [];
% Reshape into columns
x = reshape(x,5,[]);
y = reshape(y,5,[]);
% Plot the checkerboard
checker_plot = patch(x, y, color);
set(checker_plot, 'facealpha', transp)
set(checker_plot, 'LineStyle', 'none')
end