Skip to content

Commit

Permalink
Create plotter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
TroddenSpade committed Nov 24, 2022
1 parent 642b1d1 commit d779665
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions plotter/plotter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import turtle
import numpy as np


def plotter(h, w, points):
s = turtle.Screen()
turtle.screensize(canvwidth=w, canvheight=h, bg=None)
t = turtle.Turtle()

max_y = points[:,:,1].max()
min_y = points[:,:,1].min()
max_x = points[:,:,0].max()
min_x = points[:,:,0].min()

points -= np.array([(min_x+max_x)/2, (min_y+max_y)/2]).reshape(1,1,2)

for p in points:
p0, p1 = p
t.penup()
t.goto(p0)
t.pendown()
t.goto(p1)

turtle.done()

0 comments on commit d779665

Please sign in to comment.