Skip to content

Commit 5e0c70e

Browse files
authoredJan 18, 2019
Update ttbview.py
Added diamond pattern generator.
1 parent 06ab544 commit 5e0c70e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎ttb/ttbview.py

+15
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,18 @@ def make_hatch():
208208
this_line = get_line2p(x, y, 0.5, 0.0, x-.1, y+.1)
209209
hatch.append(this_line)
210210
return hatch
211+
212+
def make_diamonds(loose=True):
213+
step = 0.2 if loose else 0.1
214+
diamonds = []
215+
for x in np.arange(-1.0, 1.0, .1):
216+
for y in np.arange(-1.0, 1.0, step):
217+
this_line = get_line2p(x-.05, y, 0.5, 0.0, x, y+.1)
218+
diamonds.append(this_line)
219+
this_line = get_line2p(x+.05, y, 0.5, 0.0, x, y+.1)
220+
diamonds.append(this_line)
221+
this_line = get_line2p(x-.05, y, 0.5, 0.0, x, y-.1)
222+
diamonds.append(this_line)
223+
this_line = get_line2p(x+.05, y, 0.5, 0.0, x, y-.1)
224+
diamonds.append(this_line)
225+
return diamonds

0 commit comments

Comments
 (0)
Please sign in to comment.