summaryrefslogtreecommitdiffstats
path: root/src/toys/ray_test.py
blob: 6ec8b0130f3c85947bbd5ade0c8704535c7d09ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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))