Hi people,
since I've installed Processing 1.5, I've got an error with the parameters of my sliders. I want to control my parameters with sliders but also with the keys and then update the values:
hi people,
I have a problem with rotations of ellipses around a sphere. I place my dots and ellipse in 3D like this:
import processing.opengl.*;
int canvasX = 250;
int canvasY = canvasX;
int canvasZ = canvasX;
int dots = 500;
int radius = 150;
float[] posX = new float[dots];
float[] posY = new float[dots];
float[] posZ = new float[dots];
void setup() {
size(500,500, OPENGL);
frameRate(30);
background(0);
smooth();
}
void draw() {
noFill();
stroke(255);
translate(canvasX/2, canvasY/2);
for (int i = 0; i < dots; i++) {
float phi = posX[i]*TWO_PI;
float theta = PI - posY[i]*PI;
posX[i] = radius*sin(theta)*cos(phi)+canvasX/2;
posY[i] = radius*sin(theta)*sin(phi)+canvasY/2;
posZ[i] = radius*cos(theta)+canvasZ/2;
point(posX[i], posY[i],posZ[i]);
pushMatrix();
translate(posX[i], posY[i],posZ[i]);
//rotateX(???);
//rotateY(???);
ellipse(0,0,10,10);
popMatrix();
}
}
but I can find the way to rotate my ellipses to orient them in front of the center of the created sphere...like a "lookAt the center" property...or maybe a tangent stuff?
anyone got an idea ?
thx