How did you choose your final design to print? Why did you choose those parameters?
The way I designed my final design was by trying out the different 3D primitives on the Reference page, scaling them, and rotating them. I use torus() function because it sounded fun, and it was cool looking design. Then I rotated it, and it looked like a 3D sphere but with lines, and then I also used a cylinder as something in the middle, but I know in the picture it doesn't look like that. I chose certain parameters that would intersect with both objects, so it would be one piece when I go to 3D print them.
If you printed out two versions, what changes did you make with the second version? What drew you to make those changes?
I made changes to the 3D primitive I wanted to use, and then I rotated the torus() function so it looks like a 3D sphere with a cylinder in the middle.
I didn't know what the torus() function did, so curiosity got the best of me, and I wanted to try something different.
If you ended up using the Reference page for p5.js, what functions did you end up exploring? Why did you choose those functions?
I ended up exploring the torus() function and cylinder() function. I didn't go into depth as to what the function did. The torus() function sounds fun, and then I saw the design, and I was like this is the one because it was fun looking. I also chose the cylinder() function because I wanted to try other function beside using the box () function.
What issues and challenges did you encounter? How did you get around those obstacles?
I feel like I didn't encounter huge issues or challenges, but I found out in p5.js that order matters when it comes to declaring variables. The way I found this out was by declaring the variable offset, and it took in other variables, but since I didn't declare them before offset, my program wouldn't run. However, I was able to fix this by talking to Sage.
What changes would you make on a future iteration of your project?
The future iteration I would do is to try to center the torus() function adaptation in my second design to the center of the cylinder in the middle.
"use strict";
var shape;
var sideLength = 50;
var baseDepth = 20;
var wallDepth = 4;
var wallHeight = 50;
var numLayers = 5;
var layerHeight = 10;
var offset = (sideLength - wallDepth) / 2;
function setup() {
createCanvas(400, 400, WEBGL);
debugMode();
}
function draw() {
background(220);
orbitControl();
lights();
noStroke();
shape = buildGeometry(createShape);
model(shape);
}
function createShape(){
push();
fill(250,250,0);
cylinder(sideLength, sideLength, baseDepth);
//drawing wall with color for visualization
fill(0,250,250);
for(let i = 0; i < numLayers; i++){
//moving up a level
translate(0,0,layerHeight);
rotateY(1)
scale(1.01,1.01,1.01);
rotate(.04);
for(let j =0; j <4; j++){
//moving out ()
translate(0,offset, 0);
//makes box
torus(sideLength, wallDepth, layerHeight);
//returning back to center
translate(0,-offset, 0);
//going to another size
rotateZ(PI/2);
}
}
pop();
}
function keyReleased(){
if(key === "s" || key === "S"){
shape.saveStl(gd.timestamp(), {binary:true});
}
}