Example usage for com.badlogic.gdx.math Polygon setRotation

List of usage examples for com.badlogic.gdx.math Polygon setRotation

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Polygon setRotation.

Prototype

public void setRotation(float degrees) 

Source Link

Document

Sets the polygon to be rotated by the supplied degrees.

Usage

From source file:com.kotcrab.vis.runtime.entity.TextEntity.java

License:Apache License

private void calculateBoundingRectangle() {
    Polygon polygon = new Polygon(new float[] { 0, 0, textLayout.width, 0, textLayout.width, textLayout.height,
            0, textLayout.height });//from  w w w . j  a  v a2  s .  c om
    polygon.setPosition(x, y);
    polygon.setRotation(rotation);
    polygon.setScale(scaleX, scaleY);
    polygon.setOrigin(originX, originY);
    boundingRectangle = polygon.getBoundingRectangle();
}

From source file:de.hasait.tanks.app.common.model.AbstractGameObject.java

License:Apache License

public final Polygon createBounds(final S pState) {
    final float w2 = _width / 2.0f;
    final float h2 = _height / 2.0f;
    final Polygon bounds = new Polygon(new float[] { -w2, h2, w2, h2, w2, -h2, -w2, -h2 });
    bounds.setPosition(pState._centerX, pState._centerY);
    bounds.setRotation(pState._rotation);
    return bounds;
}

From source file:org.catrobat.catroid.content.Look.java

License:Open Source License

public Polygon[] getCurrentCollisionPolygon() {
    Polygon[] originalPolygons;/*from w  w w . j  av  a2  s  .c  o m*/
    if (getLookData() == null) {
        originalPolygons = new Polygon[0];
    } else {
        if (getLookData().getCollisionInformation().collisionPolygons == null) {
            getLookData().getCollisionInformation().loadOrCreateCollisionPolygon();
        }
        originalPolygons = getLookData().getCollisionInformation().collisionPolygons;
    }

    Polygon[] transformedPolygons = new Polygon[originalPolygons.length];

    for (int p = 0; p < transformedPolygons.length; p++) {
        Polygon poly = new Polygon(originalPolygons[p].getTransformedVertices());
        poly.translate(getX(), getY());
        poly.setRotation(getRotation());
        poly.setScale(getScaleX(), getScaleY());
        poly.setOrigin(getOriginX(), getOriginY());
        transformedPolygons[p] = poly;
    }
    return transformedPolygons;
}

From source file:pl.kotcrab.libgdx.util.Text.java

License:Apache License

private void calculateBoundingRectangle() {
    Polygon polygon = new Polygon(new float[] { 0, 0, textBounds.width, 0, textBounds.width, textBounds.height,
            0, textBounds.height });/*from   w w  w. ja  v a 2s . c o m*/

    polygon.setPosition(gx, gy);
    polygon.setRotation(rotation);
    polygon.setScale(scaleX, scaleY);
    polygon.setOrigin(originX, originY);

    boundingRectangle = polygon.getBoundingRectangle();
}