summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/2geom/src/python/test_py2geom.py
blob: 2ad6e662526258ced23c3fc8f7883b950120681a (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
#!/usr/bin/python

import py2geom as g

a = g.Point(1,2)
b = g.Point(31,2)
print a, b

point_fns_1 = ["L1", "L2", "L2sq", "LInfty", "is_zero", "is_unit_vector",
             "atan2", "rot90", 
             "unit_vector", "abs"]
point_fns_2 = ["dot", "angle_between", "distance", "distanceSq", "cross"]

for i in point_fns_1:
    print "%s:" % i, g.__dict__[i](a)
for i in point_fns_2:
    print "%s:" % i, g.__dict__[i](a,b)
print "a == b", a == b
print "Lerp:", g.lerp(0.3, a,b)

bo = g.BezOrd(2,3)
print bo
print bo.point_at(0.3)

print bo.reverse()

sn = g.sin(g.BezOrd(0.0,8.0),5)
print sn
print g.inverse(sn,10)
print list(sn)

r_sn = g.roots(sn)
print len(r_sn)
print list(r_sn)

bo = g.BezOrd(-1,1)
sb = g.SBasis()
print sb
print list(g.roots(sb))
sb.append(bo)
print list(g.roots(sb))