-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_object_xy.m
73 lines (42 loc) · 1.88 KB
/
make_object_xy.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
63
64
65
66
67
68
69
70
71
72
73
function [ xy ] = make_object_xy(objecttype, objectcolour, mid_coords)
%MAKE_OBJECT_XY This is more or less a copy of display_object
% Outputs a 2x4 matrix with startx, starty, endx and endy for the TWO
% lines that are part of each object
fixCrossDimPix = 10;
if objecttype == 9
xCoords = [0 0 0 0];
yCoords = [0 0 0 0];
elseif objecttype == 8
xCoords = [-fixCrossDimPix -fixCrossDimPix -fixCrossDimPix fixCrossDimPix];
yCoords = [fixCrossDimPix -fixCrossDimPix 0 0];
elseif objecttype == 7
xCoords = [fixCrossDimPix fixCrossDimPix -fixCrossDimPix fixCrossDimPix];
yCoords = [fixCrossDimPix -fixCrossDimPix 0 0];
elseif objecttype == 6
xCoords = [0 0 -fixCrossDimPix fixCrossDimPix];
yCoords = [fixCrossDimPix -fixCrossDimPix fixCrossDimPix fixCrossDimPix];
elseif objecttype == 5
xCoords = [0 0 -fixCrossDimPix fixCrossDimPix];
yCoords = [fixCrossDimPix -fixCrossDimPix -fixCrossDimPix -fixCrossDimPix];
elseif objecttype == 4
xCoords = [-fixCrossDimPix fixCrossDimPix+2 fixCrossDimPix fixCrossDimPix];
yCoords = [-fixCrossDimPix -fixCrossDimPix -fixCrossDimPix fixCrossDimPix+2];
elseif objecttype == 3
xCoords = [-fixCrossDimPix fixCrossDimPix+2 fixCrossDimPix fixCrossDimPix];
yCoords = [fixCrossDimPix fixCrossDimPix -fixCrossDimPix fixCrossDimPix+2];
elseif objecttype == 2
xCoords = [-(fixCrossDimPix+2) fixCrossDimPix -fixCrossDimPix -fixCrossDimPix];
yCoords = [-fixCrossDimPix -fixCrossDimPix -fixCrossDimPix fixCrossDimPix+2];
elseif objecttype == 1
xCoords = [-fixCrossDimPix fixCrossDimPix+2 -fixCrossDimPix -fixCrossDimPix];
yCoords = [fixCrossDimPix fixCrossDimPix -fixCrossDimPix fixCrossDimPix+2];
else
error('Object type not defined!');
end
if objectcolour == 0
objectcolourcode = [0 0 255];
else
objectcolourcode = [255 0 0];
end
xy = [xCoords+mid_coords(1); yCoords+mid_coords(2)];
end