FileDocCategorySizeDatePackage
Point.javaAPI DocAndroid 5.1 API2749Thu Mar 12 22:22:30 GMT 2015android.filterfw.geometry

Point

public class Point extends Object
hide

Fields Summary
public float
x
public float
y
Constructors Summary
public Point()

    
public Point(float x, float y)

        this.x = x;
        this.y = y;
    
Methods Summary
public booleanIsInUnitRange()

        return x >= 0.0f && x <= 1.0f &&
               y >= 0.0f && y <= 1.0f;
    
public floatdistanceTo(android.filterfw.geometry.Point p)

        return p.minus(this).length();
    
public floatlength()

        return (float)Math.sqrt(x*x + y*y);
    
public android.filterfw.geometry.Pointminus(float x, float y)

        return new Point(this.x - x, this.y - y);
    
public android.filterfw.geometry.Pointminus(android.filterfw.geometry.Point point)

        return this.minus(point.x, point.y);
    
public android.filterfw.geometry.Pointmult(float x, float y)

        return new Point(this.x * x, this.y * y);
    
public android.filterfw.geometry.Pointnormalize()

        return this.scaledTo(1.0f);
    
public android.filterfw.geometry.Pointplus(float x, float y)

        return new Point(this.x + x, this.y + y);
    
public android.filterfw.geometry.Pointplus(android.filterfw.geometry.Point point)

        return this.plus(point.x, point.y);
    
public android.filterfw.geometry.Pointrotated(float radians)

        // TODO(renn): Optimize: Keep cache of cos/sin values
        return new Point((float)(Math.cos(radians) * x - Math.sin(radians) * y),
                         (float)(Math.sin(radians) * x + Math.cos(radians) * y));
    
public android.filterfw.geometry.Pointrotated90(int count)

        float nx = this.x;
        float ny = this.y;
        for (int i = 0; i < count; ++i) {
            float ox = nx;
            nx = ny;
            ny = -ox;
        }
        return new Point(nx, ny);
    
public android.filterfw.geometry.PointrotatedAround(android.filterfw.geometry.Point center, float radians)

        return this.minus(center).rotated(radians).plus(center);
    
public android.filterfw.geometry.PointscaledTo(float length)

        return this.times(length / this.length());
    
public voidset(float x, float y)

        this.x = x;
        this.y = y;
    
public android.filterfw.geometry.Pointtimes(float s)

        return new Point(this.x * s, this.y * s);
    
public java.lang.StringtoString()

        return "(" + x + ", " + y + ")";