FileDocCategorySizeDatePackage
Rectangle.javaAPI DocAndroid 5.1 API3091Thu Mar 12 22:22:30 GMT 2015android.filterfw.geometry

Rectangle

public class Rectangle extends android.filterfw.geometry.Quad
hide

Fields Summary
Constructors Summary
public Rectangle()

    
public Rectangle(float x, float y, float width, float height)

        super(new Point(x, y),
              new Point(x + width, y),
              new Point(x, y + height),
              new Point(x + width, y + height));
    
public Rectangle(android.filterfw.geometry.Point origin, android.filterfw.geometry.Point size)

        super(origin,
              origin.plus(size.x, 0.0f),
              origin.plus(0.0f, size.y),
              origin.plus(size.x, size.y));
    
private Rectangle(android.filterfw.geometry.Point p0, android.filterfw.geometry.Point p1, android.filterfw.geometry.Point p2, android.filterfw.geometry.Point p3)

        super(p0, p1, p2, p3);
    
Methods Summary
public android.filterfw.geometry.Pointcenter()

        return p0.plus(p1).plus(p2).plus(p3).times(0.25f);
    
public static android.filterfw.geometry.RectanglefromCenterVerticalAxis(android.filterfw.geometry.Point center, android.filterfw.geometry.Point vAxis, android.filterfw.geometry.Point size)

        Point dy = vAxis.scaledTo(size.y / 2.0f);
        Point dx = vAxis.rotated90(1).scaledTo(size.x / 2.0f);
        return new Rectangle(center.minus(dx).minus(dy),
                             center.plus(dx).minus(dy),
                             center.minus(dx).plus(dy),
                             center.plus(dx).plus(dy));
    
public static android.filterfw.geometry.RectanglefromRotatedRect(android.filterfw.geometry.Point center, android.filterfw.geometry.Point size, float rotation)

        Point p0 = new Point(center.x - size.x/2f, center.y - size.y/2f);
        Point p1 = new Point(center.x + size.x/2f, center.y - size.y/2f);
        Point p2 = new Point(center.x - size.x/2f, center.y + size.y/2f);
        Point p3 = new Point(center.x + size.x/2f, center.y + size.y/2f);
        return new Rectangle(p0.rotatedAround(center, rotation),
                             p1.rotatedAround(center, rotation),
                             p2.rotatedAround(center, rotation),
                             p3.rotatedAround(center, rotation));
    
public floatgetHeight()

        return p2.minus(p0).length();
    
public floatgetWidth()

        return p1.minus(p0).length();
    
public android.filterfw.geometry.Rectanglescaled(float s)

        return new Rectangle(p0.times(s), p1.times(s), p2.times(s), p3.times(s));
    
public android.filterfw.geometry.Rectanglescaled(float x, float y)

        return new Rectangle(p0.mult(x, y), p1.mult(x, y), p2.mult(x, y), p3.mult(x, y));