____________________ ISOMETRIC GRAMMARS Leon Rische ____________________ [2019-12-20 Fri] Table of Contents _________________ 1. Introduction 2. Transformation 3. Iteration 1 4. DONE Implement repeat function 5. DONE Bounds check be adding cuboid to grid 6. DONE Allow isize for positions 7. TODO Remove random cuboids from image 8. DONE Bounding box f list of cuboids 9. TODO bounded + randomly placed translate repeat 1 Introduction ============== This post extends the ideas presented in [Isometric Snowflakes] adding other transformations on cuboids. To do so, transformations are combined in (randomly generated) groups, then used to generate cuboids to add to the image. [Isometric Snowflakes] 2 Transformation ================ - Swapping axes - Mirroring along an axis 3 Iteration 1 ============= ,---- | (defun plt-swap-random-both (obj) | (plt-choice | (plt-swap-xy-both obj) | (plt-swap-xz-both obj) | (plt-swap-yz-both obj))) | | (defun plt-mirror-random-both (obj) | (plt-choice | (plt-mirror-x-at-both obj 64) | (plt-mirror-x-at-both obj 64) | (plt-mirror-x-at-both obj 64))) | | (defun plt-translate-repeat-random (obj) | (let ((times (plt-random-in-range 2 10)) | (step (plt-random-in-range 2 10))) | (plt-choice | (plt-translate-repeat-x obj step times) | (plt-translate-repeat-y obj step times) | (plt-translate-repeat-z obj step times)))) | | (defun plt-ig-random (obj) | (plt-choice | (plt-ig-random (plt-mirror-random-both obj)) | (plt-ig-random (plt-swap-random-both obj)) | (plt-ig-random (plt-swap-random-both obj)) | (plt-ig-random (plt-swap-random-both obj)) | (plt-ig-random (plt-translate-repeat-random obj)) | (plt-ig-random (plt-translate-repeat-random obj)) | (plt-ig-random (plt-translate-repeat-random obj)) | obj | obj | obj)) | | (let ((revision (format-time-string "%FT%H:%M:%S"))) | (dotimes (_i 100) | (let* ((seed (plt-random-seed)) | (caption (vector (format "0x%s" seed)))) | (random seed) | (let* ((grid-size 128) | (n-cuboids (plt-random-pow2 1 4)) | (grid (plt-make-grid grid-size))) | (dotimes (_ n-cuboids) | (-> | (plt-random-iso-cuboid | (plt-random-pow2-size 0 6) | grid-size) | (plt-ig-random) | (plt-grid-add grid))) | (plt-grid-to-image-bw | grid | (vector 32.0 32.0) | (concat dir "/" revision "/" seed ".svg")))))) `---- 4 DONE Implement repeat function ================================ 5 DONE Bounds check be adding cuboid to grid ============================================ 6 DONE Allow isize for positions ================================ 7 TODO Remove random cuboids from image ======================================= 8 DONE Bounding box f list of cuboids ===================================== 9 TODO bounded + randomly placed translate repeat ================================================= generate, bb, move to origin, translate repeat, randomly place