We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey,
Very simple solution here. I'm trying to graph a figure 8 knot with particles, and the visual seems to be translating incorrectly around the z axis, as if there is only one quadrant repeating or something... is there a translate() solution for this?
import toxi.geom.*; import toxi.math.*; import toxi.util.*; import toxi.physics.*; import peasy.*; import toxi.physics.VerletParticle; import toxi.physics.VerletSpring;
int iteration = 50; PImage back; float w = 10;
Particle[] particles = new Particle[iteration]; ArrayList springs;
VerletPhysics physics; PeasyCam cam;
void setup(){ size(2560,1600, P3D); cam = new PeasyCam(this, 200); back = loadImage("backgroundKNUX.jpg");
}
void draw(){
float q = 0; background(back); lights();
for(int t =0; t < iteration; t++){
float x = ((2+cos(2*q))*cos(3*q))*10;
float y = ((2+cos(2*q))*sin(3*q))*10;
float z = (sin(4*q))*10;
Particle n = new Particle(x,y,z);
particles[t] = n;
q++;
} for(int p = 0; p < iteration; p++){ particles[p].display(); } }
Answers
Edit post, highlight code, press Ctrl-o
Cos and sin use radians by default.