summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/2geom/src/toys/ray_test.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/2geom/src/toys/ray_test.py')
-rw-r--r--src/3rdparty/2geom/src/toys/ray_test.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/3rdparty/2geom/src/toys/ray_test.py b/src/3rdparty/2geom/src/toys/ray_test.py
new file mode 100644
index 0000000..6ec8b01
--- /dev/null
+++ b/src/3rdparty/2geom/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))
+