Hey, I'm trying to create something I have visualised in my head, but am fairly new to programming, especially with 3D work.
What i'm trying to achieve are a number of spheres positioned in a 'sphere' configuration in 3D, if you see what I mean. Imagine the nucleus of an atom, but with space between the spheres.
I can do a pseudo-2D version (although I think i'm doing it the long way), which might help to show what I'd like...
Code:float x, y, z;
float angle;
float radius = 180.0;
float frequency = 45;
void setup() {
size(400, 400);
background(0);
smooth();
noStroke();
}
void draw() {
background(0);
for (int i=0; i<360; i+=45) {
x = width/2 + cos(radians(angle))*(radius/2);
y = height/2 + sin(radians(angle))*(radius/2);
rectMode(CENTER);
fill(255);
ellipse (x, y, 10, 10);
angle -= frequency;
}
for (int i=0; i<360; i+=45) {
x = width/2 + cos(radians(angle))*(radius);
y = height/2 + sin(radians(angle))*(radius);
rectMode(CENTER);
fill(255);
ellipse (x, y, 20, 20);
angle -= frequency;
}
}
However, I'm not sure how to go to 3D and get the desired result - the steps needed? Obviously I need to add a Z dimension! Any ideas of what I need to do?