hi all,
i am totally new to processing3 so i apologize in advance if this is a simple issue.
i am trying to render the lorenz attractor. I am able to model it in 2D with this code
float x = 0.01;
float y = 0;
float z = 0;
float a = 10;
float b = 28;
float c = 8.0/3.0;
void setup() {
size(800, 650);
background(0);
}
void draw() {
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;
translate(width/2, height/2);
scale(10);
stroke(255);
point(x, y);
}
when i switch to doing a 3D render I get this error
0 AppKit 0x00007fff22c6247f -[NSWindow(NSWindow_Theme) _postWindowNeedsToResetDragMarginsUnlessPostingDisabled] + 352
1 AppKit 0x00007fff22c4d121 -[NSWindow _initContent:styleMask:backing:defer:contentView:] + 1375
2 AppKit 0x00007fff22c4cbbb -[NSWindow initWithContentRect:styleMask:backing:defer:] + 42
3 libnativewindow_macosx.jnilib 0x000000012cbc93fe Java_jogamp_nativewindow_macosx_OSXUtil_CreateNSWindow0 + 398
4 ??? 0x00000001159cba88 0x0 + 4657560200
)
this is my code
import peasy.*;
float x = 0.01;
float y = 0;
float z = 0;
float a = 10;
float b = 28;
float c = 8.0/3.0;
ArrayList<PVector> points = new ArrayList<PVector>();
PeasyCam cam;
void setup() {
size(800, 600, P3D);
background(0);
colorMode(HSB);
cam = new PeasyCam(this, 500);
}
void draw() {
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));
translate(0, 0, -80);
scale(5);
stroke(255);
point(x,y);
noFill();
float hu = 0;
beginShape();
for (PVector v : points) {
stroke(hu, 255, 255);
vertex(v.x, v.y,v.z);
hu += 0.1;
if (hu > 255) {
hu = 0;
}
}
endShape();
}
I have Processing 3.5.4 running on
MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports)
Processor 1.4 GHz Quad-Core Intel Core i5
Graphics Intel Iris Plus Graphics 645 1536 MB