Example usage for com.badlogic.gdx.physics.box2d Transform SIN

List of usage examples for com.badlogic.gdx.physics.box2d Transform SIN

Introduction

In this page you can find the example usage for com.badlogic.gdx.physics.box2d Transform SIN.

Prototype

int SIN

To view the source code for com.badlogic.gdx.physics.box2d Transform SIN.

Click Source Link

Usage

From source file:com.blindtigergames.werescrewed.debug.SBox2DDebugRenderer.java

License:Apache License

private void drawShape(Fixture fixture, Transform transform, Color color) {
    if (fixture.getType() == Type.Circle) {
        CircleShape circle = (CircleShape) fixture.getShape();
        t.set(circle.getPosition());/*from   www.  ja  v  a  2 s  .c o m*/
        transform.mul(t);
        drawSolidCircle(t, circle.getRadius(),
                axis.set(transform.vals[Transform.COS], transform.vals[Transform.SIN]), color);
    }

    if (fixture.getType() == Type.Edge) {
        EdgeShape edge = (EdgeShape) fixture.getShape();
        edge.getVertex1(vertices[0]);
        edge.getVertex2(vertices[1]);
        transform.mul(vertices[0]);
        transform.mul(vertices[1]);
        drawSolidPolygon(vertices, 2, color);
    }

    if (fixture.getType() == Type.Polygon) {
        PolygonShape chain = (PolygonShape) fixture.getShape();
        int vertexCount = chain.getVertexCount();
        for (int i = 0; i < vertexCount; i++) {
            chain.getVertex(i, vertices[i]);
            transform.mul(vertices[i]);
        }
        drawSolidPolygon(vertices, vertexCount, color);
    }

    if (fixture.getType() == Type.Chain) {
        ChainShape chain = (ChainShape) fixture.getShape();
        int vertexCount = chain.getVertexCount();
        for (int i = 0; i < vertexCount; i++) {
            chain.getVertex(i, vertices[i]);
            transform.mul(vertices[i]);
        }
        drawSolidPolygon(vertices, vertexCount, color);
    }
}

From source file:com.me.mygdxgame.Entities.MydebugRenderer.java

License:Apache License

private void drawShape(Fixture fixture, Transform transform, Color color) {
    if (fixture.getType() == Type.Circle) {
        CircleShape circle = (CircleShape) fixture.getShape();
        t.set(circle.getPosition());/*from   ww  w .  j av  a 2 s  .  com*/

        transform.mul(t);
        t.x = t.x * 29f;
        t.y = t.y * 29f;
        drawSolidCircle(t, circle.getRadius() * 29f,
                axis.set(transform.vals[Transform.COS], transform.vals[Transform.SIN]), color);
        return;
    }

    if (fixture.getType() == Type.Edge) {
        EdgeShape edge = (EdgeShape) fixture.getShape();
        edge.getVertex1(vertices[0]);
        edge.getVertex2(vertices[1]);
        transform.mul(vertices[0]);
        transform.mul(vertices[1]);
        drawSolidPolygon(vertices, 2, color, true);
        return;
    }

    if (fixture.getType() == Type.Polygon) {
        PolygonShape chain = (PolygonShape) fixture.getShape();
        int vertexCount = chain.getVertexCount();
        for (int i = 0; i < vertexCount; i++) {
            chain.getVertex(i, vertices[i]);
            transform.mul(vertices[i]);
            vertices[i].x = vertices[i].x * 29f;
            vertices[i].y = vertices[i].y * 29f;
        }
        drawSolidPolygon(vertices, vertexCount, color, true);
        return;
    }

    if (fixture.getType() == Type.Chain) {
        ChainShape chain = (ChainShape) fixture.getShape();
        int vertexCount = chain.getVertexCount();
        for (int i = 0; i < vertexCount; i++) {
            chain.getVertex(i, vertices[i]);
            transform.mul(vertices[i]);
        }
        drawSolidPolygon(vertices, vertexCount, color, false);
    }
}

From source file:org.box2d.r3.gdx.GDXBox2DDebugRenderer.java

License:Apache License

private void drawShape(final Fixture fixture, final Transform transform, final Color color) {
    if (fixture.getType() == Type.Circle) {
        final CircleShape circle = (CircleShape) fixture.getShape();
        t.set(circle.getPosition());//from  w w  w  .  j a  v a  2s . c o  m
        transform.mul(t);
        this.drawSolidCircle(t, circle.getRadius(),
                axis.set(transform.vals[Transform.COS], transform.vals[Transform.SIN]), color);
        return;
    }

    if (fixture.getType() == Type.Edge) {
        final EdgeShape edge = (EdgeShape) fixture.getShape();
        edge.getVertex1(vertices[0]);
        edge.getVertex2(vertices[1]);
        transform.mul(vertices[0]);
        transform.mul(vertices[1]);
        this.drawSolidPolygon(vertices, 2, color, true);
        return;
    }

    if (fixture.getType() == Type.Polygon) {
        final PolygonShape chain = (PolygonShape) fixture.getShape();
        final int vertexCount = chain.getVertexCount();
        for (int i = 0; i < vertexCount; i++) {
            chain.getVertex(i, vertices[i]);
            transform.mul(vertices[i]);
        }
        this.drawSolidPolygon(vertices, vertexCount, color, true);
        return;
    }

    if (fixture.getType() == Type.Chain) {
        final ChainShape chain = (ChainShape) fixture.getShape();
        final int vertexCount = chain.getVertexCount();
        for (int i = 0; i < vertexCount; i++) {
            chain.getVertex(i, vertices[i]);
            transform.mul(vertices[i]);
        }
        this.drawSolidPolygon(vertices, vertexCount, color, false);
    }
}