Package org.jbox2d.collision.shapes

Examples of org.jbox2d.collision.shapes.PolygonShape


        m_count = 1;
        m_radius = circle.m_radius;

        break;
      case POLYGON:
        final PolygonShape poly = (PolygonShape)shape;
        m_count = poly.m_count;
        m_radius = poly.m_radius;
        for (int i = 0; i < m_count; i++) {
          m_vertices[i].set(poly.m_vertices[i]);
        }
View Full Code Here


    findMaxSeparation(results2, polyB, xfB, polyA, xfA);
    if (results2.separation > totalRadius) {
      return;
    }

    final PolygonShape poly1; // reference polygon
    final PolygonShape poly2; // incident polygon
    Transform xf1, xf2;
    int edge1; // reference edge
    boolean flip;
    final float k_relativeTol = 0.98f;
    final float k_absoluteTol = 0.001f;
View Full Code Here

        m_count = 1;
        m_radius = circle.m_radius;

        break;
      case POLYGON:
        final PolygonShape poly = (PolygonShape)shape;
        m_count = poly.m_count;
        m_radius = poly.m_radius;
        for (int i = 0; i < m_count; i++) {
          m_vertices[i].set(poly.m_vertices[i]);
        }
View Full Code Here

      m_debugDraw.drawSolidCircle(center, radius, axis, color);
    }
      break;

    case POLYGON: {
      PolygonShape poly = (PolygonShape)fixture.getShape();
      int vertexCount = poly.m_count;
      assert (vertexCount <= Settings.maxPolygonVertices);
      Vec2[] vertices = tlvertices.get(Settings.maxPolygonVertices);

      for (int i = 0; i < vertexCount; ++i) {
View Full Code Here

      m_debugDraw.drawSolidCircle(center, radius, axis, color);
    }
      break;

    case POLYGON: {
      PolygonShape poly = (PolygonShape)fixture.getShape();
      int vertexCount = poly.m_count;
      assert (vertexCount <= Settings.maxPolygonVertices);
      Vec2[] vertices = tlvertices.get(Settings.maxPolygonVertices);

      for (int i = 0; i < vertexCount; ++i) {
View Full Code Here

      EdgeShape shape = new EdgeShape();

      shape.set(new Vec2(-10.0f, 0.0f), new Vec2(10.0f, 0.0f));
      body.createFixture(shape, 0.0f);

      PolygonShape pshape = new PolygonShape();
      pshape.setAsBox(0.2f, 1.0f, new Vec2(0.5f, 1.0f), 0.0f);
      body.createFixture(pshape, 0.0f);
    }
    m_poly = new PolygonShape();
    m_poly.setAsBox(2.0f, 0.1f);
    m_circle = new CircleShape();
    m_circle.m_p.setZero();
    m_circle.m_radius = 0.5f;
View Full Code Here

      return;
    }
   
    { // Floor
      FixtureDef fd = new FixtureDef();
      PolygonShape sd = new PolygonShape();
      sd.setAsBox(50.0f, 10.0f);
      fd.shape = sd;

      BodyDef bd = new BodyDef();
      bd.position = new Vec2(0.0f, -10.0f);
      getWorld().createBody(bd).createFixture(fd);

    }

    { // Platforms
      for (int i = 0; i < 4; i++) {
        FixtureDef fd = new FixtureDef();
        PolygonShape sd = new PolygonShape();
        sd.setAsBox(15.0f, 0.125f);
        fd.shape = sd;

        BodyDef bd = new BodyDef();
        bd.position = new Vec2(0.0f, 5f + 5f * i);
        getWorld().createBody(bd).createFixture(fd);
      }
    }

    {
      FixtureDef fd = new FixtureDef();
      PolygonShape sd = new PolygonShape();
      sd.setAsBox(0.125f, 2f);
      fd.shape = sd;
      fd.density = 25.0f;

      BodyDef bd = new BodyDef();
      bd.type = BodyType.DYNAMIC;
View Full Code Here

  @Override
  public void initTest(boolean deserialized) {
    {
      {
        PolygonShape shape = new PolygonShape();
        Vec2[] vertices =
            new Vec2[] {new Vec2(-40, -20), new Vec2(40, -20), new Vec2(40, 0), new Vec2(-40, 0)};
        shape.set(vertices, 4);
        getGroundBody().createFixture(shape, 0.0f);
      }

      {
        PolygonShape shape = new PolygonShape();
        Vec2[] vertices =
            new Vec2[] {new Vec2(-40, -20), new Vec2(-20, -20), new Vec2(-20, 60),
                new Vec2(-40, 60)};
        shape.set(vertices, 4);
        getGroundBody().createFixture(shape, 0.0f);
      }

      {
        PolygonShape shape = new PolygonShape();

        Vec2[] vertices =
            new Vec2[] {new Vec2(20, -20), new Vec2(40, -20), new Vec2(40, 60), new Vec2(20, 60)};
        shape.set(vertices, 4);
        getGroundBody().createFixture(shape, 0.0f);
      }

      {
        PolygonShape shape = new PolygonShape();
        Vec2[] vertices =
            new Vec2[] {new Vec2(-40, 40), new Vec2(40, 40), new Vec2(40, 60), new Vec2(-40, 60)};
        shape.set(vertices, 4);
        getGroundBody().createFixture(shape, 0.0f);
      }
    }

    m_world.setParticleRadius(0.5f);
View Full Code Here

      EdgeShape edge = new EdgeShape();

      edge.set(new Vec2(-10.0f, 0.0f), new Vec2(10.0f, 0.0f));
      body.createFixture(edge, 0.0f);

      PolygonShape shape = new PolygonShape();
      shape.setAsBox(0.2f, 1.0f, new Vec2(0.5f, 1.0f), 0.0f);
      body.createFixture(shape, 0.0f);
    }

    {
      BodyDef bd = new BodyDef();
      bd.type = BodyType.DYNAMIC;
      bd.position.set(0.0f, 4.0f);

      PolygonShape box = new PolygonShape();
      box.setAsBox(2.0f, 0.1f);

      m_body = m_world.createBody(bd);
      m_body.createFixture(box, 1.0f);

      box.setAsBox(0.25f, 0.25f);

      // m_x = RandomFloat(-1.0f, 1.0f);
      m_x = -0.06530577f;
      bd.position.set(m_x, 10.0f);
      bd.bullet = true;
View Full Code Here

    }

    {
      float a = .5f;
      PolygonShape shape = new PolygonShape();
      shape.setAsBox(a, a);

      Vec2 x = new Vec2(-7.0f, 0.75f);
      Vec2 y = new Vec2();
      Vec2 deltaX = new Vec2(0.5625f, 1.25f);
      Vec2 deltaY = new Vec2(1.125f, 0.0f);
View Full Code Here

TOP

Related Classes of org.jbox2d.collision.shapes.PolygonShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.