Little syntax error eclipse from processing.
in
Integration and Hardware
•
5 months ago
Hi,
Could you help me correcting syntax errors, when I rewrote processing sketch in eclipse.
Errors are very little, and time to time repeats... It would be enormous help for me for future scripts. Thanks:)
I will upload print-screens what was wrong in eclipse:
Here there is the script th eclipse rewritten, but it I do not know how to fix it:
It is made by D.Shiffman. - toxiclibs --> attraction point;
-
package layering;
import peasy.PeasyCam;import processing.core.PApplet;import toxi.physics.VerletPhysics;import toxi.geom.*;import toxi.physics.behaviors.*;import toxi.physics.*;
public class Layering extends PApplet {boolean dxfExport;boolean record;VerletPhysics physics;Cluster cluster;PeasyCam cam;int def;int abc;int sceneWidth = 1280;int sceneHeight = 800;
public void setup() {size(sceneWidth, sceneHeight,OPENGL);cam = new PeasyCam(this, 200, 500, 700, 400);physics=new VerletPhysics();physics.setDrag(0.05f);physics.setWorldBounds(new AABB(new Vec3D(sceneWidth/2, sceneHeight/2, 0), new Vec3D(sceneWidth/2, sceneHeight/2, 600)));cluster = new Cluster(this, 10, 0.0000000000000000001f, sceneWidth/40, sceneHeight/40);}
public void draw() {background(255);physics.update();cluster.display();cluster.showConnections();}}
package layering;
import java.util.ArrayList;
import toxi.geom.Vec3D;import toxi.physics.VerletParticle;
public class Cluster {Layering e;ArrayList <Particle> particles;ArrayList <Attractor> attractors = new ArrayList <Attractor>();float diameter;float springRadius = 30;float springForce;int gridDimensionX;int gridDimensionY;float pv = 20;Cluster(Layering _e, float d, float sf, int gridDimX, int gridDimY){e = _e;particles = new ArrayList();diameter = d;springForce = sf;gridDimensionX = gridDimX;gridDimensionY = gridDimY;int w = e.width/gridDimX;int h = e.height/gridDimY;//ArrayList of particlesfor (int y = 0; y < gridDimY; y++) {for (int x = 0; x < gridDimX; x++) {particles.add(new Particle(new Vec3D( (x+0.5f)*w, (y+0.5f)*h, 0 )));}}attractors.add( new Attractor(new Vec3D(e.width/2,e.height/2,0), e.random(-.1f,.1f)));//ArrayList of springs physicsfor (int i = 0; i < particles.size()-1; i++){VerletParticle ni = particles.get(i);for (int j = i+1; j < particles.size(); j++){VerletParticle nj = particles.get(j);if (e.dist(ni.x, ni.y, nj.x, nj.y) < springRadius) {}}}}void display(){for (Attractor a : attractors) {a.display();for (Particle p : particles) {p.display();a.lock();}}}void showConnections() {for (int i = 0; i < particles.size()-1; i++){VerletParticle pi = (VerletParticle) particles.get(i);for (int j = i+1; j < particles.size(); j++) {VerletParticle pj = (VerletParticle) particles.get(j);if (e.dist(pi.x, pi.y, pj.x, pj.y)<25 && e.dist(pi.x, pi.y, pj.x, pj.y)>19 ) {e.stroke(10);e.fill(255);e.beginShape();e.vertex(pi.x, pi.y );e.vertex(pj.x, pj.y );e.vertex(pj.x, pj.y,pv );e.vertex(pi.x, pi.y ,pv);
e.endShape(e.CLOSE);}}}}
}
package layering;
import toxi.geom.Vec3D;import toxi.physics.VerletParticle;import toxi.physics.behaviors.AttractionBehavior;
public class Particle extends VerletParticle {Layering e;float n = 5;float pv;float r;Particle (Layering _e, Vec3D loc) {e = _e;super(loc);r = 5;physics.addParticle(this);physics.addBehavior(new AttractionBehavior(this,r*8,-0.01f));}void display(){Vec3D vel = getVelocity().getNormalizedTo(r*2);e.strokeWeight(0.5f);e.ellipse(x, y, r*2, r*2);}}
package layering;
import toxi.geom.Vec3D;import toxi.physics.VerletParticle;import toxi.physics.behaviors.AttractionBehavior;
public class Attractor {
Layering e;float r;float force;Attractor(Layering _e, Vec3D loc, float f){e = _e;super(loc);force = f;r = 10;physics.addParticle(this);physics.addBehavior(new AttractionBehavior(this,400,f));}void display (){e.noStroke();e.fill (10,200,200);ellipse(x,y,r*2,r*2);e.fill(0);}}
1