-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv_plot_plane.m
More file actions
36 lines (31 loc) · 1.15 KB
/
v_plot_plane.m
File metadata and controls
36 lines (31 loc) · 1.15 KB
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 [] = v_plot_plane(plane_norm, plane_V, plane_point, dim, face_color, edge_color)
%% v_plot_plane(plane_norm, plane_V, plane_point, dim, face_color, edge_color)
% This will plot a rectangular plane from the outputs of v_plane_fit
% dim is 1x2 that determines the size of the rectangle
% face_color and edge_color control the plane's color
% Example 1:
% input_points = [0, 0, 0; 1, 2, 3; 1, -2, 3]
% [plane_norm, plane_V, plane_point] = v_plane_fit(input_points)
% figure(1)
% cla
% hold on
% v_plot_plane(plane_norm', plane_V', plane_point, [3 3])
% plot3(input_points(:,1), input_points(:,2), input_points(:,3),'k*')
%
% J. Wigglesworth 2018
try
face_color;
catch
face_color = [0.7 0 0];
end
try
edge_color;
catch
edge_color = 'red';
end
trans_mat = v_make_pose(plane_point', [plane_V(1,:)', plane_V(2,:)', plane_norm']);
P_c = [-dim(1) -dim(2) 0 1; -dim(1) dim(2) 0 1; dim(1) dim(2) 0 1; dim(1) -dim(2) 0 1];
P_c = trans_mat*P_c';
P_c = P_c(1:3,:)';
patch('Faces', (1:4),'Vertices',P_c,'FaceColor', face_color,'EdgeColor', edge_color,'FaceAlpha',0.2);
end