-
Notifications
You must be signed in to change notification settings - Fork 2
/
tripatch.m
32 lines (31 loc) · 956 Bytes
/
tripatch.m
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
function handle=tripatch(struct, nofigure, varargin)
% TRIPATCH handle=tripatch(struct, nofigure)
if nargin<2 | isempty(nofigure)
figure
end% if
if nargin<3
handle=trisurf(struct.tri, struct.vert(:, 1), struct.vert(:, 2), struct.vert(:, 3));
else
if isnumeric(varargin{1})
col=varargin{1};
varargin(1)=[];
if [1 3]==sort(size(col))
col=repmat(col(:)', [size(struct.vert, 1) 1]);
end% if
handle=trisurf(struct.tri, struct.vert(:, 1), struct.vert(:, 2), struct.vert(:, 3), ...
'FaceVertexCData', col, varargin{:});
if length(col)==size(struct.vert, 1)
set(handle, 'FaceColor', 'interp');
end% if
else
handle=trisurf(struct.tri, struct.vert(:, 1), struct.vert(:, 2), struct.vert(:, 3), varargin{:});
end% if
end% if
axis tight
axis equal
hold on
if version('-release')>=12
cameratoolbar('setmode', 'orbit')
else
rotate3d on
end% if