FileDocCategorySizeDatePackage
PointF.javaAPI DocAndroid 5.1 API4059Thu Mar 12 22:22:30 GMT 2015android.graphics

PointF

public class PointF extends Object implements android.os.Parcelable
PointF holds two float coordinates

Fields Summary
public float
x
public float
y
public static final Parcelable.Creator
CREATOR
Constructors Summary
public PointF()

public PointF(float x, float y)

        this.x = x;
        this.y = y; 
    
public PointF(Point p)

 
        this.x = p.x;
        this.y = p.y;
    
Methods Summary
public intdescribeContents()
Parcelable interface methods

        return 0;
    
public final booleanequals(float x, float y)
Returns true if the point's coordinates equal (x,y)

 
        return this.x == x && this.y == y; 
    
public booleanequals(java.lang.Object o)

        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PointF pointF = (PointF) o;

        if (Float.compare(pointF.x, x) != 0) return false;
        if (Float.compare(pointF.y, y) != 0) return false;

        return true;
    
public inthashCode()

        int result = (x != +0.0f ? Float.floatToIntBits(x) : 0);
        result = 31 * result + (y != +0.0f ? Float.floatToIntBits(y) : 0);
        return result;
    
public final floatlength()
Return the euclidian distance from (0,0) to the point

 
        return length(x, y); 
    
public static floatlength(float x, float y)
Returns the euclidian distance from (0,0) to (x,y)

        return FloatMath.sqrt(x * x + y * y);
    
public final voidnegate()

 
        x = -x;
        y = -y; 
    
public final voidoffset(float dx, float dy)

        x += dx;
        y += dy;
    
public voidreadFromParcel(android.os.Parcel in)
Set the point's coordinates from the data stored in the specified parcel. To write a point to a parcel, call writeToParcel().

param
in The parcel to read the point's coordinates from


                                        
        
        x = in.readFloat();
        y = in.readFloat();
    
public final voidset(float x, float y)
Set the point's x and y coordinates

        this.x = x;
        this.y = y;
    
public final voidset(android.graphics.PointF p)
Set the point's x and y coordinates to the coordinates of p

 
        this.x = p.x;
        this.y = p.y;
    
public java.lang.StringtoString()

        return "PointF(" + x + ", " + y + ")";
    
public voidwriteToParcel(android.os.Parcel out, int flags)
Write this point to the specified parcel. To restore a point from a parcel, use readFromParcel()

param
out The parcel to write the point's coordinates into

        out.writeFloat(x);
        out.writeFloat(y);