@@ -49,14 +49,14 @@ public PhysicsDebuggerPanel() {
4949// pEngine.getBodies().add(polygon);
5050
5151
52- PPolygon polygon1 = new PPolygon ("Hehe1" );
53- polygon1 .getVertices ().add (new Vector (310 , 510 ));
54- polygon1 .getVertices ().add (new Vector (310 , 600 ));
55- polygon1 .getVertices ().add (new Vector (400 , 600 ));
56- polygon1 .getVertices ().add (new Vector (400 , 510 ));
57- polygon1 .computeCenterOfMass ();
58- polygon1 .rotate (0.174533 );
59- pEngine .getBodies ().add (polygon1 );
52+ // PPolygon polygon1 = new PPolygon("Hehe1");
53+ // polygon1.getVertices().add(new Vector(310, 510));
54+ // polygon1.getVertices().add(new Vector(310, 600));
55+ // polygon1.getVertices().add(new Vector(400, 600));
56+ // polygon1.getVertices().add(new Vector(400, 510));
57+ // polygon1.computeCenterOfMass();
58+ // polygon1.rotate(0.174533);
59+ // pEngine.getBodies().add(polygon1);
6060// polygon1.rotate(0.174533);
6161
6262
@@ -126,19 +126,19 @@ public PhysicsDebuggerPanel() {
126126// PString string2 = new PString(circle3, circle4);
127127// pEngine.getConstraints().add(string2);
128128
129- PPolygon triangle = new PPolygon ("Triangle" );
130- triangle .setMoveable (false );
131- triangle .getVertices ().add (new Vector (600 , 500 ));
132- triangle .getVertices ().add (new Vector (240 , 240 ));
133- triangle .getVertices ().add (new Vector (600 , 240 ));
134- triangle .computeCenterOfMass ();
135- pEngine .getBodies ().add (triangle );
136-
137- PCircle circle = new PCircle ("Circle" );
138- circle .setCenterPt (Vector .of (420 , 640 ));
139- circle .setRadius (20 );
140- circle .setMass (1 );
141- pEngine .getBodies ().add (circle );
129+ // PPolygon triangle = new PPolygon("Triangle");
130+ // triangle.setMoveable(false);
131+ // triangle.getVertices().add(new Vector(600, 500));
132+ // triangle.getVertices().add(new Vector(240, 240));
133+ // triangle.getVertices().add(new Vector(600, 240));
134+ // triangle.computeCenterOfMass();
135+ // pEngine.getBodies().add(triangle);
136+ //
137+ // PCircle circle = new PCircle("Circle");
138+ // circle.setCenterPt(Vector.of(420, 640));
139+ // circle.setRadius(20);
140+ // circle.setMass(1);
141+ // pEngine.getBodies().add(circle);
142142
143143 /**
144144 * Test 1: Two boxes on top of each other
@@ -163,44 +163,48 @@ public PhysicsDebuggerPanel() {
163163// polygon2.translate(Vector.of(0, 10));
164164// pEngine.getBodies().add(polygon2);
165165
166- // PCircle circle = new PCircle("Circle");
167- // circle.setCenterPt(Vector.of(522, 440));
168- // circle.setRadius(20);
169- // circle.setMass(1);
170- // pEngine.getBodies().add(circle);
171- //
172- // PCircle circle5 = new PCircle("Circle");
173- // circle5.setCenterPt(Vector.of(510, 240));
174- // circle5.setRadius(20);
175- // circle5.setMass(1);
176- // circle5.setVelocity(Vector.of(0, 10));
177- // pEngine.getBodies().add(circle5);
178- //
179- // PPolygon polygon = new PPolygon("Box");
180- // polygon.getVertices().add(Vector.of(300, 400));
181- // polygon.getVertices().add(Vector.of(340, 400));
182- // polygon.getVertices().add(Vector.of(340, 440));
183- // polygon.getVertices().add(Vector.of(300, 440));
184- // polygon.computeCenterOfMass();
185- // pEngine.getBodies().add(polygon);
186- //
187- // for (int i = 0; i < 20; i++) {
188- // PCircle circle2 = new PCircle("Circle2");
189- // circle2.setMoveable(false);
190- // circle2.setCenterPt(Vector.of(100 + 40 * i, 140));
191- // circle2.setRadius(40);
192- // circle2.setMass(1);
193- // pEngine.getBodies().add(circle2);
194- // }
195- //
196- // for (int i = 0; i < 20; i++) {
197- // PCircle circle2 = new PCircle("Circle2");
198- // circle2.setMoveable(false);
199- // circle2.setCenterPt(Vector.of(100, 140 + 40 * i));
200- // circle2.setRadius(40);
201- // circle2.setMass(1);
202- // pEngine.getBodies().add(circle2);
203- // }
166+ /**
167+ * Test 2
168+ */
169+
170+ PCircle circle = new PCircle ("Circle" );
171+ circle .setCenterPt (Vector .of (522 , 440 ));
172+ circle .setRadius (20 );
173+ circle .setMass (1 );
174+ pEngine .getBodies ().add (circle );
175+
176+ PCircle circle5 = new PCircle ("Circle" );
177+ circle5 .setCenterPt (Vector .of (510 , 240 ));
178+ circle5 .setRadius (20 );
179+ circle5 .setMass (1 );
180+ circle5 .setVelocity (Vector .of (0 , 10 ));
181+ pEngine .getBodies ().add (circle5 );
182+
183+ PPolygon polygon = new PPolygon ("Box" );
184+ polygon .getVertices ().add (Vector .of (300 , 400 ));
185+ polygon .getVertices ().add (Vector .of (340 , 400 ));
186+ polygon .getVertices ().add (Vector .of (340 , 440 ));
187+ polygon .getVertices ().add (Vector .of (300 , 440 ));
188+ polygon .computeCenterOfMass ();
189+ pEngine .getBodies ().add (polygon );
190+
191+ for (int i = 0 ; i < 20 ; i ++) {
192+ PCircle circle2 = new PCircle ("Circle2" );
193+ circle2 .setMoveable (false );
194+ circle2 .setCenterPt (Vector .of (100 + 40 * i , 140 ));
195+ circle2 .setRadius (40 );
196+ circle2 .setMass (1 );
197+ pEngine .getBodies ().add (circle2 );
198+ }
199+
200+ for (int i = 0 ; i < 20 ; i ++) {
201+ PCircle circle2 = new PCircle ("Circle2" );
202+ circle2 .setMoveable (false );
203+ circle2 .setCenterPt (Vector .of (100 , 140 + 40 * i ));
204+ circle2 .setRadius (40 );
205+ circle2 .setMass (1 );
206+ pEngine .getBodies ().add (circle2 );
207+ }
204208
205209
206210 // Create the game timer
0 commit comments