This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Rhino.Geometry as rg | |
| import math | |
| Chain = [] | |
| try: | |
| N_int = int(round(N)) | |
| except: | |
| N_int = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This file contains parameters, helpers, and setup to | |
| create a basic gcode generation algorithm from line segments. | |
| The main | |
| Inputs: | |
| lines: the line segments to be converted into gcode commands for extrusion | |
| nozzle_diameter: the diameter of the 3D printer's nozzle | |
| filament_diameter: the diameter of the 3d printing filament |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LSystem desy3() { | |
| float moveDist = random(10, 40); | |
| float rotateAngle = random(20, 60); | |
| float scaleFactor = 1.9f; | |
| String axiom = "F"; | |
| // Create any production rules | |
| HashMap<Character, String> rules = new HashMap<>(); | |
| String[] produc = new String[] { "FF-[-F+F]F+[+F-F]F", "F+F--F+F[+F-F]", "F+F--F+F[-F][+F]F" }; | |
| rules.put('F', produc[(int) random(produc.length)]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LSystem desy2() { | |
| float moveDist = 44f; | |
| float rotateAngle = 25.7f; | |
| float scaleFactor = 2.8f; | |
| String axiom = "X"; | |
| HashMap<Character, String> rules = new HashMap<>(); | |
| // NOTE: no spaces in the strings: | |
| rules.put('X', "F[+X][-X]FX"); | |
| rules.put('F', "FF"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LSystem desy1() { | |
| float moveDist = 36; | |
| float rotateAngle = 50; | |
| float scaleFactor = 1.8; | |
| String axiom = "F"; | |
| // Create any production rules | |
| HashMap<Character, String> rules = new HashMap<>(); | |
| rules.put('F', "F[+F]F[-F]F+F--F+F[-F]"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This is an implementation of an L-System that extends the class | |
| // "BaseLSystem", which makes it easy to make new types of LSystems (e.g., probabalistic) | |
| // without repeating lots of code. | |
| // It assumes all input vocabulary not given a rule are constants. | |
| // Though you could give an explicit rule for a constant using "F" --> "F" | |
| // It contains a StringBuffer (currentIterationBuffer) that should be used | |
| // to handle production rules when computing the currentIteration string as part of iterate | |
| // in order avoid wasteful creation of strings and memory problems. | |
| // The StringBuffer is used in the iterate method of the LSystem. | |
| // @author: @mriveralee |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The main processing sketch for running the L1Assignment code | |
| // Handles incrementing/decrementing the iterations using keyPress events ('m' & 'n') | |
| // Output can be saved by pressing 's'. | |
| // @author: @mriveralee | |
| // Note: This sketch uses the Turtle library which can be downloaded from | |
| // https://github.com/leahbuechley/Turtle | |
| import processing.svg.*; | |
| import processing.pdf.*; | |
| import Turtle.*; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Turtle.*; | |
| Turtle t; | |
| void setup() { | |
| size(250, 600); | |
| background(0); | |
| stroke(255); | |
| noLoop(); | |
| t = new Turtle(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Turtle.*; | |
| import processing.svg.*; | |
| Turtle t; | |
| void setup() { | |
| size(1050, 1050); | |
| noLoop(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Turtle.*; | |
| Turtle turtle; | |
| void setup() { | |
| size(900, 900); | |
| noLoop(); | |
| colorMode(HSB, 360, 100, 100); | |
| background(0); |
NewerOlder