diff --git a/2018/sketch_180118a/DBN_Letters.pdf b/2018/sketch_180118a/DBN_Letters.pdf index f6ac1fe1..8b49ea43 100644 Binary files a/2018/sketch_180118a/DBN_Letters.pdf and b/2018/sketch_180118a/DBN_Letters.pdf differ diff --git a/2018/sketch_180119a/DBN_Letters.pdf b/2018/sketch_180119a/DBN_Letters.pdf deleted file mode 100644 index 3c2b5152..00000000 Binary files a/2018/sketch_180119a/DBN_Letters.pdf and /dev/null differ diff --git a/2019/sketch_190421a/data/dbnletters.dbn b/2019/sketch_190421a/data/dbnletters.dbn new file mode 100755 index 00000000..ff0cf4d4 --- /dev/null +++ b/2019/sketch_190421a/data/dbnletters.dbn @@ -0,0 +1,341 @@ +// dbnletters +command letterA h v +{ + line h v h (v+7) + line (h) (v+7) (h+3) (v+10) + line (h+3) (v+10) (h+10) (v+3) + line (h+10) (v+3) (h+10) v + line h (v+3) (h+10) (v+3) +} +command letterB h v +{ + line h v h (v+10) + line h (v+10) (h+5) (v+10) + line (h+5) (v+10) (h+8) (v+7) + line h (v+6) (h+7) (v+6) + line (h+7) (v+6) (h+10) (v+3) + line (h+10) (v+3) (h+10) (v+1) + line h v (h+9) v +} +command letterC h v +{ + line (h+4) v (h+10) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+9) (v+10) +} +command letterD h v +{ + line h v h (v+10) + line h v (h+8) v + line (h+8) v (h+10) (v+2) + line (h+10) (v+2) (h+10) (v+6) + line (h+10) (v+6) (h+6) (v+10) + line (h+6) (v+10) h (v+10) +} +command letterE h v +{ + line h (v+3) h (v+10) + line h (v+3) (h+3) v + line (h+3) v (h+10) v + line h (v+6) (h+9) (v+6) + line h (v+10) (h+9) (v+10) +} +command letterF h v +{ + line h v h (v+10) + line h (v+6) (h+8) (v+6) + line h (v+10) (h+10) (v+10) +} +command letterG h v +{ + line (h+4) v (h+9) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+9) (v+10) + line (h+10) (v+1) (h+10) (v+5) + line (h+10) (v+5) (h+6) (v+5) +} +command letterH h v +{ + line h v h (v+10) + line h (v+4) (h+10) (v+4) + line (h+10) v (h+10) (v+10) +} +command letterI h v +{ + line h v (h+10) v + line (h+5) v (h+5) (v+10) + line h (v+10) (h+9) (v+10) +} +command letterJ h v +{ + line h (v+3) (h+3) v + line (h+3) v (h+9) v + line (h+10) (v+1) (h+10) (v+10) +} +command letterK h v +{ + line h v h (v+10) + line h (v+1) (h+9) (v+10) + line (h+5) (v+5) (h+10) v +} +command letterL h v +{ + line h v h (v+10) + line h v (h+10) v +} +command letterM h v +{ + line h v h (v+10) + //line h (v+10) (h+2) (v+10) + line (h+1) (v+10) (h+5) (v+6) + line (h+5) (v+6) (h+9) (v+10) + line (h+10) (v+10) (h+10) v +} +command letterN h v +{ + line h v h (v+10) + line h (v+10) (h+3) (v+10) + line (h+3) (v+10) (h+10) (v+3) + line (h+10) (v+10) (h+10) v +} +command letterO h v +{ + line (h+4) v (h+9) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+7) (h+10) (v+1) +} +command letterP h v +{ + line h v h (v+10) + line h (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+6) (h+8) (v+4) + line h (v+4) (h+8) (v+4) +} +command letterQ h v +{ + line (h+4) v (h+8) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+7) (h+10) (v+2) + line (h+6) (v+4) (h+10) v +} +command letterR h v +{ + line h v h (v+10) + line h (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+6) (h+8) (v+4) + line h (v+4) (h+8) (v+4) + line (h+6) (v+4) (h+10) v +} +command letterS h v +{ + line h (v+2) (h+2) v + line (h+2) v (h+9) v + line (h+10) (v+1) (h+10) (v+4) + line (h+9) (v+5) (h+2) (v+5) + line (h+2) (v+5) h (v+7) + line h (v+7) h (v+9) + line (h+1) (v+10) (h+9) (v+10) + line (h+9) (v+10) (h+10) (v+9) +} +command letterT h v +{ + line h (v+10) (h+10) (v+10) + line (h+5) (v+10) (h+5) v +} +command letterU h v +{ + line h (v+10) h (v+3) + line h (v+3) (h+3) v + line (h+3) v (h+9) v + line (h+10) (v+1) (h+10) (v+10) +} +command letterV h v +{ + line h (v+10) h (v+5) + line h (v+5) (h+5) v + line (h+5) v (h+10) (v+5) + line (h+10) (v+5) (h+10) (v+10) +} +command letterW h v +{ + line h (v+10) h (v+3) + line h (v+3) (h+3) v + line (h+3) v (h+6) (v+3) + line (h+6) (v+3) (h+9) v + line (h+10) (v+1) (h+10) (v+10) +} +command letterX h v +{ + line h (v+10) h (v+9) + line h (v+9) (h+4) (v+5) + line (h+4) (v+5) (h+6) (v+5) + line (h+6) (v+5) (h+10) (v+9) + line (h+10) (v+9) (h+10) (v+10) + line h v h (v+1) + line h (v+1) (h+4) (v+5) + line (h+6) (v+5) (h+10) (v+1) + line (h+10) (v+1) (h+10) v +} +command letterX2 h v // comment out to use the first option +{ + line h v (h+10) (v+10) + line h (v+10) (h+10) v +} + +command letterY h v +{ + line h (v+10) h (v+7) + line h (v+7) (h+3) (v+4) + line (h+3) (v+4) (h+10) (v+4) + line (h+10) (v+10) (h+10) (v+1) + line (h+9) v (h+2) v + line (h+2) v h (v+2) +} +command letterZ h v +{ + line h (v+10) (h+10) (v+10) + line (h+10) (v+10) h v + line h v (h+10) v +} +command letter l h v +{ + same? l 1 + { + letterA h v + } + same? l 2 + { + letterB h v + } + same? l 3 + { + letterC h v + } + same? l 4 + { + letterD h v + } + same? l 5 + { + letterE h v + } + same? l 6 + { + letterF h v + } + same? l 7 + { + letterG h v + } + same? l 8 + { + letterH h v + } + same? l 9 + { + letterI h v + } + same? l 10 + { + letterJ h v + } + same? l 11 + { + letterK h v + } + same? l 12 + { + letterL h v + } + same? l 13 + { + letterM h v + } + same? l 14 + { + letterN h v + } + same? l 15 + { + letterO h v + } + same? l 16 + { + letterP h v + } + same? l 17 + { + letterQ h v + } + same? l 18 + { + letterR h v + } + same? l 19 + { + letterS h v + } + same? l 20 + { + letterT h v + } + same? l 21 + { + letterU h v + } + same? l 22 + { + letterV h v + } + same? l 23 + { + letterW h v + } + same? l 24 + { + letterX h v + } + same? l 25 + { + letterY h v + } + same? l 26 + { + letterZ h v + } +} +command testdbnletters +{ + paper 0 + pen 100 + set x 17 + set y 73 + set dx 12 + set dy 12 + set n 0 + repeat a 1 25 + { + letter a x y + set x (x+dx) + set n (n+1) + same? n 5 + { + set x 17 + set y (y-dy) + set n 0 + } + } + set x (x+dx*5) + letter 26 x y +} + diff --git a/2019/sketch_190421a/data/dbnletters_first_X_option.dbn b/2019/sketch_190421a/data/dbnletters_first_X_option.dbn new file mode 100755 index 00000000..764983ed --- /dev/null +++ b/2019/sketch_190421a/data/dbnletters_first_X_option.dbn @@ -0,0 +1,340 @@ +// dbnletters +command letterA h v +{ + line h v h (v+7) + line (h) (v+7) (h+3) (v+10) + line (h+3) (v+10) (h+10) (v+3) + line (h+10) (v+3) (h+10) v + line h (v+3) (h+10) (v+3) +} +command letterB h v +{ + line h v h (v+10) + line h (v+10) (h+5) (v+10) + line (h+5) (v+10) (h+8) (v+7) + line h (v+6) (h+7) (v+6) + line (h+7) (v+6) (h+10) (v+3) + line (h+10) (v+3) (h+10) (v+1) + line h v (h+9) v +} +command letterC h v +{ + line (h+4) v (h+10) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+9) (v+10) +} +command letterD h v +{ + line h v h (v+10) + line h v (h+8) v + line (h+8) v (h+10) (v+2) + line (h+10) (v+2) (h+10) (v+6) + line (h+10) (v+6) (h+6) (v+10) + line (h+6) (v+10) h (v+10) +} +command letterE h v +{ + line h (v+3) h (v+10) + line h (v+3) (h+3) v + line (h+3) v (h+10) v + line h (v+6) (h+9) (v+6) + line h (v+10) (h+9) (v+10) +} +command letterF h v +{ + line h v h (v+10) + line h (v+6) (h+8) (v+6) + line h (v+10) (h+10) (v+10) +} +command letterG h v +{ + line (h+4) v (h+9) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+9) (v+10) + line (h+10) (v+1) (h+10) (v+5) + line (h+10) (v+5) (h+6) (v+5) +} +command letterH h v +{ + line h v h (v+10) + line h (v+4) (h+10) (v+4) + line (h+10) v (h+10) (v+10) +} +command letterI h v +{ + line h v (h+10) v + line (h+5) v (h+5) (v+10) + line h (v+10) (h+9) (v+10) +} +command letterJ h v +{ + line h (v+3) (h+3) v + line (h+3) v (h+9) v + line (h+10) (v+1) (h+10) (v+10) +} +command letterK h v +{ + line h v h (v+10) + line h (v+1) (h+9) (v+10) + line (h+5) (v+5) (h+10) v +} +command letterL h v +{ + line h v h (v+10) + line h v (h+10) v +} +command letterM h v +{ + line h v h (v+10) + //line h (v+10) (h+2) (v+10) + line (h+1) (v+10) (h+5) (v+6) + line (h+5) (v+6) (h+9) (v+10) + line (h+10) (v+10) (h+10) v +} +command letterN h v +{ + line h v h (v+10) + line h (v+10) (h+3) (v+10) + line (h+3) (v+10) (h+10) (v+3) + line (h+10) (v+10) (h+10) v +} +command letterO h v +{ + line (h+4) v (h+9) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+7) (h+10) (v+1) +} +command letterP h v +{ + line h v h (v+10) + line h (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+6) (h+8) (v+4) + line h (v+4) (h+8) (v+4) +} +command letterQ h v +{ + line (h+4) v (h+8) v + line (h+4) v h (v+4) + line h (v+4) h (v+9) + line (h+1) (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+7) (h+10) (v+2) + line (h+6) (v+4) (h+10) v +} +command letterR h v +{ + line h v h (v+10) + line h (v+10) (h+7) (v+10) + line (h+7) (v+10) (h+10) (v+7) + line (h+10) (v+6) (h+8) (v+4) + line h (v+4) (h+8) (v+4) + line (h+6) (v+4) (h+10) v +} +command letterS h v +{ + line h (v+2) (h+2) v + line (h+2) v (h+9) v + line (h+10) (v+1) (h+10) (v+4) + line (h+9) (v+5) (h+2) (v+5) + line (h+2) (v+5) h (v+7) + line h (v+7) h (v+9) + line (h+1) (v+10) (h+9) (v+10) + line (h+9) (v+10) (h+10) (v+9) +} +command letterT h v +{ + line h (v+10) (h+10) (v+10) + line (h+5) (v+10) (h+5) v +} +command letterU h v +{ + line h (v+10) h (v+3) + line h (v+3) (h+3) v + line (h+3) v (h+9) v + line (h+10) (v+1) (h+10) (v+10) +} +command letterV h v +{ + line h (v+10) h (v+5) + line h (v+5) (h+5) v + line (h+5) v (h+10) (v+5) + line (h+10) (v+5) (h+10) (v+10) +} +command letterW h v +{ + line h (v+10) h (v+3) + line h (v+3) (h+3) v + line (h+3) v (h+6) (v+3) + line (h+6) (v+3) (h+9) v + line (h+10) (v+1) (h+10) (v+10) +} +command letterX h v +{ + line h (v+10) h (v+9) + line h (v+9) (h+4) (v+5) + line (h+4) (v+5) (h+6) (v+5) + line (h+6) (v+5) (h+10) (v+9) + line (h+10) (v+9) (h+10) (v+10) + line h v h (v+1) + line h (v+1) (h+4) (v+5) + line (h+6) (v+5) (h+10) (v+1) + line (h+10) (v+1) (h+10) v +} +//command letterX2 h v // comment out to use the first option +//{ +// line h v (h+10) (v+10) +// line h (v+10) (h+10) v +//} +command letterY h v +{ + line h (v+10) h (v+7) + line h (v+7) (h+3) (v+4) + line (h+3) (v+4) (h+10) (v+4) + line (h+10) (v+10) (h+10) (v+1) + line (h+9) v (h+2) v + line (h+2) v h (v+2) +} +command letterZ h v +{ + line h (v+10) (h+10) (v+10) + line (h+10) (v+10) h v + line h v (h+10) v +} +command letter l h v +{ + same? l 1 + { + letterA h v + } + same? l 2 + { + letterB h v + } + same? l 3 + { + letterC h v + } + same? l 4 + { + letterD h v + } + same? l 5 + { + letterE h v + } + same? l 6 + { + letterF h v + } + same? l 7 + { + letterG h v + } + same? l 8 + { + letterH h v + } + same? l 9 + { + letterI h v + } + same? l 10 + { + letterJ h v + } + same? l 11 + { + letterK h v + } + same? l 12 + { + letterL h v + } + same? l 13 + { + letterM h v + } + same? l 14 + { + letterN h v + } + same? l 15 + { + letterO h v + } + same? l 16 + { + letterP h v + } + same? l 17 + { + letterQ h v + } + same? l 18 + { + letterR h v + } + same? l 19 + { + letterS h v + } + same? l 20 + { + letterT h v + } + same? l 21 + { + letterU h v + } + same? l 22 + { + letterV h v + } + same? l 23 + { + letterW h v + } + same? l 24 + { + letterX h v + } + same? l 25 + { + letterY h v + } + same? l 26 + { + letterZ h v + } +} +command testdbnletters +{ + paper 0 + pen 100 + set x 17 + set y 73 + set dx 12 + set dy 12 + set n 0 + repeat a 1 25 + { + letter a x y + set x (x+dx) + set n (n+1) + same? n 5 + { + set x 17 + set y (y-dy) + set n 0 + } + } + set x (x+dx*5) + letter 26 x y +} + diff --git a/2019/sketch_190421a/dbn_generate_letters.py b/2019/sketch_190421a/dbn_generate_letters.py new file mode 100644 index 00000000..75fa7821 --- /dev/null +++ b/2019/sketch_190421a/dbn_generate_letters.py @@ -0,0 +1,63 @@ +""" +Alexandre B A Villares +https://abav.lugaralgum.com/sketch-a-day + +This script generates dbn_letterss.py + +Converting some of Maeda's Design by Number +dbnletters.dbn code -> Processing +""" + +def convert_dbn_source_letters(file_path): + with open("dbn_letters.py", 'w') as out: + out.write('"""\n') + out.write("Alexandre B A Villares\n") + out.write("https://abav.lugaralgum.com/sketch-a-day\n") + out.write("This code was generated by dbn_generate_letters.py\n") + out.write("Converting some of Maeda's Design by Number\n") + out.write('dbnletters.dbn code -> Processing\n"""\n') + out.write("dbn_letter = {} # Dict of functions\n") + out.write("\n") + with open(file_path, "r") as f: + dbn_source = f.readlines() + inside_block = False + command_name = "" + command_block = [] + for ln in dbn_source: + if ln.count("command"): + command_name = ln[14:15] + elif ln.count("{"): + inside_block = True + elif ln.count("}"): + if command_name in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": + def_dbn_letter(command_block, command_name) + command_block = [] # empty block + inside_block = False + elif inside_block: + command_block.append(ln.lstrip()) + +def def_dbn_letter(dbn_block, key_): + p_block = [] + for dbn_line in dbn_block: + if dbn_line: + # for debug + p_block.append(" if debug_poly: stroke(random(256),200, 200)\n") + p_block.append(" " + dbn_line + .replace("line ", "line(") + .replace(" ", ",") + .replace("//", "#") + .strip() + + ")\n") + with open("dbn_letters.py", 'a') as out: + out.write("# " + key_ + "\n") + out.write("def dbn_letter" + key_ + "(h, v, debug_poly=False):\n") + out.write(" pushMatrix()\n") + out.write(" scale(1, -1)\n") + for py_processing_line in p_block: + out.write(py_processing_line) + out.write(" popMatrix()\n") + out.write("dbn_letter['" + key_ + "'] = dbn_letter" + key_ + "\n") + out.write("dbn_letter[" + str(ord(key_) - 64) + + "] = dbn_letter" + key_ + "\n") + + diff --git a/2019/sketch_190421a/dbn_generate_polys.py b/2019/sketch_190421a/dbn_generate_polys.py new file mode 100644 index 00000000..096d0a43 --- /dev/null +++ b/2019/sketch_190421a/dbn_generate_polys.py @@ -0,0 +1,84 @@ +""" +Alexandre B A Villares +https://abav.lugaralgum.com/sketch-a-day + +This script generates dbn_polys.py + +Converting some of Maeda's Design by Number +dbnletters.dbn code -> Processing +""" + +def convert_dbn_source_polys(file_path): + with open("dbn_polys.py", 'w') as out: + out.write('"""\n') + out.write("Alexandre B A Villares\n") + out.write("https://abav.lugaralgum.com/sketch-a-day\n") + out.write("This code was generated by dbn_generate_polys.py\n") + out.write("Converting some of Maeda's Design by Number\n") + out.write('dbnletters.dbn code -> Processing\n"""\n') + out.write("dbn_p_letter = {} # Dict of functions\n") + out.write("\n") + with open(file_path, "r") as f: + dbn_source = f.readlines() + inside_block = False + command_name = "" + command_block = [] + for ln in dbn_source: + if ln.count("command"): + command_name = ln[14:15] + elif ln.count("{"): + inside_block = True + elif ln.count("}"): + if command_name in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": + def_dbn_p_letter(command_block, command_name) + command_block = [] # empty block + inside_block = False + elif inside_block: + command_block.append(ln.lstrip()) + + +def def_dbn_p_letter(dbn_block, key_): + p_block = [] + + for dbn_line in dbn_block: + if dbn_line: + p_lines =(" " + dbn_line # all this to convert lines() to shapes + .replace("(", "") + .replace(")", "") + .replace("line ", "vertex(") + .replace(" ", ",", 1) + .replace(" ", "$", 1) # token to split line into 2 vertices + .replace(" ", ",") + .replace("$", ")\n vertex(", 1) + .replace("//", "#") + .strip() + + ")") + p_block.append(p_lines.split("\n")[0]) + p_block.append(p_lines.split("\n")[1]) + # for ln in p_block: + # print ln.replace(" ","-") + + with open("dbn_polys.py", 'a') as out: + out.write("# " + key_ + "\n") + out.write("def dbn_p_letter" + key_ + "(h, v, debug_poly=False):\n") + out.write(" pushMatrix()\n") + out.write(" scale(1, -1)\n") + out.write(" if debug_poly: stroke(random(256),200, 200)\n") # for debug + out.write(" beginShape()\n") + v_count = 0 + for i, line_ in enumerate(p_block): + if line_ != p_block[i-1]: # and line_ != p_block[i-2]: # if repeated + out.write(line_ + "\n") + v_count += 1 + else: out.write(" # " + line_.lstrip() + "\n") + if i % 2 and i < len(p_block)-2: # if on odd lines, next doesn't repeat + if line_ != p_block[i+1]: + #out.write(" #---\n") + out.write(" endShape()\n") + out.write(" if debug_poly: stroke(random(256),200, 200)\n") # for debug + out.write(" beginShape()\n") + out.write(" endShape()\n") + out.write(" popMatrix()\n") + out.write("dbn_p_letter['" + key_ + "'] = dbn_p_letter" + key_ + "\n") + out.write("dbn_p_letter[" + str(ord(key_) - 64) + + "] = dbn_p_letter" + key_ + "\n") diff --git a/2019/sketch_190421a/dbn_letters.py b/2019/sketch_190421a/dbn_letters.py new file mode 100644 index 00000000..77aed490 --- /dev/null +++ b/2019/sketch_190421a/dbn_letters.py @@ -0,0 +1,450 @@ +""" +Alexandre B A Villares +https://abav.lugaralgum.com/sketch-a-day +This code was generated by dbn_generate_letters.py +Converting some of Maeda's Design by Number +dbnletters.dbn code -> Processing +""" +dbn_letter = {} # Dict of functions + +# A +def dbn_letterA(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+7)) + if debug_poly: stroke(random(256),200, 200) + line((h),(v+7),(h+3),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+3),(v+10),(h+10),(v+3)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+3),(h+10),v) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+3),(h+10),(v+3)) + popMatrix() +dbn_letter['A'] = dbn_letterA +dbn_letter[1] = dbn_letterA +# B +def dbn_letterB(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+5),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+5),(v+10),(h+8),(v+7)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+6),(h+7),(v+6)) + if debug_poly: stroke(random(256),200, 200) + line((h+7),(v+6),(h+10),(v+3)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+3),(h+10),(v+1)) + if debug_poly: stroke(random(256),200, 200) + line(h,v,(h+9),v) + popMatrix() +dbn_letter['B'] = dbn_letterB +dbn_letter[2] = dbn_letterB +# C +def dbn_letterC(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,(h+10),v) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,h,(v+4)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),h,(v+9)) + if debug_poly: stroke(random(256),200, 200) + line((h+1),(v+10),(h+9),(v+10)) + popMatrix() +dbn_letter['C'] = dbn_letterC +dbn_letter[3] = dbn_letterC +# D +def dbn_letterD(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,v,(h+8),v) + if debug_poly: stroke(random(256),200, 200) + line((h+8),v,(h+10),(v+2)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+2),(h+10),(v+6)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+6),(h+6),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+6),(v+10),h,(v+10)) + popMatrix() +dbn_letter['D'] = dbn_letterD +dbn_letter[4] = dbn_letterD +# E +def dbn_letterE(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+3),h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+3),(h+3),v) + if debug_poly: stroke(random(256),200, 200) + line((h+3),v,(h+10),v) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+6),(h+9),(v+6)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+9),(v+10)) + popMatrix() +dbn_letter['E'] = dbn_letterE +dbn_letter[5] = dbn_letterE +# F +def dbn_letterF(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+6),(h+8),(v+6)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+10),(v+10)) + popMatrix() +dbn_letter['F'] = dbn_letterF +dbn_letter[6] = dbn_letterF +# G +def dbn_letterG(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,(h+9),v) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,h,(v+4)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),h,(v+9)) + if debug_poly: stroke(random(256),200, 200) + line((h+1),(v+10),(h+9),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+1),(h+10),(v+5)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+5),(h+6),(v+5)) + popMatrix() +dbn_letter['G'] = dbn_letterG +dbn_letter[7] = dbn_letterG +# H +def dbn_letterH(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),(h+10),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),v,(h+10),(v+10)) + popMatrix() +dbn_letter['H'] = dbn_letterH +dbn_letter[8] = dbn_letterH +# I +def dbn_letterI(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,(h+10),v) + if debug_poly: stroke(random(256),200, 200) + line((h+5),v,(h+5),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+9),(v+10)) + popMatrix() +dbn_letter['I'] = dbn_letterI +dbn_letter[9] = dbn_letterI +# J +def dbn_letterJ(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+3),(h+3),v) + if debug_poly: stroke(random(256),200, 200) + line((h+3),v,(h+9),v) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+1),(h+10),(v+10)) + popMatrix() +dbn_letter['J'] = dbn_letterJ +dbn_letter[10] = dbn_letterJ +# K +def dbn_letterK(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+1),(h+9),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+5),(v+5),(h+10),v) + popMatrix() +dbn_letter['K'] = dbn_letterK +dbn_letter[11] = dbn_letterK +# L +def dbn_letterL(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,v,(h+10),v) + popMatrix() +dbn_letter['L'] = dbn_letterL +dbn_letter[12] = dbn_letterL +# M +def dbn_letterM(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + #line(h,(v+10),(h+2),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+1),(v+10),(h+5),(v+6)) + if debug_poly: stroke(random(256),200, 200) + line((h+5),(v+6),(h+9),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+10),(h+10),v) + popMatrix() +dbn_letter['M'] = dbn_letterM +dbn_letter[13] = dbn_letterM +# N +def dbn_letterN(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+3),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+3),(v+10),(h+10),(v+3)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+10),(h+10),v) + popMatrix() +dbn_letter['N'] = dbn_letterN +dbn_letter[14] = dbn_letterN +# O +def dbn_letterO(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,(h+9),v) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,h,(v+4)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),h,(v+9)) + if debug_poly: stroke(random(256),200, 200) + line((h+1),(v+10),(h+7),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+7),(v+10),(h+10),(v+7)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+7),(h+10),(v+1)) + popMatrix() +dbn_letter['O'] = dbn_letterO +dbn_letter[15] = dbn_letterO +# P +def dbn_letterP(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+7),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+7),(v+10),(h+10),(v+7)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+6),(h+8),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),(h+8),(v+4)) + popMatrix() +dbn_letter['P'] = dbn_letterP +dbn_letter[16] = dbn_letterP +# Q +def dbn_letterQ(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,(h+8),v) + if debug_poly: stroke(random(256),200, 200) + line((h+4),v,h,(v+4)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),h,(v+9)) + if debug_poly: stroke(random(256),200, 200) + line((h+1),(v+10),(h+7),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+7),(v+10),(h+10),(v+7)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+7),(h+10),(v+2)) + if debug_poly: stroke(random(256),200, 200) + line((h+6),(v+4),(h+10),v) + popMatrix() +dbn_letter['Q'] = dbn_letterQ +dbn_letter[17] = dbn_letterQ +# R +def dbn_letterR(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+7),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+7),(v+10),(h+10),(v+7)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+6),(h+8),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+4),(h+8),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line((h+6),(v+4),(h+10),v) + popMatrix() +dbn_letter['R'] = dbn_letterR +dbn_letter[18] = dbn_letterR +# S +def dbn_letterS(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+2),(h+2),v) + if debug_poly: stroke(random(256),200, 200) + line((h+2),v,(h+9),v) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+1),(h+10),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line((h+9),(v+5),(h+2),(v+5)) + if debug_poly: stroke(random(256),200, 200) + line((h+2),(v+5),h,(v+7)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+7),h,(v+9)) + if debug_poly: stroke(random(256),200, 200) + line((h+1),(v+10),(h+9),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+9),(v+10),(h+10),(v+9)) + popMatrix() +dbn_letter['S'] = dbn_letterS +dbn_letter[19] = dbn_letterS +# T +def dbn_letterT(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+10),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+5),(v+10),(h+5),v) + popMatrix() +dbn_letter['T'] = dbn_letterT +dbn_letter[20] = dbn_letterT +# U +def dbn_letterU(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),h,(v+3)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+3),(h+3),v) + if debug_poly: stroke(random(256),200, 200) + line((h+3),v,(h+9),v) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+1),(h+10),(v+10)) + popMatrix() +dbn_letter['U'] = dbn_letterU +dbn_letter[21] = dbn_letterU +# V +def dbn_letterV(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),h,(v+5)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+5),(h+5),v) + if debug_poly: stroke(random(256),200, 200) + line((h+5),v,(h+10),(v+5)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+5),(h+10),(v+10)) + popMatrix() +dbn_letter['V'] = dbn_letterV +dbn_letter[22] = dbn_letterV +# W +def dbn_letterW(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),h,(v+3)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+3),(h+3),v) + if debug_poly: stroke(random(256),200, 200) + line((h+3),v,(h+6),(v+3)) + if debug_poly: stroke(random(256),200, 200) + line((h+6),(v+3),(h+9),v) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+1),(h+10),(v+10)) + popMatrix() +dbn_letter['W'] = dbn_letterW +dbn_letter[23] = dbn_letterW +# X +def dbn_letterX(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),h,(v+9)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+9),(h+4),(v+5)) + if debug_poly: stroke(random(256),200, 200) + line((h+4),(v+5),(h+6),(v+5)) + if debug_poly: stroke(random(256),200, 200) + line((h+6),(v+5),(h+10),(v+9)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+9),(h+10),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,v,h,(v+1)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+1),(h+4),(v+5)) + if debug_poly: stroke(random(256),200, 200) + line((h+6),(v+5),(h+10),(v+1)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+1),(h+10),v) + popMatrix() +dbn_letter['X'] = dbn_letterX +dbn_letter[24] = dbn_letterX +# X +def dbn_letterX(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,v,(h+10),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+10),v) + popMatrix() +dbn_letter['X'] = dbn_letterX +dbn_letter[24] = dbn_letterX +# Y +def dbn_letterY(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),h,(v+7)) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+7),(h+3),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line((h+3),(v+4),(h+10),(v+4)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+10),(h+10),(v+1)) + if debug_poly: stroke(random(256),200, 200) + line((h+9),v,(h+2),v) + if debug_poly: stroke(random(256),200, 200) + line((h+2),v,h,(v+2)) + popMatrix() +dbn_letter['Y'] = dbn_letterY +dbn_letter[25] = dbn_letterY +# Z +def dbn_letterZ(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + line(h,(v+10),(h+10),(v+10)) + if debug_poly: stroke(random(256),200, 200) + line((h+10),(v+10),h,v) + if debug_poly: stroke(random(256),200, 200) + line(h,v,(h+10),v) + popMatrix() +dbn_letter['Z'] = dbn_letterZ +dbn_letter[26] = dbn_letterZ diff --git a/2019/sketch_190421a/dbn_polys.py b/2019/sketch_190421a/dbn_polys.py new file mode 100644 index 00000000..1bf9a87e --- /dev/null +++ b/2019/sketch_190421a/dbn_polys.py @@ -0,0 +1,672 @@ +""" +Alexandre B A Villares +https://abav.lugaralgum.com/sketch-a-day +This code was generated by dbn_generate_polys.py +Converting some of Maeda's Design by Number +dbnletters.dbn code -> Processing +""" +dbn_p_letter = {} # Dict of functions + +# A +def dbn_p_letterA(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+7) + # vertex(h,v+7) + vertex(h+3,v+10) + # vertex(h+3,v+10) + vertex(h+10,v+3) + # vertex(h+10,v+3) + vertex(h+10,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+3) + vertex(h+10,v+3) + endShape() + popMatrix() +dbn_p_letter['A'] = dbn_p_letterA +dbn_p_letter[1] = dbn_p_letterA +# B +def dbn_p_letterB(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + # vertex(h,v+10) + vertex(h+5,v+10) + # vertex(h+5,v+10) + vertex(h+8,v+7) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+6) + vertex(h+7,v+6) + # vertex(h+7,v+6) + vertex(h+10,v+3) + # vertex(h+10,v+3) + vertex(h+10,v+1) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h+9,v) + endShape() + popMatrix() +dbn_p_letter['B'] = dbn_p_letterB +dbn_p_letter[2] = dbn_p_letterB +# C +def dbn_p_letterC(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h+10,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h,v+4) + # vertex(h,v+4) + vertex(h,v+9) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+1,v+10) + vertex(h+9,v+10) + endShape() + popMatrix() +dbn_p_letter['C'] = dbn_p_letterC +dbn_p_letter[3] = dbn_p_letterC +# D +def dbn_p_letterD(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h+8,v) + # vertex(h+8,v) + vertex(h+10,v+2) + # vertex(h+10,v+2) + vertex(h+10,v+6) + # vertex(h+10,v+6) + vertex(h+6,v+10) + # vertex(h+6,v+10) + vertex(h,v+10) + endShape() + popMatrix() +dbn_p_letter['D'] = dbn_p_letterD +dbn_p_letter[4] = dbn_p_letterD +# E +def dbn_p_letterE(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+3) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+3) + vertex(h+3,v) + # vertex(h+3,v) + vertex(h+10,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+6) + vertex(h+9,v+6) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h+9,v+10) + endShape() + popMatrix() +dbn_p_letter['E'] = dbn_p_letterE +dbn_p_letter[5] = dbn_p_letterE +# F +def dbn_p_letterF(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+6) + vertex(h+8,v+6) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h+10,v+10) + endShape() + popMatrix() +dbn_p_letter['F'] = dbn_p_letterF +dbn_p_letter[6] = dbn_p_letterF +# G +def dbn_p_letterG(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h+9,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h,v+4) + # vertex(h,v+4) + vertex(h,v+9) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+1,v+10) + vertex(h+9,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+1) + vertex(h+10,v+5) + # vertex(h+10,v+5) + vertex(h+6,v+5) + endShape() + popMatrix() +dbn_p_letter['G'] = dbn_p_letterG +dbn_p_letter[7] = dbn_p_letterG +# H +def dbn_p_letterH(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+4) + vertex(h+10,v+4) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v) + vertex(h+10,v+10) + endShape() + popMatrix() +dbn_p_letter['H'] = dbn_p_letterH +dbn_p_letter[8] = dbn_p_letterH +# I +def dbn_p_letterI(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h+10,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+5,v) + vertex(h+5,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h+9,v+10) + endShape() + popMatrix() +dbn_p_letter['I'] = dbn_p_letterI +dbn_p_letter[9] = dbn_p_letterI +# J +def dbn_p_letterJ(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+3) + vertex(h+3,v) + # vertex(h+3,v) + vertex(h+9,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+1) + vertex(h+10,v+10) + endShape() + popMatrix() +dbn_p_letter['J'] = dbn_p_letterJ +dbn_p_letter[10] = dbn_p_letterJ +# K +def dbn_p_letterK(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+1) + vertex(h+9,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+5,v+5) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['K'] = dbn_p_letterK +dbn_p_letter[11] = dbn_p_letterK +# L +def dbn_p_letterL(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['L'] = dbn_p_letterL +dbn_p_letter[12] = dbn_p_letterL +# M +def dbn_p_letterM(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + #vertex(h,v+10) + vertex(h+2,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+1,v+10) + vertex(h+5,v+6) + # vertex(h+5,v+6) + vertex(h+9,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+10) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['M'] = dbn_p_letterM +dbn_p_letter[13] = dbn_p_letterM +# N +def dbn_p_letterN(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + # vertex(h,v+10) + vertex(h+3,v+10) + # vertex(h+3,v+10) + vertex(h+10,v+3) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+10) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['N'] = dbn_p_letterN +dbn_p_letter[14] = dbn_p_letterN +# O +def dbn_p_letterO(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h+9,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h,v+4) + # vertex(h,v+4) + vertex(h,v+9) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+1,v+10) + vertex(h+7,v+10) + # vertex(h+7,v+10) + vertex(h+10,v+7) + # vertex(h+10,v+7) + vertex(h+10,v+1) + endShape() + popMatrix() +dbn_p_letter['O'] = dbn_p_letterO +dbn_p_letter[15] = dbn_p_letterO +# P +def dbn_p_letterP(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + # vertex(h,v+10) + vertex(h+7,v+10) + # vertex(h+7,v+10) + vertex(h+10,v+7) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+6) + vertex(h+8,v+4) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+4) + vertex(h+8,v+4) + endShape() + popMatrix() +dbn_p_letter['P'] = dbn_p_letterP +dbn_p_letter[16] = dbn_p_letterP +# Q +def dbn_p_letterQ(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h+8,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+4,v) + vertex(h,v+4) + # vertex(h,v+4) + vertex(h,v+9) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+1,v+10) + vertex(h+7,v+10) + # vertex(h+7,v+10) + vertex(h+10,v+7) + # vertex(h+10,v+7) + vertex(h+10,v+2) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+6,v+4) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['Q'] = dbn_p_letterQ +dbn_p_letter[17] = dbn_p_letterQ +# R +def dbn_p_letterR(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+10) + # vertex(h,v+10) + vertex(h+7,v+10) + # vertex(h+7,v+10) + vertex(h+10,v+7) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+6) + vertex(h+8,v+4) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+4) + vertex(h+8,v+4) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+6,v+4) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['R'] = dbn_p_letterR +dbn_p_letter[18] = dbn_p_letterR +# S +def dbn_p_letterS(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+2) + vertex(h+2,v) + # vertex(h+2,v) + vertex(h+9,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+1) + vertex(h+10,v+4) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+9,v+5) + vertex(h+2,v+5) + # vertex(h+2,v+5) + vertex(h,v+7) + # vertex(h,v+7) + vertex(h,v+9) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+1,v+10) + vertex(h+9,v+10) + # vertex(h+9,v+10) + vertex(h+10,v+9) + endShape() + popMatrix() +dbn_p_letter['S'] = dbn_p_letterS +dbn_p_letter[19] = dbn_p_letterS +# T +def dbn_p_letterT(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h+10,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+5,v+10) + vertex(h+5,v) + endShape() + popMatrix() +dbn_p_letter['T'] = dbn_p_letterT +dbn_p_letter[20] = dbn_p_letterT +# U +def dbn_p_letterU(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h,v+3) + # vertex(h,v+3) + vertex(h+3,v) + # vertex(h+3,v) + vertex(h+9,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+1) + vertex(h+10,v+10) + endShape() + popMatrix() +dbn_p_letter['U'] = dbn_p_letterU +dbn_p_letter[21] = dbn_p_letterU +# V +def dbn_p_letterV(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h,v+5) + # vertex(h,v+5) + vertex(h+5,v) + # vertex(h+5,v) + vertex(h+10,v+5) + # vertex(h+10,v+5) + vertex(h+10,v+10) + endShape() + popMatrix() +dbn_p_letter['V'] = dbn_p_letterV +dbn_p_letter[22] = dbn_p_letterV +# W +def dbn_p_letterW(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h,v+3) + # vertex(h,v+3) + vertex(h+3,v) + # vertex(h+3,v) + vertex(h+6,v+3) + # vertex(h+6,v+3) + vertex(h+9,v) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+1) + vertex(h+10,v+10) + endShape() + popMatrix() +dbn_p_letter['W'] = dbn_p_letterW +dbn_p_letter[23] = dbn_p_letterW +# X +def dbn_p_letterX(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h,v+9) + # vertex(h,v+9) + vertex(h+4,v+5) + # vertex(h+4,v+5) + vertex(h+6,v+5) + # vertex(h+6,v+5) + vertex(h+10,v+9) + # vertex(h+10,v+9) + vertex(h+10,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h,v+1) + # vertex(h,v+1) + vertex(h+4,v+5) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+6,v+5) + vertex(h+10,v+1) + # vertex(h+10,v+1) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['X'] = dbn_p_letterX +dbn_p_letter[24] = dbn_p_letterX +# X +def dbn_p_letterX(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v) + vertex(h+10,v+10) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['X'] = dbn_p_letterX +dbn_p_letter[24] = dbn_p_letterX +# Y +def dbn_p_letterY(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h,v+7) + # vertex(h,v+7) + vertex(h+3,v+4) + # vertex(h+3,v+4) + vertex(h+10,v+4) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+10,v+10) + vertex(h+10,v+1) + endShape() + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h+9,v) + vertex(h+2,v) + # vertex(h+2,v) + vertex(h,v+2) + endShape() + popMatrix() +dbn_p_letter['Y'] = dbn_p_letterY +dbn_p_letter[25] = dbn_p_letterY +# Z +def dbn_p_letterZ(h, v, debug_poly=False): + pushMatrix() + scale(1, -1) + if debug_poly: stroke(random(256),200, 200) + beginShape() + vertex(h,v+10) + vertex(h+10,v+10) + # vertex(h+10,v+10) + vertex(h,v) + # vertex(h,v) + vertex(h+10,v) + endShape() + popMatrix() +dbn_p_letter['Z'] = dbn_p_letterZ +dbn_p_letter[26] = dbn_p_letterZ diff --git a/2019/sketch_190421a/sketch_190421a.png b/2019/sketch_190421a/sketch_190421a.png new file mode 100644 index 00000000..1d3401f3 Binary files /dev/null and b/2019/sketch_190421a/sketch_190421a.png differ diff --git a/2019/sketch_190421a/sketch_190421a.pyde b/2019/sketch_190421a/sketch_190421a.pyde new file mode 100644 index 00000000..e4820e03 --- /dev/null +++ b/2019/sketch_190421a/sketch_190421a.pyde @@ -0,0 +1,55 @@ +""" +Alexandre B A Villares +https://abav.lugaralgum.com/sketch-a-day + +Converting some of Maeda's Design by Number +dbnletters.dbn code -> Processing +""" +from dbn_generate_letters import convert_dbn_source_letters +from dbn_generate_polys import convert_dbn_source_polys + +from dbn_letters import * +from dbn_polys import * + +debug_poly = True + +def setup(): + colorMode(HSB) + size(800, 400) + fill(0) + text("Press 't' tto draw letters, and to generate code press 'g'(lines) or 'G'(polys)", 10, 20) + +def keyPressed(): + global debug_poly + if key == 'g': + convert_dbn_source_letters("data/dbnletters.dbn") + if key == 'G': + convert_dbn_source_polys("data/dbnletters.dbn") + if key == 't': + dbn_test() + if key == 'd': + debug_poly = not debug_poly + println("debug mode: " + repr(debug_poly)) + stroke(0) + if key == "s": + saveFrame("###.png") + +def draw(): + scale(4, 4) + +def dbn_test(): + background(200) + noFill() + pushMatrix() + strokeCap(ROUND) + for y in range(0, 5): + for x in range(1, 6): + dbn_letter[x + y * 5](x * 12, -20 - y * 12, debug_poly) + dbn_letterZ(x * 12 + 12, -32 - y * 12) + translate(100, 0) + strokeCap(PROJECT) + for y in range(0, 5): + for x in range(1, 6): + dbn_p_letter[x + y * 5](x * 12, -20 - y * 12, debug_poly) + dbn_letterZ(x * 12 + 12, -32 - y * 12) + popMatrix() diff --git a/README.md b/README.md index cbf6fba5..376ea1f1 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,16 @@ Get updates from my sort-of-weekly newsletter: [[sketch-mail](https://villares.o --- +![sketch_190421a](2019/sketch_190420a/sketch_190421a.png) + +[sketch_190421](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190420a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +This clean up of my Design By Numbers studies from last year will count as today's sketch :) + +Check out the other pieces, pixel and scalable fonts I created here: http://github.com/villares/DesignByNumbers-alphabet + +--- + ![sketch_190420a](2019/sketch_190420a/sketch_190420a.gif) [sketch_190420a](https://github.com/villares/sketch-a-day/tree/master/2019/sketch_190420a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]