summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon/others/triangle_robot/doc/triangle.plot
blob: 8a104b9b1c9d66f13fe03547d2db6b93bf05f70d (plain)
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
74
75
76
77
78
79
80
set angles degrees
set xrange [0:3000]
set yrange [0:2100]
dist (x0, y0, x1, y1) = sqrt ((x0 - x1) ** 2 + (y0 - y1) ** 2)
dot (x0, y0, x1, y1) = x0 * x1 + y0 * y1
anglea (x, y, x0, y0, x1, y1) = acos (dot (x0 - x, y0 - y, x1 - x, y1 - y) / (dist (x, y, x0, y0) * dist (x, y, x1, y1)))
angle (x, y, x0, y0, x1, y1) = ((x0 - x) * (y1 - y) - (x1 - x) * (y0 - y) > 0 ? anglea (x, y, x0, y0, x1, y1) : 360 - anglea (x, y, x0, y0, x1, y1))
angle_b12 (x, y) = angle (x, y, 3000, 0, 3000, 2100)
angle_b23 (x, y) = angle (x, y, 3000, 0, 0, 1050)
angle_b31 (x, y) = angle (x, y, 3000, 2100, 0, 1050)

t1 = angle (3000, 0, 3000, 2100, 0, 1050)
t2 = angle (3000, 2100, 0, 1050, 3000, 0)
t3 = angle (0, 1050, 3000, 0, 3000, 2100)
b1 = dist (3000, 0, 3000, 2100)
b2 = dist (3000, 2100, 0, 1050)
b3 = dist (0, 1050, 3000, 0)

solve_angle (a1, a3) = atan ((-b1 + b3 * sin (a3 + t2) / sin (a3)) / (b1 * cos (a1) / sin (a1) + b3 * cos (a3 + t1) / sin (a3)))

set isosamples 50
set contour
set cntrparam levels incremental 0, 10, 360

set term png
set output 'triangle_surf12.png'
splot angle_b12 (x, y)
set output 'triangle_surf23.png'
splot angle_b23 (x, y)
set output 'triangle_surf31.png'
splot angle_b31 (x, y)

set contour
set cntrparam levels incremental 0, 1, 360
unset surface
set view map
unset clabel

set output 'triangle_contour12.png'
splot angle_b12 (x, y)
set output 'triangle_contour23.png'
splot angle_b23 (x, y)
set output 'triangle_contour31.png'
splot angle_b31 (x, y)
set output 'triangle_contour123.png'
splot angle_b12 (x, y), angle_b23 (x, y), angle_b31 (x, y)
set cntrparam levels incremental 0, 3, 360
set output 'triangle_contour123-3deg.png'
splot angle_b12 (x, y), angle_b23 (x, y), angle_b31 (x, y)
set cntrparam levels incremental 0, 1, 360

set size square
set xrange [0:100]
set yrange [0:100]
set output 'triangle_zoom+0+0.png'
splot angle_b12 (x, y), angle_b23 (x, y), angle_b31 (x, y)
set xrange [0:100]
set yrange [1000:1100]
set output 'triangle_zoom+0+1050.png'
splot angle_b12 (x, y), angle_b23 (x, y), angle_b31 (x, y)
set xrange [2900:3000]
set yrange [2000:2100]
set output 'triangle_zoom+3000+2100.png'
splot angle_b12 (x, y), angle_b23 (x, y), angle_b31 (x, y)
set xrange [1450:1550]
set yrange [1000:1100]
set output 'triangle_zoom+1500+1050.png'
splot angle_b12 (x, y), angle_b23 (x, y), angle_b31 (x, y)

reset
set xrange [0:3000]
set yrange [0:2100]
set isosamples 50
set angles degrees
set contour
set cntrparam levels incremental 0, 5, 360

set term png
set output 'triangle_solve_angle.png'
splot solve_angle (angle_b12 (x, y), angle_b31 (x, y))