Skip to content

Commit

Permalink
Merge branch 'master' of github.com:evildmp/BrachioGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
evildmp committed Oct 20, 2019
2 parents a7df562 + 6782a58 commit dfe3a86
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions brachiograph.py
Expand Up @@ -219,10 +219,23 @@ def plot_lines(self, lines=[], wait=.1, interpolate=10, rotate=False, flip=False
self.quiet()


def draw_line(self, start=(0, 0), end=(0, 0), wait=.5, interpolate=10):
start_x, start_y = start
end_x, end_y = end

self.pen.up()
self.xy(x=start_x, y=start_y, wait=wait, interpolate=interpolate)

self.pen.down()
self.draw(x=end_x, y=end_y, wait=wait, interpolate=interpolate)


def draw(self, x=0, y=0, wait=.5, interpolate=10):
self.xy(x=x, y=y, wait=wait, interpolate=interpolate, draw=True)


# ----------------- test pattern methods -----------------

def test_pattern(self, bounds=None, wait=1, interpolate=10, repeat=1):

bounds = bounds or self.bounds
Expand All @@ -240,7 +253,25 @@ def test_pattern(self, bounds=None, wait=1, interpolate=10, repeat=1):
self.draw(bounds[0], y + 1, wait, interpolate)

self.pen.up()
self.quiet()


def vertical_lines(self, bounds=None, lines=25, wait=1, interpolate=10, repeat=1):

bounds = bounds or self.bounds

if not bounds:
return "Plotting a test pattern is only possible when BrachioGraph.bounds is set."

top_y = self.bounds[1]
bottom_y = self.bounds[3]
step = (self.bounds[2] - self.bounds[0]) / lines
x = self.bounds[0]
while x <= self.bounds[2]:
self.draw_line((x, top_y), (x, bottom_y))
x = x + step

self.pen.up()
self.quiet()


Expand Down

0 comments on commit dfe3a86

Please sign in to comment.