-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathss.py
69 lines (57 loc) · 1.53 KB
/
ss.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from __future__ import division
import sys
from classes import *
from utils import *
#### SPIRALLING:
# polygon = [(-10, -10),
# (-60,-60),
# (0, -120),
# (10, -10),
# (60,-60),
# (120,0),
# (10,10),
# (60,60),
# (0,120),
# (-10,10),
# (-60,60),
# (-120,0)]
# polygon = [
# (0, 100),
# (0,0),
# (100, 0),
# (100, 100),
# ]
if __name__=="__main__":
# polygon = [
# (-102,-10),
# # (-20,0),
# (2,23),
# (30,20),
# (50,0),
# (100,0),
# (100,100),
# (-100,100),
# ]
polygon = [[140, 311.7691453623979], [180, 311.7691453623979],
[200, 277.12812921102034], [240, 277.12812921102034],
[260, 311.7691453623979], [300, 311.7691453623979],
[280, 277.12812921102034], [320, 277.12812921102034],
[340, 242.4871130596428], [380, 242.4871130596428],
[360, 207.84609690826525], [320, 207.84609690826525],
[300, 242.4871130596428], [260, 173.20508075688772],
[180, 173.20508075688772], [120, 277.12812921102034],
[160, 277.12812921102034]]
# polygon = [[140, 311.7691453623979], [180, 311.7691453623979],
# [200, 277.12812921102034], [240, 277.12812921102034],
# [260, 311.7691453623979], [300, 311.7691453623979],
# [280, 277.12812921102034], [320, 277.12812921102034],
# [220, 20.20508075688772], [120, 277.12812921102034],
# [160, 277.12812921102034]]
s= SS()
r=s.create(polygon)
if r==None:
print "error during creating straight skeleton"
sys.exit()
s.create_creases()
# LINES = clip_lines(LINES, (minX,maxX, minY,maxY))
s.drawit(medium="png")