File tree Expand file tree Collapse file tree
api/src/main/java/com/javaphysicsengine/api Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020public class PWorld {
2121 // Physic properties about this world
2222 private static final double GRAVITY_ACCELERATION = -9.81 ;
23+ private static final double SCALE = 100 ;
2324
2425 // List containing the physical bodies and joints
25- private ArrayList <PBody > bodies = new ArrayList <PBody >();
26- private ArrayList <PConstraints > constraints = new ArrayList <PConstraints >();
26+ private ArrayList <PBody > bodies = new ArrayList <>();
27+ private ArrayList <PConstraints > constraints = new ArrayList <>();
2728
2829 /**
2930 * Post-condition: Returns the list of bodies added to the world
@@ -139,8 +140,8 @@ private void translateBodies(double timeEllapsed) {
139140 body .getVelocity ().setY (body .getVelocity ().getY () + accelerationY * timeEllapsed );
140141
141142 // Getting the amount to translate by (Velocity = displacement / time)
142- double dx = body .getVelocity ().getX () * timeEllapsed ;
143- double dy = body .getVelocity ().getY () * timeEllapsed ;
143+ double dx = body .getVelocity ().getX () * timeEllapsed * SCALE ;
144+ double dy = body .getVelocity ().getY () * timeEllapsed * SCALE ;
144145
145146 // Translate the body
146147 body .translate (new Vector (dx , dy ));
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ public abstract class PBody {
3030 // The graphic properties of the object
3131 private Color outlineColor = Color .BLACK ;
3232 private Color fillColor = Color .BLUE ;
33+ private Color normalVectorColor = Color .RED ;
3334
3435 public Color getNormalVectorColor () {
3536 return normalVectorColor ;
@@ -39,8 +40,6 @@ public void setNormalVectorColor(Color normalVectorColor) {
3940 this .normalVectorColor = normalVectorColor ;
4041 }
4142
42- private Color normalVectorColor = Color .RED ;
43-
4443 /**
4544 * Creates a PBody object with a certain name attached
4645 * Pre-condition: "bodyName" must not be null
You can’t perform that action at this time.
0 commit comments