diff --git a/2020/sketch_2020_11_22a/sketch_2020_11_22a.gif b/2020/sketch_2020_11_22a/sketch_2020_11_22a.gif new file mode 100644 index 00000000..3ca634ae Binary files /dev/null and b/2020/sketch_2020_11_22a/sketch_2020_11_22a.gif differ diff --git a/2020/sketch_2020_11_22a/sketch_2020_11_22a.pyde b/2020/sketch_2020_11_22a/sketch_2020_11_22a.pyde new file mode 100644 index 00000000..29e17e18 --- /dev/null +++ b/2020/sketch_2020_11_22a/sketch_2020_11_22a.pyde @@ -0,0 +1,37 @@ +from villares.line_geometry import hatch_poly, draw_poly, poly_edges, Line +def setup(): + size(400, 400) + strokeWeight(2) + +def draw(): + background(100, 100, 130) + stroke(0) + fill(255) + r = [(75, 150), (325, 150), (325, 300), (75, 300)] + r[0] = (mouseX, mouseY) + # dash_line (100, 100, mouseX, mouseY) + draw_poly(r) + angs = [int(degrees(atan2(e[0][1] - e[1][1], e[0][0] - e[1][0]) + PI + HALF_PI)) + for e in poly_edges(r)[::2]] + angs = {ang if ang < 180 else + ang - 180 if ang < 360 else + ang - 360 + for ang in angs} + # text(str(angs), 30, 30) + for ang in angs: + hatch_poly(r, radians(ang), spacing=5, function=dash_line) + + # I have modifierd Line .plot method to accept a custom drawing function + # and also also the hatch_poly, both at github.com/villares/villares + +def dash_line(xa, ya, xb, yb, divisions=12.5): + for i in range(0, int(divisions * 2), 2): + ts = i / float(divisions * 2) + te = (i + 1) / float(divisions * 2) + xs, ys, _ = Line(xa, ya, xb, yb).line_point(ts) + xe, ye, _ = Line(xa, ya, xb, yb).line_point(te) + line(xs, ys, xe, ye) + # circle(xe, ye, 5) + # circle(xs, ys, 5) + + diff --git a/README.md b/README.md index d36df640..77bf2097 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,12 @@ Here are listed some of the tools I have been using: --- +![sketch_2020_11_22a](2020/sketch_2020_11_22a/sketch_2020_11_22a.gif) + +[sketch_2020_11_22a](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_11_22a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + ![sketch_2020_11_21a](2020/sketch_2020_11_21a/sketch_2020_11_21a.gif) [sketch_2020_11_21a](https://github.com/villares/sketch-a-day/tree/master/2020/sketch_2020_11_21a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)]