-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestme.py
51 lines (42 loc) · 1.1 KB
/
testme.py
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
42
43
44
45
46
47
48
49
50
51
import pypolypart
print dir(pypolypart)
for i in range(3):
print dir(pypolypart)[i]
print dir(getattr(pypolypart,dir(pypolypart)[i]))
print "\n testing points"
a = pypolypart.Point()
print a
a.x=5
a.y=5
print a
b = pypolypart.Point()
b.x=3
b.y=6
print b
#print b
#print "a.x"
#print a.x
#print a.p
#print "a+b"
#print a+b
print "\ntesting poly"
c=pypolypart.Poly()
#c.Init(3)
poly1 = [(0,0),(10,0), (9,5), (10,10),(0,10)]
c.setPoints(poly1,False)
print "pointnum=",c.pnum
print "points=",c.getPoints()
#c[0]=a
print "\n testing partitions"
pp=pypolypart.Partition()
print "made partition object:", pp
print "triangles", pp.Triangulate_EC(c)
print "hulls", pp.ConvexPartition_HM(c)
print "\n combi triangles and hulls method, single poly"
print pypolypart.polys_to_tris_and_hulls([poly1])
print "\n combi triangles and hulls method, two polys"
poly2 = [(99+0,0),(99+10,0), (99+9,5), (99+10,10),(99+0,10)]
print pypolypart.polys_to_tris_and_hulls([poly1, poly2])
print "\n combi triangles and hulls method, poly with hole"
hole1 = [(1,1),(1,3), (3,1)]
print pypolypart.polys_to_tris_and_hulls([poly1], [hole1])