Hi,
I am trying to model an attractor set(google:"strange attractor" or "clifford attractor") in processing. I am relatively new to the environment but I've been programming for a while and am familiar with the syntax from Wiring/Arduino. I have run into a stumbling block when I try and render my set in 3d. Is there some prerequisite function I am missing?
Code:
import processing.opengl.*;
float ang;
int objNo = 1024;
float a = -1.4;
float b = 1.6;
float c = 1.0;
float d = 0.7;
float e = -1.3;
float f = 0.7;
int n;
float[]x = new float[objNo];
float[]y = new float[objNo];
float[]z = new float[objNo];
float[][]xyz = {x,y,z};
double bigX;
double bigY;
double bigZ;
void setup(){
size(300, 300,OPENGL);
xyz[0][0] = 0;
xyz[1][0] = 0;
xyz[2][0] = 0;
//populate arrray//
for (int i=0; i<xyz[0].length; i++){
n = (i+1)%objNo;
//xyz[0][n]//
bigX = (Math.sin(a*xyz[1][i]))+ (c*(Math.cos(a*xyz[0][i])));
//xyz[1][n]//
bigY = (Math.sin(b*xyz[0][i]))+ (d*(Math.cos(b*xyz[1][i])));
//xyz[2][n]//
bigZ = (Math.sin(e*xyz[1][i]))+ (f*(Math.cos(f*xyz[1][i])));//
xyz[0][n] = (float)bigX;
xyz[1][n] = (float)bigY;
xyz[2][n] = (float)bigZ;
}}
void draw(){
background(0);
stroke(255);
// pointLight(51, 102, 255, 65, 60, 100);
// pointLight(200, 40, 60, -65, -60, -150);
//ambientLight(70, 70, 10);
// translate(width/2, height/2, -200 + mouseX * 0.65);
// background(0);//
// rotateY(radians(ang));
// rotateX(radians(ang));
// ang++;
makePoints(xyz);}
void makePoints(float[][]pts){
float thisX;
float thisY;
float thisZ;
beginShape(POINTS);
for (int i = 0;i<pts[0].length; i++){
thisX=pts[0][i];
thisY=pts[1][i];
thisZ=pts[2][i];
strokeWeight(1);
vertex(thisX*100,thisY*100,thisZ*100-300);
}
}