class field { Vector3D loc,force; float size; float magnitude; float x,y, degree; field(Vector3D loc_, Vector3D vel_, float size_) { loc = loc_; //vel = vel_; size = size_; // cal } void draw() { rectMode(CORNER); fill(100,10); // rect(loc.x,loc.y,size,size); stroke(255); // line(loc.x,loc.y,loc.x+force.x,loc.y+force.y); } public void calcForce(Vector3D v) { float theta = Vector3D.angleBetween(v,loc); degree = radians(theta); float magnitude = Vector3D.distance(v,loc); x = magnitude * cos(degree); y = magnitude * sin(degree); // println(x); force = Vector3D.sub(v,loc); // println(force); force.normalize(); force.mult(2); } public boolean isParticleInside(Particle p) { float dist = Vector3D.distance(p.getLoc(),loc); if (dist < size) { return true; } else { return false; } } }