summaryrefslogtreecommitdiff
path: root/digital/beacon/triangle/doc/triangle.plot
diff options
context:
space:
mode:
authorNicolas Schodet2009-07-25 22:02:06 +0200
committerNicolas Schodet2009-07-25 22:02:06 +0200
commit0d0bbce3970dfbae8de52f019d61184e053903e5 (patch)
tree4bd07806dfc399ad9bf5388f8101c9be575ddc3c /digital/beacon/triangle/doc/triangle.plot
parent3cb217502b454c6ff35dbd904967887ef00cc247 (diff)
* digital/beacon/triangle/doc (re #73):
- added angle solving.
Diffstat (limited to 'digital/beacon/triangle/doc/triangle.plot')
-rw-r--r--digital/beacon/triangle/doc/triangle.plot36
1 files changed, 29 insertions, 7 deletions
diff --git a/digital/beacon/triangle/doc/triangle.plot b/digital/beacon/triangle/doc/triangle.plot
index 2248aa08..8a104b9b 100644
--- a/digital/beacon/triangle/doc/triangle.plot
+++ b/digital/beacon/triangle/doc/triangle.plot
@@ -1,16 +1,26 @@
+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
-angle (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_b12 (x, y) = angle (x, y, 3000.0, 0.0, 3000.0, 2100.0)
+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 angles degrees
set contour
-set cntrparam levels incremental 0, 10, 180
+set cntrparam levels incremental 0, 10, 360
set term png
set output 'triangle_surf12.png'
@@ -21,7 +31,7 @@ set output 'triangle_surf31.png'
splot angle_b31 (x, y)
set contour
-set cntrparam levels incremental 0, 1, 180
+set cntrparam levels incremental 0, 1, 360
unset surface
set view map
unset clabel
@@ -34,10 +44,10 @@ 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, 180
+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, 180
+set cntrparam levels incremental 0, 1, 360
set size square
set xrange [0:100]
@@ -56,3 +66,15 @@ 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))