diff --git a/2022/sketch_2022_01_09a/sketch_2022_01_09a.png b/2022/sketch_2022_01_09a/sketch_2022_01_09a.png new file mode 100644 index 00000000..54bc78a2 Binary files /dev/null and b/2022/sketch_2022_01_09a/sketch_2022_01_09a.png differ diff --git a/2022/sketch_2022_01_10a_reticula/sketch_2022_01_10a_reticula.png b/2022/sketch_2022_01_10a_reticula/sketch_2022_01_10a_reticula.png new file mode 100644 index 00000000..5be436b9 Binary files /dev/null and b/2022/sketch_2022_01_10a_reticula/sketch_2022_01_10a_reticula.png differ diff --git a/2022/sketch_2022_01_11a/sketch_2022_01_11a.gif b/2022/sketch_2022_01_11a/sketch_2022_01_11a.gif new file mode 100644 index 00000000..cecf4f9e Binary files /dev/null and b/2022/sketch_2022_01_11a/sketch_2022_01_11a.gif differ diff --git a/2022/sketch_2022_01_11a/sketch_2022_01_11a.pyde b/2022/sketch_2022_01_11a/sketch_2022_01_11a.pyde new file mode 100644 index 00000000..e8ccc237 --- /dev/null +++ b/2022/sketch_2022_01_11a/sketch_2022_01_11a.pyde @@ -0,0 +1,32 @@ + +from random import choice + +modulor = [1, 2, 3, 5, 8, 13, 21] +strip_height = 8 +strips = 10 + +def setup(): + size(1400, 800) + colorMode(HSB) + noLoop() + +def draw(): + rects = [] + s = height / strips / strip_height + for y in range(0, 800, strip_height * s): + x = 0 + while x < width: + h = strip_height * s + w = choice(modulor) * s + if x + w > width: + continue + rects.append((x, y, w, h)) + x += w + + for x, y, w, h in rects: + fill((w / s * h / s) % 256, 200, 200) + rect(x, y, w, h) + +def keyPressed(): + redraw() + diff --git a/2022/sketch_2022_01_12a/sketch_2022_01_12a.jpeg b/2022/sketch_2022_01_12a/sketch_2022_01_12a.jpeg new file mode 100644 index 00000000..137485fa Binary files /dev/null and b/2022/sketch_2022_01_12a/sketch_2022_01_12a.jpeg differ diff --git a/2022/sketch_2022_01_12a/sketch_2022_01_12a.pyde b/2022/sketch_2022_01_12a/sketch_2022_01_12a.pyde new file mode 100644 index 00000000..c1cb59eb --- /dev/null +++ b/2022/sketch_2022_01_12a/sketch_2022_01_12a.pyde @@ -0,0 +1,112 @@ +boxes = [] + +def setup(): + size(500, 500, P3D) + colorMode(HSB) + create_boxes() + +def create_boxes(): + boxes[:] = [] + while len(boxes) < 4000: + w = int(random(1, 20)) * 12 + hw = w / 2 + x = int(random(hw, width - hw) - width / 2) + y = int(random(hw, height - hw) - height / 2) + z = int(random(hw, height - hw) - height / 2) + b = Box(x, y, z, w) + if not box_boxes_intersection(b): + boxes.append(b) + +def draw(): + background(0) + translate(width / 2, height / 2, - height) + rotateY(frameCount / 100.0) + for b in boxes: + b.plot() + # if keyPressed: + # b.plot_points() + +def keyPressed(): + create_boxes() + +def box_boxes_intersection(b): + for other in boxes: + if box_box_intersection(b, other): + return True + return False + +def box_box_intersection(a, b): + a_max_x, a_max_y, a_max_z = a.max + a_min_x, a_min_y, a_min_z = a.min + b_max_x, b_max_y, b_max_z = b.max + b_min_x, b_min_y, b_min_z = b.min + if a_max_x < b_min_x or b_max_x < a_min_x: + return False + if a_max_y < b_min_y or b_max_y < a_min_y: + return False + if a_max_z < b_min_z or b_max_z < a_min_z: + return False + return True + +class Box(): + + def __init__(self, x, y, z, w, h=None, d=None): + if not h: h = w + if not d: d = h + self.x = x + self.y = y + self.z = z + self.w = w + self.h = h + self.d = d + self.points = self.calc_points() + self.min = self.points[0] + self.max = self.points[-1] + + @property + def color(self): + return color( + self.w ** 2 / 2 % 255, + 200, + 200 + ) + + def calc_points(self): + hw, hh, hd = self.w / 2.0, self.h / 2.0, self.d / 2.0 + return ( + (self.x - hw, self.y - hh, self.z - hd), + (self.x - hw, self.y + hh, self.z - hd), + (self.x + hw, self.y - hh, self.z - hd), + (self.x + hw, self.y + hh, self.z - hd), + (self.x - hw, self.y - hh, self.z + hd), + (self.x - hw, self.y + hh, self.z + hd), + (self.x + hw, self.y - hh, self.z + hd), + (self.x + hw, self.y + hh, self.z + hd), + ) + + + def plot(self): + push() + translate(self.x, self.y, self.z) + fill(self.color) + box(self.w, self.h, self.d) + pop() + + def plot_points(self): + for x, y, z in (self.min, self.max): #self.points: + push() + translate(x, y, z) + fill(255) + box(5) + pop() + + def __repr__(self): + return "Box({}, {}, {}, {}, {}, {}).color={}".format( + self.x, + self.y, + self.z, + self.w, + self.h, + self.d, + self.color + ) diff --git a/README.md b/README.md index 8315d657..621bbf18 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,30 @@ Here are listed some of the tools I have been using: --- +![sketch_2022_01_12a](2022/sketch_2022_01_12a/sketch_2022_01_12a.jpeg) + +[sketch_2022_01_12a](https://github.com/villares/sketch-a-day/tree/master/2022/sketch_2022_01_12a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + +![sketch_2022_01_11a](2022/sketch_2022_01_11a/sketch_2022_01_11a.gif) + +[sketch_2022_01_11a](https://github.com/villares/sketch-a-day/tree/master/2022/sketch_2022_01_11a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + +![sketch_2022_01_10a_reticula](2022/sketch_2022_01_10a_reticula/sketch_2022_01_10a_reticula.png) + +[sketch_2022_01_10a_reticula](https://github.com/villares/sketch-a-day/tree/master/2022/sketch_2022_01_10a_reticula) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + +![sketch_2022_01_09a](2022/sketch_2022_01_09a/sketch_2022_01_09a.png) + +[sketch_2022_01_09a](https://github.com/villares/sketch-a-day/tree/master/2022/sketch_2022_01_09a) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] + +--- + ![sketch_2022_01_08b](2022/sketch_2022_01_08b/sketch_2022_01_08b.gif) [sketch_2022_01_08b](https://github.com/villares/sketch-a-day/tree/master/2022/sketch_2022_01_08b) [[Py.Processing](https://villares.github.io/como-instalar-o-processing-modo-python/index-EN)] diff --git a/admin_scripts/words_find.py b/admin_scripts/words_find.py new file mode 100644 index 00000000..e1dc707e --- /dev/null +++ b/admin_scripts/words_find.py @@ -0,0 +1,3 @@ + +with open("/usr/share/dict/words") as w: + print(w) \ No newline at end of file