@Test public void testQuadTreeAwareCollisionPolygon() { for(int i = 0; i < 10; i++) { final int id = 97 + i; final Vector2 [] vectors = new Vector2[] { new Vector2(10f * i, 10f * i), new Vector2(20f * i, 20f * i), new Vector2(i, 20f * i) }; final CollisionPolygon collisionPolygon = collisions.quadTreeAwareCollisionPolygon(id, vectors); Assert.assertEquals(0, collisions.getTotalQuadTreeAwareCollisionPolygonsAvailable()); Assert.assertEquals(1, InterpolationTracker.getTotalObjects()); Assert.assertEquals(id, collisionPolygon.getId()); Assert.assertEquals(vectors[0].x, collisionPolygon.getX(), 0f); Assert.assertEquals(vectors[0].y, collisionPolygon.getY(), 0f); Assert.assertEquals(vectors[1].x, collisionPolygon.getX(1), 0f); Assert.assertEquals(vectors[1].y, collisionPolygon.getY(1), 0f); Assert.assertEquals(vectors[2].x, collisionPolygon.getX(2), 0f); Assert.assertEquals(vectors[2].y, collisionPolygon.getY(2), 0f); collisionPolygon.dispose(); Assert.assertEquals(DEFAULT_POOL_SIZE, collisions.getTotalQuadTreeAwareCollisionPolygonsAvailable()); Assert.assertEquals(0, InterpolationTracker.getTotalObjects()); collisionPolygon.dispose(); Assert.assertEquals(DEFAULT_POOL_SIZE, collisions.getTotalQuadTreeAwareCollisionPolygonsAvailable()); Assert.assertEquals(0, InterpolationTracker.getTotalObjects()); } }
public QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices) { return quadTreeAwareCollisionPolygon(CollisionIdSequence.nextId(), vertices); }
Collisions { public QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices) { return quadTreeAwareCollisionPolygon(CollisionIdSequence.nextId(), vertices); } }
Collisions { public QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices) { return quadTreeAwareCollisionPolygon(CollisionIdSequence.nextId(), vertices); } Collisions(); }
Collisions { public QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices) { return quadTreeAwareCollisionPolygon(CollisionIdSequence.nextId(), vertices); } Collisions(); synchronized void init(); CollisionBox collisionBox(); CollisionBox collisionBox(int id); CollisionBox collisionBox(int id, float x, float y, float width, float height); CollisionCircle collisionCircle(); CollisionCircle collisionCircle(int id); CollisionCircle collisionCircle(int id, float x, float y, float radius); CollisionPoint collisionPoint(); CollisionPoint collisionPoint(int id); CollisionPoint collisionPoint(int id, float x, float y); CollisionPolygon collisionPolygon(float [] vertices); CollisionPolygon collisionPolygon(int id, float [] vertices); CollisionPolygon collisionPolygon(Vector2[] vectors); CollisionPolygon collisionPolygon(int id, Vector2[] vectors); QuadTreeAwareCollisionBox quadTreeAwareCollisionBox(); QuadTreeAwareCollisionBox quadTreeAwareCollisionBox(int id); QuadTreeAwareCollisionBox quadTreeAwareCollisionBox(int id, float x, float y, float width, float height); QuadTreeAwareCollisionCircle quadTreeAwareCollisionCircle(); QuadTreeAwareCollisionCircle quadTreeAwareCollisionCircle(int id); QuadTreeAwareCollisionCircle quadTreeAwareCollisionCircle(int id, float x, float y, float radius); QuadTreeAwareCollisionPoint quadTreeAwareCollisionPoint(); QuadTreeAwareCollisionPoint quadTreeAwareCollisionPoint(int id); QuadTreeAwareCollisionPoint quadTreeAwareCollisionPoint(int id, float x, float y); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(int id, float [] vertices); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(Vector2[] vectors); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(int id, Vector2[] vectors); StaticCollisionBox staticCollisionBox(); StaticCollisionBox staticCollisionBox(int id); StaticCollisionBox staticCollisionBox(int id, float x, float y, float width, float height); StaticCollisionCircle staticCollisionCircle(); StaticCollisionCircle staticCollisionCircle(int id); StaticCollisionCircle staticCollisionCircle(int id, float centerX, float centerY, float radius); StaticCollisionPoint staticCollisionPoint(); StaticCollisionPoint staticCollisionPoint(int id); StaticCollisionPoint staticCollisionPoint(int id, float x, float y); StaticCollisionPolygon staticCollisionPolygon(float [] vertices); StaticCollisionPolygon staticCollisionPolygon(int id, float [] vertices); StaticCollisionPolygon staticCollisionPolygon(Vector2[] vectors); StaticCollisionPolygon staticCollisionPolygon(int id, Vector2[] vectors); void release(CollisionBox collisionBox); void release(CollisionCircle collisionCircle); void release(CollisionPoint collisionPoint); void release(CollisionPolygon collisionPolygon); void release(QuadTreeAwareCollisionBox collisionBox); void release(QuadTreeAwareCollisionCircle collisionCircle); void release(QuadTreeAwareCollisionPoint collisionPoint); void release(QuadTreeAwareCollisionPolygon collisionPolygon); void release(StaticCollisionBox collisionBox); void release(StaticCollisionCircle collisionCircle); void release(StaticCollisionPoint collisionPoint); void release(StaticCollisionPolygon collisionPolygon); int getTotalCollisionBoxesAvailable(); int getTotalCollisionCirclesAvailable(); int getTotalCollisionPointsAvailable(); int getTotalCollisionPolygonsAvailable(); int getTotalQuadTreeAwareCollisionBoxesAvailable(); int getTotalQuadTreeAwareCollisionCirclesAvailable(); int getTotalQuadTreeAwareCollisionPointsAvailable(); int getTotalQuadTreeAwareCollisionPolygonsAvailable(); int getTotalStaticCollisionBoxesAvailable(); int getTotalStaticCollisionCirclesAvailable(); int getTotalStaticCollisionPointsAvailable(); int getTotalStaticCollisionPolygonsAvailable(); }
Collisions { public QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices) { return quadTreeAwareCollisionPolygon(CollisionIdSequence.nextId(), vertices); } Collisions(); synchronized void init(); CollisionBox collisionBox(); CollisionBox collisionBox(int id); CollisionBox collisionBox(int id, float x, float y, float width, float height); CollisionCircle collisionCircle(); CollisionCircle collisionCircle(int id); CollisionCircle collisionCircle(int id, float x, float y, float radius); CollisionPoint collisionPoint(); CollisionPoint collisionPoint(int id); CollisionPoint collisionPoint(int id, float x, float y); CollisionPolygon collisionPolygon(float [] vertices); CollisionPolygon collisionPolygon(int id, float [] vertices); CollisionPolygon collisionPolygon(Vector2[] vectors); CollisionPolygon collisionPolygon(int id, Vector2[] vectors); QuadTreeAwareCollisionBox quadTreeAwareCollisionBox(); QuadTreeAwareCollisionBox quadTreeAwareCollisionBox(int id); QuadTreeAwareCollisionBox quadTreeAwareCollisionBox(int id, float x, float y, float width, float height); QuadTreeAwareCollisionCircle quadTreeAwareCollisionCircle(); QuadTreeAwareCollisionCircle quadTreeAwareCollisionCircle(int id); QuadTreeAwareCollisionCircle quadTreeAwareCollisionCircle(int id, float x, float y, float radius); QuadTreeAwareCollisionPoint quadTreeAwareCollisionPoint(); QuadTreeAwareCollisionPoint quadTreeAwareCollisionPoint(int id); QuadTreeAwareCollisionPoint quadTreeAwareCollisionPoint(int id, float x, float y); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(float [] vertices); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(int id, float [] vertices); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(Vector2[] vectors); QuadTreeAwareCollisionPolygon quadTreeAwareCollisionPolygon(int id, Vector2[] vectors); StaticCollisionBox staticCollisionBox(); StaticCollisionBox staticCollisionBox(int id); StaticCollisionBox staticCollisionBox(int id, float x, float y, float width, float height); StaticCollisionCircle staticCollisionCircle(); StaticCollisionCircle staticCollisionCircle(int id); StaticCollisionCircle staticCollisionCircle(int id, float centerX, float centerY, float radius); StaticCollisionPoint staticCollisionPoint(); StaticCollisionPoint staticCollisionPoint(int id); StaticCollisionPoint staticCollisionPoint(int id, float x, float y); StaticCollisionPolygon staticCollisionPolygon(float [] vertices); StaticCollisionPolygon staticCollisionPolygon(int id, float [] vertices); StaticCollisionPolygon staticCollisionPolygon(Vector2[] vectors); StaticCollisionPolygon staticCollisionPolygon(int id, Vector2[] vectors); void release(CollisionBox collisionBox); void release(CollisionCircle collisionCircle); void release(CollisionPoint collisionPoint); void release(CollisionPolygon collisionPolygon); void release(QuadTreeAwareCollisionBox collisionBox); void release(QuadTreeAwareCollisionCircle collisionCircle); void release(QuadTreeAwareCollisionPoint collisionPoint); void release(QuadTreeAwareCollisionPolygon collisionPolygon); void release(StaticCollisionBox collisionBox); void release(StaticCollisionCircle collisionCircle); void release(StaticCollisionPoint collisionPoint); void release(StaticCollisionPolygon collisionPolygon); int getTotalCollisionBoxesAvailable(); int getTotalCollisionCirclesAvailable(); int getTotalCollisionPointsAvailable(); int getTotalCollisionPolygonsAvailable(); int getTotalQuadTreeAwareCollisionBoxesAvailable(); int getTotalQuadTreeAwareCollisionCirclesAvailable(); int getTotalQuadTreeAwareCollisionPointsAvailable(); int getTotalQuadTreeAwareCollisionPolygonsAvailable(); int getTotalStaticCollisionBoxesAvailable(); int getTotalStaticCollisionCirclesAvailable(); int getTotalStaticCollisionPointsAvailable(); int getTotalStaticCollisionPolygonsAvailable(); static int DEFAULT_POOL_SIZE; }