-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplotMeshAndPoints.m
More file actions
66 lines (55 loc) · 2.01 KB
/
plotMeshAndPoints.m
File metadata and controls
66 lines (55 loc) · 2.01 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function plotMeshAndPoints( V, F, params )
%===============================================================
% module:
% ------
% plotMeshAndPoints.m
%
% paper:
% -------
% Point registration via efficient convex relaxation.
% Haggai Maron, Nadav Dym, Itay Kezurer, Shahar Kovalsky,Yaron Lipman
%
% Description:
% -----------
% Plots a given mesh and points on it according to a predefined color map
%===============================================================
%--------------------------------------------
% Initialization
%--------------------------------------------
params.null = [];
n = getoptions(params,'n',1);
verInd = getoptions(params,'verInd',1:n);
buttonDownFuncHandle = getoptions(params,'funcHandle',@vertexCallback);
scattColor = getoptions(params,'scattColor','c');
scattSize = getoptions(params,'scattSize',500);
meshIdx = getoptions(params,'meshIdx',1);
labels = getoptions(params,'labels',{});
% check size of verInd compared to n
if n ~= size( verInd, 2 )
% warning('n = %d, size(verInd) = %d. Taking n to be %d.', n, size( verInd, 2 ), size( verInd, 2 ));
n = size( verInd, 2 );
end
%============================================
%--------------------------------------------
% Take out NaNs
%--------------------------------------------
nanInd = isnan(verInd);
%============================================
%--------------------------------------------
% Extract verteces and faces information
%--------------------------------------------
axis equal; axis off;
if isempty(labels)
labels = cellstr( num2str([1:n]') );
end
if ~isempty(F)
patch('vertices',V','faces',F','FaceColor',[0.6 0.6 0.6],'EdgeColor','none','FaceAlpha',1,'ButtonDownFcn',{buttonDownFuncHandle,meshIdx});
else
scatter3(V(1,:), V(2,:), V(3,:),10,[0.6 0.6 0.6]);
end
hold on
scatter3(V(1,verInd(~nanInd)), V(2,verInd(~nanInd)), V(3,verInd(~nanInd)),scattSize,scattColor,'filled');
axis equal, axis off
addRot3D;
%============================================
end