vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

35 lines
805 B

/**
* Created by Alex on 2/23/2015.
*/
import {BarnesHut} from "./components/physics/BarnesHutSolver";
import {SpringSolver} from "./components/physics/SpringSolver";
import {CentralGravitySolver} from "./components/physics/CentralGravitySolver";
class PhysicsEngine {
constructor(body, options) {
this.body = body;
this.nodesSolver = new BarnesHut(body, options);
this.edgesSolver = new SpringSolver(body, options);
this.gravitySolver = new CentralGravitySolver(body, options);
}
calculateField() {
this.nodesSolver.solve();
};
calculateSprings() {
this.edgesSolver.solve();
};
calculateCentralGravity() {
this.gravitySolver.solve();
};
calculate() {
this.calculateCentralGravity();
this.calculateField();
this.calculateSprings();
};
}