Skip to content

Commit 70104ef

Browse files
committed
Show point release number in startup banner.
0 parents  commit 70104ef

File tree

391 files changed

+105680
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

391 files changed

+105680
-0
lines changed

@Camera/Camera.m

+760
Large diffs are not rendered by default.

@Camera/plot_camera.m

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
%Camera.plot_camera Display camera icon in world view
2+
%
3+
% C.plot_camera(OPTIONS) draw a camera as a simple 3D model in the current
4+
% figure.
5+
%
6+
% Options::
7+
% 'Tcam',T Camera displayed in pose T (homogeneous transformation 4x4)
8+
% 'scale',S Overall scale factor (default 0.2 x maximum axis dimension)
9+
%
10+
% Notes::
11+
% - The graphic handles are stored within the Camera object.
12+
13+
function h = plot_camera(c, varargin)
14+
15+
opt.Tcam = c.T;
16+
opt.scale = [];
17+
opt.square = false; %??
18+
19+
[opt,arglist] = tb_optparse(opt, varargin);
20+
21+
if isempty(opt.scale)
22+
% get the overall scale factor from the existing graph
23+
sz = [get(gca, 'Xlim'); get(gca, 'Ylim'); get(gca, 'Zlim')];
24+
sz = max(sz(:,2)-sz(:,1));
25+
opt.scale = sz / 5;
26+
end
27+
28+
if 1
29+
c.h_camera3D = c.drawCamera(opt.scale, arglist{:});
30+
31+
set(c.h_camera3D, 'Matrix', opt.Tcam);
32+
33+
else
34+
% old representation as a colored pyramid
35+
% define pyramid dimensions from the size parameter
36+
w = opt.scale;
37+
l = w*2;
38+
39+
% define the vertices of the camera
40+
vertices = [
41+
0 w/2 -w/2 -w/2 w/2
42+
0 w/2 w/2 -w/2 -w/2
43+
0 l l l l ];
44+
45+
ud.vertices = vertices;
46+
47+
% create the camera
48+
vertices = homtrans(T, vertices);
49+
50+
% the first index for each face controls the face color
51+
faces = [
52+
1 2 5 NaN
53+
2 1 3 NaN
54+
3 4 1 NaN
55+
4 1 5 NaN
56+
%5 2 3 4
57+
%2 3 4 5
58+
];
59+
60+
colors = [
61+
1 0 0 % R
62+
0 1 0 % G
63+
1 0 0 % R
64+
0 1 0 % G
65+
%0 0 1 % B
66+
];
67+
68+
if ishandle(c.h_visualize)
69+
set(c.h_visualize, 'Vertices', vertices');
70+
set(c.h_visualize, 'FaceAlpha', 1);
71+
else
72+
h = patch('Vertices', vertices', ...
73+
'Faces', faces, ...
74+
'FaceVertexCData', colors, ...
75+
'FaceColor','flat', ...
76+
'UserData', ud);
77+
%set(h, 'FaceAlpha', 0.5);
78+
P = transl(T);
79+
if opt.label
80+
text(P(1), P(2), P(3), c.name);
81+
end
82+
c.h_visualize = h; % save handle for later
83+
end
84+
end
85+
86+
end

@CentralCamera/..@Camera/showpose.m

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
%SHOWPOSE Display a camera icon in 3D
2+
%
3+
% h = cam.showpose(T)
4+
%
5+
% Create a new camera at pose T, and return the graphics handle.
6+
%
7+
% The camera is depicted as a pyramid with the apex as the camera
8+
% origin and the base plane normal to the optical axis.
9+
% The sides are colored red, green, blue corresponding to the X, Y, Z axes
10+
% respectively.
11+
12+
13+
function h = showpose(c, T, sz)
14+
15+
if nargin < 2
16+
T = eye(4,4);
17+
end
18+
if nargin < 3
19+
% get the overall scale factor from the existing graph
20+
sz = [get(gca, 'Xlim'); get(gca, 'Ylim'); get(gca, 'Zlim')];
21+
sz = max(sz(:,2)-sz(:,1));
22+
sz = sz / 20;
23+
end
24+
25+
% define pyramid dimensions from the size parameter
26+
w = sz;
27+
l = sz*2;
28+
29+
% define the vertices of the camera
30+
vertices = [
31+
0 0 0
32+
w/2 w/2 l
33+
-w/2 w/2 l
34+
-w/2 -w/2 l
35+
w/2 -w/2 l
36+
];
37+
38+
ud.vertices = vertices;
39+
40+
% create the camera
41+
vertices = transformp(T, vertices')';
42+
43+
% the first index for each face controls the face color
44+
faces = [
45+
1 2 5 NaN
46+
2 1 3 NaN
47+
3 4 1 NaN
48+
4 1 5 NaN
49+
5 2 3 4
50+
%2 3 4 5
51+
];
52+
53+
colors = [
54+
1 0 0 % R
55+
0 1 0 % G
56+
1 0 0 % R
57+
0 1 0 % G
58+
0 0 1 % B
59+
];
60+
61+
if isempty(c.camview)
62+
% create the camera view
63+
h = patch('Vertices', vertices, ...
64+
'Faces', faces, ...
65+
'FaceVertexCData', colors, ...
66+
'FaceColor','flat', ...
67+
'UserData', ud);
68+
69+
set(h, 'FaceAlpha', 1.0);
70+
c.camview = h;
71+
c.camview_sz = sz;
72+
else
73+
set(c.camview, 'Vertices', vertices);
74+
end
75+
end

0 commit comments

Comments
 (0)