package physics2D; import java.awt.*; public class Object2D { protected Vector2D position; protected Vector2D velocity; protected Vector2D acceleration; protected double angle; protected double angularVelocity; protected double angularAcceleration; protected double radius; protected double mass; public Object2D(Vector2D position, Vector2D velocity, double radius, double mass) { this.position = position; this.velocity = velocity; acceleration = new Vector2D(); angle = 0; angularVelocity = 0; angularAcceleration = 0; this.radius = radius; this.mass = mass; } public Object2D(double radius, double mass) { this(new Vector2D(), new Vector2D(), radius, mass); } public Vector2D getPosition() { return position; } public Vector2D getVelocity() { return velocity; } public Vector2D getAcceleration() { return acceleration; } public double getAngle() { return angle; } public double getAngularVelocity() { return angularVelocity; } public double getAngularAcceleration() { return angularAcceleration; } public double getRadius() { return radius; } public double getMass() { return mass; } public void move(Vector2D m) { position = position.add(m); } public void setVelocity(Vector2D v) { velocity = v; } public void rotate(double r) { angle = (angle - r) % (2 * Math.PI); } public void setAngularVelocity(double v) { angularVelocity = v; } }