-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
22 lines (19 loc) · 958 Bytes
/
main.py
File metadata and controls
22 lines (19 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from SweepLine.Sweepline import SweepLineHelper
from utils.Point import Point
from utils.Polygon import Polygon
from utils.Plot import plot
import plotly.graph_objects as go
from typing import List, Dict, Tuple
from SweepLine.Sweepline import Position, LatticeConst
polygon1_child1 = Polygon(points=[Point(20, 10), Point(
30, 10), Point(30, 20), Point(20, 20), Point(20, 10)])
polygon1_child2 = Polygon(points=[Point(5, 5), Point(
13, 21), Point(8, 40), Point(5, 5)])
polygon1 = Polygon(points=[Point(0, 0), Point(25, -25), Point(36, 0), Point(40, 30), Point(50, 0),
Point(60, 40), Point(40, 50), Point(37, 66), Point(15, 44), Point(0, 50),
Point(0, 0)], children=[polygon1_child1, polygon1_child2])
if __name__ == "__main__":
Sweepline = SweepLineHelper(resolution_step=LatticeConst.Resolution)
polygon = polygon1
result = Sweepline.sweep_line(polygon)
plot(polygon, result)