Week 6
Coding
Attempt 6
for this attempt I tried to put some balance with the variables for my galaxy. I'm loving how it turned out. my next aim of this project is to augment these samples.
code:
float x = 0.5; float y = 0; float z = 0; float rotX = 0; float rotY = 0.302013;
float a = 20; float b = 30; float c = 8.0/3.0;
ArrayList<PVector> points = new ArrayList<PVector>();
void setup() { size(800, 600, P3D); colorMode(HSB); background(0);
}
void draw() { background(0); float dt = 0.01; float dx = (a * (y - x))*dt; float dy = (x * (b - z)- y)*dt; float dz = (x * y - c * z)*dt ; x = x + dx; y = y + dy; z = z + dz;
points.add(new PVector(x, y, z));
//scale(5); stroke(255); noFill(); noStroke();
float hu = 0; //beginShape(); pushMatrix();
translate(width/2,height/2); scale(10*sin(rotX)); rotateX(rotX); rotateZ(rotY);
for (PVector v : points) { fill(hu, 255, 255); pushMatrix(); translate(v.x, v.y, v.z); sphere(cos(rotY)); popMatrix(); PVector offset = PVector.random3D();
offset.mult(0.1); v.add(offset);
hu += 0.1; if (hu > 255) { hu = 0; } } popMatrix(); //endShape(); //println(x,y,z); rotX += 0.01; rotY += 0.01;
}
-6/6-













