-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathcreateBH.m
64 lines (55 loc) · 1.53 KB
/
createBH.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
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
function [BH, BMother] = createBH(H, HN);
%createBH Creates a boundary topology
%
% USAGE:
%
% [BH, BMother] = createBH(H, HN);
%
% [BH, BMother] = createBH(H, createHN(H));
%
%
% DESCRIPTION:
%
% Given topology H and its neighbourhood HN, will create
% boundary topology BH. Can also produce BMother which defines
% index into H to which boundary element belongs to.
%
%
% INPUT:
%
% H - Topology matrix
% HN - Neighborhood topology matrix
%
% OUTPUT:
%
% BH - Boundary topology matrix
% BMother - Vector in which each row defines an index in H to which the
% boundary element belongs to
%
% This function is provided with ValoMC
if(size(H,2) > 3)
if(exist('createBH3') == 0)
error('Cannot find mex function createBH3. It is located at cpp/3d/createBH3mex.cpp. See installation instructions how to compile it');
end
if(nargout > 1)
error('Cannot create BMother for 3d meshes yet.');
end
BH = createBH3(int64(H));
else
[els, edge] = find(HN == 0);
BH = zeros(numel(els), 2);
BMother = zeros(size(BH, 1), 1);
for(el = 1 : length(BH))
if(edge(el) == 1)
BH(el, :) = H( els(el), [1 2]);
BMother(el) = els(el);
elseif(edge(el) == 2)
BH(el, :) = H( els(el), [2 3]);
BMother(el) = els(el);
elseif(edge(el) == 3)
BH(el, :) = H( els(el), [3 1]);
BMother(el) = els(el);
end
end;
%BH=sortBH(BH);
end