Skip to content

Commit

Permalink
update plot script for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
bast committed Oct 19, 2024
1 parent 700f25d commit 8631a2d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
27 changes: 21 additions & 6 deletions tests/plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,28 @@ def main(polygons_file, figure):

num_edges_children = 4
num_nodes_children = 4
tree = polygons.build_tree(ps, num_edges_children, num_nodes_children)
tree = polygons.build_search_tree(ps, num_edges_children, num_nodes_children)

points = []

# num_points = 50000
# points = [
# (random.uniform(xmin, xmax), random.uniform(ymin, ymax))
# for _ in range(num_points)
# ]

# add random points which have the same y-coordinate as the vertices of the polygons
for polygon in ps:
for _, y in polygon:
for _x in range(500):
points.append((random.uniform(xmin, xmax), y))

# add more random points
for _y in range(20):
y = random.uniform(ymin, ymax)
for _x in range(500):
points.append((random.uniform(xmin, xmax), y))

num_points = 50000
points = [
(random.uniform(xmin, xmax), random.uniform(ymin, ymax))
for _ in range(num_points)
]
inside = polygons.points_are_inside(tree, points)

xs_inside = []
Expand Down
1 change: 0 additions & 1 deletion tests/plot/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
matplotlib
black
click
2 changes: 1 addition & 1 deletion tests/plot/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

python plot.py --polygons-file ../case-1/islands.txt --figure example.png
python plot.py --polygons-file ../case-2/boundary.txt --figure example.png

0 comments on commit 8631a2d

Please sign in to comment.