Example usage for com.badlogic.gdx.math.collision BoundingBox ext

List of usage examples for com.badlogic.gdx.math.collision BoundingBox ext

Introduction

In this page you can find the example usage for com.badlogic.gdx.math.collision BoundingBox ext.

Prototype

public BoundingBox ext(float x, float y, float z) 

Source Link

Document

Extends the bounding box by the given vector.

Usage

From source file:com.github.fauu.helix.graphics.ParticleEmitter.java

License:Apache License

/** Returns the bounding box for all active particles. z axis will always be zero. */
public BoundingBox getBoundingBox() {
    if (bounds == null)
        bounds = new BoundingBox();

    Particle[] particles = this.particles;
    boolean[] active = this.active;
    BoundingBox bounds = this.bounds;

    bounds.inf();// ww w  .ja v a  2 s  .c o m
    for (int i = 0, n = active.length; i < n; i++)
        if (active[i]) {
            Rectangle r = particles[i].getBoundingRectangle();
            bounds.ext(r.x, r.y, 0);
            bounds.ext(r.x + r.width, r.y + r.height, 0);
        }

    return bounds;
}