-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlotConField.m
More file actions
69 lines (65 loc) · 1.75 KB
/
Copy pathPlotConField.m
File metadata and controls
69 lines (65 loc) · 1.75 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
67
68
69
function [] = PlotConField(fieldSize)
clf
l = fieldSize(1);
s = fieldSize(2);
u = [-l/2 l/2 %Upper longside
-l/2 l/2 %Lower longside
l/2 l/2 %Right shortside
-l/2 -l/2 %Left shortside
0 0 %Middle line
]';
v = [s/2 s/2 %Upper longside
-s/2 -s/2 %Lower longside
-s/2 s/2 %Right shortside
-s/2 s/2 %Left shortside
-s/2 s/2 %Middle line
]';
line(u,v,'Color','w')
hold on
uPenBox = l/120*[0 16.5
0 5.5
16.5 16.5
0 16.5
5.5 5.5
0 5.5
-2.44 0
-2.44 0
-2.44 -2.44
];
vPenBox = s/90*[40.3/2 40.3/2
18.3/2 18.3/2
-40.3/2 40.3/2
-40.3/2 -40.3/2
18.3/2 -18.3/2
-18.3/2 -18.3/2
7.32 7.32
-7.32 -7.32
-7.32 7.32
]';
uPenBox = uPenBox';
uPenBox = [l/2-uPenBox -l/2+rot90(uPenBox,-2)];
vPenBox = [vPenBox rot90(vPenBox,-2)];
line(uPenBox,vPenBox,'Color','w')
hold on
p = [0 0 %Center point
l/2-11*l/120 0 %Right penalty point
-l/2+11*l/120 0 %Left penalty point
];
plot(p(:,1),p(:,2),'.','Color','w')
hold on
%Arcs and circles
%Order: Center circle, left arc, right arc
theta = acos(5.5/9.5);
a = 9.15*l/120;
b = 9.15*s/90;
t = [linspace(0,2*pi) linspace(-theta,theta) linspace(pi-theta,pi+theta)];
X = a*cos(t);
X = [X(1:100) -l/2+11.5*l/120+X(101:200) l/2-11.5*l/120+X(201:300)];
Y = b*sin(t);
plot(X(1:100),Y(1:100),'w',X(101:200),Y(101:200),'w',...
X(201:300),Y(201:300),'w')
hold on
axis equal
axis(1.15/2*[-l l -s s])
set(gca,'Color','#32CD32')
end