summaryrefslogtreecommitdiffstats
path: root/src/toys/ray_test.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:57:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 11:57:42 +0000
commit61f3ab8f23f4c924d455757bf3e65f8487521b5a (patch)
tree885599a36a308f422af98616bc733a0494fe149a /src/toys/ray_test.py
parentInitial commit. (diff)
downloadlib2geom-61f3ab8f23f4c924d455757bf3e65f8487521b5a.tar.xz
lib2geom-61f3ab8f23f4c924d455757bf3e65f8487521b5a.zip
Adding upstream version 1.3.upstream/1.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/toys/ray_test.py')
-rw-r--r--src/toys/ray_test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/toys/ray_test.py b/src/toys/ray_test.py
new file mode 100644
index 0000000..6ec8b01
--- /dev/null
+++ b/src/toys/ray_test.py
@@ -0,0 +1,20 @@
+# test of 2geom ray bindings
+
+import py2geom as g
+
+# find one point along a ray
+a = g.Point(0,0)
+b = g.Point(2,2)
+
+r = g.Ray(a,b)
+from math import sqrt
+print r.pointAt(sqrt(2))
+
+# measure the angle between two rays
+c = g.Point(2,-2)
+r2 = g.Ray(a,c)
+from math import degrees
+# FIXME: the third argument (clockwise) ought to be optional, but has to be supplied
+print degrees(g.angle_between(r, r2, True))
+print degrees(g.angle_between(r, r2))
+