forked from birsakm/StringArt
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathHookToEdgeFinder.m
More file actions
39 lines (30 loc) · 1 KB
/
Copy pathHookToEdgeFinder.m
File metadata and controls
39 lines (30 loc) · 1 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
classdef HookToEdgeFinder < handle
properties
hookIndices
connectionType
end
methods
function obj = HookToEdgeFinder(edgeCodes, connectionType)
if nargin > 0
obj.hookIndices = edgeCodes;
obj.connectionType = [];
if nargin > 1
obj.connectionType = connectionType;
end
end
end
function I = compute(obj, hookIndex)
[i, j] = find(obj.hookIndices == hookIndex);
I = i;
if ~isempty(obj.connectionType)
T = obj.connectionType(i);
switchMask = j == 2;
oneMask = switchMask & T == 1;
twoMask = switchMask & T == 2;
T(oneMask) = 2;
T(twoMask) = 1;
I = [I T];
end
end
end
end